Monday, September 19, 2016

IISRESET on all Server in single shot


Again one of be powerful command by Powershell to reset IIS in all servers of a Farm in single shot. No need to open the server one-by-one.

$spserver = get-spserver | where {$_.Role -ne "Invalid"}
foreach ($server in $spserver)
{    write-host "Performing IIS Reset on Server:"$server.name 
     iisreset $server.Name

$.Role values are:-

Invalid
Specifies that the server does not have a registered role in the configuration database. This value is typically used to represent servers that are outside of the SharePoint farm.
WebFrontEnd
Specifies that the server is a front-end Web server within the SharePoint Foundation deployment, and that the server is optimized for low request latency.
Application
Specifies that the server is for back end jobs and is optimized for high throughput.
SingleServer
Obsolete. Specifies that the server is the only server in the SharePoint Foundation deployment.Do not use in SharePoint 2016 and later. Use SingleServerFarm instead.
SingleServerFarm
Available in SharePoint 2016 and later. Specifies that the server is the only server in the SharePoint Foundation deployment.
DistributedCache
Available in SharePoint 2016 and later. Specifies that the server hosts a distributed cache and optionally routes web requests.
Search
Available in SharePoint 2016 and later. Specifies that the server hosts Search services.
Custom
Available in SharePoint 2016 and later. Specifies that the server does not participate in the MinRole experience, in which services are automatically deployed to servers added to the farm based on their role. The SharePoint farm administrator must manually manage which service instances are provisioned on the server.