Posted On September 30, 2022

PowerShell: Quickly Start Windows Services on Remote Computers

kimconnect 0 comments
blog.KimConnect.com >> Codes >> 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 *

Related Post

Basic CSS: Set the Font Family of an Element

<style>.red-text {color: red;}p {font-size: 16px;}</style><h2 class="red-text">CatPhotoApp</h2><main><p class="red-text">Click here to view more <a href="#">cat photos</a>.</p><a href="#"><img…

PowerShell: Perform Final Sync Between 2 Directories

Current Version # Final-Sync.ps1# This function performs CRC checks on each file at the source.#…

PowerShell: Function to Wait for Service to Be Back Online (After Server Reboots)

Function waitForService{ $testSucceeded=(Test-NetConnection $server -port $port).TcpTestSucceeded $null=Set-PSBreakpoint -Variable rightNow -Mode Read -Action { $global:testSucceeded =…