PowerShell: Quickly Start Windows Services on Remote Computers

$computernames=@(
	"COMPUTER1",
	"COMPUTER2"
)
$serviceName='windows_exporter'

get-service $serviceName -computername $computernames|start-Service
get-service $serviceName -computername $computernames|select MachineName,Name,Status
Sample output:

MachineName    Name              Status
-----------    ----              ------
COMPUTER1      windows_exporter Running
COMPUTER2      windows_exporter Running

Leave a Reply

Your email address will not be published. Required fields are marked *