Check service status on multiple nodes

# List of remote computer names
$computers = @("Server01", "Server02", "Server03", "Server04", "Server05", "Server06")
# Name of the service you want to check
$serviceName = "PrintSpooler"
# Loop through the list of remote computers and check the service status
foreach ($computer in $computers) {
    try {
        $serviceStatus = Get-Service -ComputerName $computer -Name $serviceName
        Write-Host "Service $serviceName on $computer is $($serviceStatus.Status)"
    } catch {
        Write-Host "Failed to get service status on" $computer

Leave a Reply

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