-1

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

GrZeCh
  • 2,332
  • 8
  • 29
  • 38
  • I'm not sure what it is unclear here. I'm looking for a way to start using Powershell Windows IIS web server application pools which are stopped but only if applications which are using this app pools have started status. – GrZeCh Jul 30 '15 at 10:07

1 Answers1

2

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.

Martin Brandl
  • 56,134
  • 13
  • 133
  • 172
  • Great. It looks like I will have to use also Get-WebAppPoolState because of website number runned on IIS server but I will probably manage to do that on my own. Thanks – GrZeCh Jul 31 '15 at 10:11