How do you stop and start the service in Central Aministration using PowerShell in SharePoint 2016?

To stop a service:
$ServiceName = “Microsoft SharePoint Foundation Sandboxed Code Service”
Get-SPServiceInstance -server $env:COMPUTERNAME | where-object {$_.TypeName -eq $ServiceName} | Stop-SPServiceInstance -confirm:$false > $null

 

To start a service:
$ServiceName = “Microsoft SharePoint Foundation Sandboxed Code Service”
Get-SPServiceInstance -server $env:COMPUTERNAME | where-object {$_.TypeName -eq $ServiceName} | Start-SPServiceInstance -confirm:$false > $null

Add Comment