I would like to create a PowerShell script that can Start and Stop several IIS Applicationpools at once.
I already found a similar article about this: How to start and stop application pool in IIS using powershell script
But I would like to create a PowerShell script where I can define more than one IIS Application to stop them all at once through that script.
Thank you in advance for the help
The link you provided already has a solution very close to what you need; look for "Stop all application pools script".
If you want to start/stop only some AppPools, put them in an array: replace $AppPools=Get-ChildItem IIS:\AppPools | Where {$_.State -eq "Started"}
$AppPools=Get-ChildItem IIS:\AppPools | Where {$_.State -eq "Started"}
with $AppPools=@('server1', 'server2', 'server3')
:
$AppPools=@('server1', 'server2', 'server3')
ForEach($AppPool in $AppPools) {
Stop-WebAppPool -name $AppPool.name
}
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.