Skip to content

Instantly share code, notes, and snippets.

@jespernohr
Created July 13, 2016 08:50
Show Gist options
  • Save jespernohr/38a697d2da734fbbe4299a2eac1be3e4 to your computer and use it in GitHub Desktop.
Save jespernohr/38a697d2da734fbbe4299a2eac1be3e4 to your computer and use it in GitHub Desktop.
#creates a variable
$SVRNAME = 'server1.contoso.com'
#get service status
gsv -ComputerName $SVRNAME -Name Spooler
#stop service
(gsv -ComputerName $SVRNAME -Name Spooler).stop()
#start service
(gsv -ComputerName $SVRNAME -Name Spooler).start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment