Files
wLocal/PS/pLastBoot.ps1
2023-01-17 23:15:21 +00:00

10 lines
452 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\Base\tmessageH.bat RebootTheServer"
}
}
}