Start / Shutdown SharePoint 2010 using PowerShell

Start SharePoint 2010

---------------------------------

 # Start SharePoint 2010 Services
 "Starting SharePoint Server 2010"
 "SPTimerV4","WebAnalyticsService","SPWriterV4","DCLoadBalancer14","DCLauncher14","SPUserCodeV4","SPTraceV4","SPAdminV4","OSearch14","SPSearch4" | ForEach-Object {
     $servicePrior = get-service $_
     "$_  : " + $servicePrior.status 
 Start-Service $_
     $serviceAfter = get-service $_
     "$_ : " + $serviceAfter.status }
 " SharePoint Server 2010 is Up and running"
  
 Shutdown SharePoint Server 2010
--------------------------------------------

# Stop SharePoint Services
"Stopping SharePoint 2010"
"SPTimerV4","DCLoadBalancer14","DCLauncher14","SPWriterV4","SPUserCodeV4","SPTraceV4","SPAdminV4","WebAnalyticsService" ,"OSearch14","SPSearch4" | ForEach-Object {
    $servicePrior = get-service $_
    "$_ is " + $servicePrior.status
    Stop-Service $_ -Force
    $serviceAfter = get-service $_
    "$_ : " + $serviceAfter.status }
"SharePoint 2010 is Shutdown"
 

Comments

  • Anonymous
    September 22, 2011
    thanks for the script. but on my dev system the SPTimerV4 hangs "Stopping" I could not find a way to tell the script to move on. any clue?