Files
wLocal/PS/pLastBoot.ps1
USER 5ff1633bae .
2023-01-17 23:21:04 +00:00

10 lines
457 B
PowerShell

$computers = @("server","surgery12") #list of computers
foreach ($computer in $computers) {
$wmi = ""
if (Test-Connection $computer -Quiet){
$wmi = Get-WmiObject -Class win32_OperatingSystem -ComputerName $computer
if (($wmi.ConvertToDateTime($wmi.LocalDateTime) - $wmi.ConvertToDateTime($wmi.LastBootUpTime)).Days -gt 6){
Start-Process "cmd.exe" "/c C:\Scripts\wBase\Msg\tmessageH.bat RebootTheServer"
}
}
}