Saturday, 18 February 2012

Remotely Starting Services Using Powershell

Remotely Starting Service Using PowerShell


  1. You have to run this script as Privileged user or as Administrator
  2. Your administrator should have allowed remote execution of script on the target machine


This is just a sample of starting Spooler Service on a remote machine


$computername = "XXX3AZYYY"
$c = Get-Credential -Credential "domain\AdminUsername"
$m = Get-WmiObject -Class Win32_Service -ComputerName $computername  -Credential $c -Filter "Name='spooler'"
$m.StartService()


No comments:

Post a Comment