简体   繁体   中英

How to start IIS application pools which are stopped only for websites which has "Started" status using Powershell?

does anyone can point me direction how I can start IIS (7/8) application pools which are stopped only for websites which has "Started" status using Powershell (so no starting app pool for their connected application/websites which has Stopped state)?

Scenario1: Stopped app pool Started website

START app pool

Scenario2: Stopped app pool Stopped website

DO NOTHING

Thanks

I don't understand the downvotes too. However, you can try this:

Import-Module WebAdministration

gci IIS:\Sites |
     where state -eq 'Started' | 
     select -ExpandProperty applicationPool | 
     % { Start-WebAppPool $_ }

It seems like you don't have to check whether the applicationPool is already started, but you can adopt the script and check the status using the Get-WebAppPoolState cmdlet if you think its necessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM