Has a follow up on my blog post about a PowerShell script to restart application pools. This script do it with remote PowerShell
$computername = "myserver"
$script = {
Import-Module WebAdministration
(Get-Item "IIS:\Sites\*"| Select-Object applicationPool).applicationPool | % { Restart-WebAppPool $_ }
}
$cred = Get-Credential
$remotesession = New-PSSession -ComputerName $computername -Credential $cred
Invoke-Command -Session $remotesession -ScriptBlock $script
No comments:
Post a Comment