← script library

Remote Computer Status Checker

NetworkingDecember 27, 2024

This PowerShell script is designed to check the status of remote computers on a network. It provides valuable insights into which machines are online, allowing system administrators to monitor server availability and quickly identify potential issues. By leveraging this script alongside ServerEngine, administrators can maintain better management of their network environment, enhancing operational efficiency and reliability.

powershell
param (
    [string[]]$computerNames = @("Computer1", "Computer2", "Computer3"),
    [int]$timeout = 2000
)
$computerStatus = @()
foreach ($computer in $computerNames) {
    try {
        $pingResult = Test-Connection -ComputerName $computer -Count 1 -TimeoutSeconds ($timeout / 1000) -ErrorAction Stop
        $status = "Online"
    } catch {
        $status = "Offline"
    }
    $computerStatus += [PSCustomObject]@{
        ComputerName = $computer
        Status = $status
    }
}
# Output the status results
$computerStatus | Format-Table -AutoSize
# Optionally, save the results to a file
$computerStatus | Export-Csv -Path "C:\RemoteComputerStatus.csv" -NoTypeInformation
Write-Output "Remote computer status check completed. Results saved to C:\RemoteComputerStatus.csv."

Run it across your fleet

This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.

Ready when you are.

Try ServerEngine free for 7 days.