PowerShell Get-Uptime for single and multiple computers

PowerShell Get-Uptime for single and multiple computers

HomeSwapnil InfotechPowerShell Get-Uptime for single and multiple computers
PowerShell Get-Uptime for single and multiple computers
ChannelPublish DateThumbnail & View CountDownload Video
Channel AvatarPublish Date not found Thumbnail
0 Views
In this video, you will learn how to find the uptime of multiple remote computers. This script is very simple and you can modify it as per your need. I am giving the script below. Enjoy!!
Script as below

Server Get content /"c://scripts//LivePCs.txt/"
LiveServer @()
Dead server @()

current date get date
foreach(Server in Servers){
Pingtest Test Connection -ComputerName Server -Quiet -Count 1 -ErrorAction SilentlyContinue

if(pingtest) {
LiveServer /"Server/"
}

otherwise {DeadServer /"Server/" }}

foreach (PC in LiveServer) {Bootuptime (Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName PC).LastBootUpTime
Operating time current date – start time
up Write-Output /"(uptime.Days) days, (uptime.Hours) hours, (uptime.Minutes) minutes/"
Object [pscustomobject]@{
Computer PC
Operating time increased
}
Object Export-Csv -Path /"c://scripts//ServerUptime.csv/" -Append -NoTypeInformation

}
Write-Host /"Unreachable computer as below/"
DeadServer

Please take the opportunity to connect with your friends and family and share this video with them if you find it useful.