added reboot logic
This commit is contained in:
parent
3cef681bbc
commit
10a445e0ff
@ -72,4 +72,23 @@ foreach ($i in $volumes) {
|
||||
if ($requireReboot -eq $true) {
|
||||
# TODO: Reboot logic goes here
|
||||
Write-Output "Reboot required!"
|
||||
|
||||
do
|
||||
{
|
||||
Write-Output 'Sleeping while waiting for time window'
|
||||
Write-Output 'Current Time:' + $now.TimeOfDay
|
||||
$now = Get-Date
|
||||
Start-Sleep -s 1200 #20 Minutes (1200 Seconds)
|
||||
}
|
||||
while ($now.TimeOfDay -gt $earliestRebootTime.TimeOfDay -and $now.TimeOfDay -lt $latestRebootTime.TimeOfDay)
|
||||
|
||||
|
||||
#Reboot PC with Faulty Disk for Offline Repair
|
||||
Restart-Computer -ComputerName $target -Force -Delay -Wait
|
||||
|
||||
#Wait for Reboot and Scan PC with Faulty Disk
|
||||
$result = Repair-Volume CimSession $cimSession -FileSystemLabel $volume.FileSystemLabel -Scan
|
||||
|
||||
#Report Un-Repairable Disks
|
||||
Write-Log $now +','+ $result + ',' + $targetComputer, +',' + 'Unable to repair'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user