A nice Powershell tip of the day today.

IISRESET all servers in the farm (specific to my demo environment, clearly -like or -match on your server prefix).

# script block starts here
$farmservers = Get-SPServer | ?{$_.address -match “DEMSP*”}
foreach ($server in $farmservers) {
Write-Host “Reset sent to $($server.name)…” -NoNewLine
iisreset $server.name
Write-Host “Done!”
}
# script block ends here

Why do the -match I hear you ask?

Get-SPServer returns all server objects in the farm including SQL and SMTP servers, which are likely to either (a) not have WWW service running or (b) if it is running its doing report server or OWA which you might not want to reset.

There is no error handling, as that is another tip!

More to follow…