Перейти к содержимому

Как остановить и запустить все пулы iis через Powershell

Остановить pools iis через Powershell

Import-Module WebAdministration

if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }

$AppPools=Get-ChildItem IIS:\AppPools | Where {$_.State -eq "Started"}

ForEach($AppPool in $AppPools)
{
 Stop-WebAppPool -name $AppPool.name
# Write-Output ('Stopping Application Pool: {0}' -f $AppPool.name)
}

Запустить pools iis через Powershell

Import-Module WebAdministration

   if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }

   $AppPools=Get-ChildItem IIS:\AppPools | Where {$_.State -eq "Stopped"}
   ForEach($AppPool in $AppPools)
   {
    Start-WebAppPool -name $AppPool.name
   # Write-Output ('Starting Application Pool: {0}' -f $AppPool.name)
   }

 

Similar Posts:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *