Pages

Monday, 5 June 2023

PASADT to create form restart requirement

 $proceed = 'RestartLater'

$noClickCounter = 0


while ($noClickCounter -lt 3) {

$noClickCounter++


$proceed = Show-InstallationPrompt -Title 'Restart Prompt' -Message "OHS Application Installation Completed. Click 'RestartNow' To Reboot the Machine.Click 'RestartLater' to Snooze the Restart for 1 hour. Deferral $noClickCounter" -ButtonRightText 'Restartnow' -ButtonLeftText 'RestartLater'


if ($proceed -eq 'RestartNow') {

Restart-Computer -Force

break

}


if ($noClickCounter -eq 3) {

$proceed = Show-InstallationPrompt -Title 'Restart Prompt' -Message 'OHS Application Installation Completed. Maximum Restart Diferrals Completed.Restart your Machine Now' -ButtonMiddleText 'Restart'

 Restart-Computer -Force

}

else {

Sleep -Seconds 3600

}

}

No comments:

Post a Comment

test

 # Set the file path you want to check $filePath = "C:\Path\To\Your\File.exe" # Check if file exists if (Test-Path $filePath) {   ...

Search This Blog