Remote Computer Status Checker

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.

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."