clear $spserver = get-spserver | ?{$_.role -eq "custom"} # you will need to change the custom based on ther server role ( front end, apppliation ) foreach ($server in $spserver) { write-host "Performing IIS Reset on Server:"$server.name # option A iisreset $server.Name # option B {Invoke-Command -ComputerName $_.Address {iisreset}} }