Tuesday, 21 June 2011

using PowerShell v2 remoting to restart SharePoint services on all the WFE servers in the farm

First - put the servers into an array:
[Void][System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c")

$farm = ([Microsoft.SharePoint.Administration.SPFarm]::Local`

%{ $_.Services} `

?{$_.typename -eq "Windows SharePoint Services Web Application"}`

%{$_.instances} `

%{$_.Server} `




Then use a Foreach loop to step through each server in the array and restart the services on each:

foreach ($i in $farm)


$session = New-PSSession -ComputerName $i

Invoke-Command -Session $session -ScriptBlock { Restart-Service Sptimerv3 }

Invoke-Command -Session $session -ScriptBlock { Restart-Service Spadmin }


Remember to configure the firewall correctly and to ensure WinRM is initialized and enabled for Kerberos on the remote machines

No comments:

Post a Comment

SharePoint Information Architecture Diagram

Here is the template I use for Information Architecture designs. It's built using Mindjet and I flesh the nodes out with the low level d...