Saturday, October 31, 2015

How to Stop and Start All SharePoint 2013 Services using PowerShell

Prior to SharePoint patching, its a best practice to Stop all SharePoint 2013 and its related services and then start once patching is completed. If you don't do this, your service pack or patch installation will take longer than its expected.

So what are all the services to be stopped?

  • SharePoint 2013 Search Service (OSearch15)
  • SharePoint 2013 Timer Job (SPTimerV4)
  • SharePoint 2013 Administration (SPAdminV4)
  • SharePoint 2013 Tracing (SPTraceV4)
  • SharePoint 2013 VSS Writer (SPWriterV4)
  • SharePoint 2013 User Code Host (SPUserCodeV4)
  • SharePoint Search Host Controller (SPSearchHostController)
  • Forefront Sync Service (FIMSynchronizationService)
  • Forefront Service (FIMService)
  • World Wide Web Publishing Service (W3SVC)
Don't forget to do it in all your SharePoint Servers of the farm!

Stop all SharePoint 2013 Services
Lets use PowerShell to stop and start all SharePoint services:
Add-PSSnapin Microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

$SharePointServices = ('SPSearchHostController','OSearch15','SPWriterV4','SPUserCodeV4','SPTraceV4','SPTimerV4','SPAdminV4','FIMSynchronizationService','FIMService','W3SVC')

#Stop all SharePoint Services
foreach ($Service in $SharePointServices)
{
    Write-Host -ForegroundColor red "Stopping $Service..."
    Stop-Service -Name $Service
}

#Stop IIS
iisreset /stop

Start all SharePoint 2013 Services:
After the patching, Use the below script to start all SharePoint services.
Add-PSSnapin Microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

$SharePointServices = ('SPSearchHostController','OSearch15','SPWriterV4','SPUserCodeV4','SPTraceV4','SPTimerV4','SPAdminV4','FIMSynchronizationService','FIMService','W3SVC')

#Start all SharePoint Services
foreach ($Service in $SharePointServices)
{
    Write-Host -ForegroundColor green "Starting $Service..."
    Start-Service -Name $Service
}

#Start IIS
iisreset /start
You may need this script when you want to do some maintenance activity on your SharePoint SQL databases and needed to stop all SharePoint connections!



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...