I required a script that would run automatically for a user from a RunOnce key. This powershell script gives the user a message box asking if they would like to restart now or later. If they choose “yes” it will reboot now, if they choose “No” or “Cancel” it will not restart but will give the user a message box telling them that they need to restart manually ASAP.

Add-Type –AssemblyName PresentationCore,PresentationFramework
$ButtonType = [System.Windows.MessageBoxButton]::YesNoCancel
$MessageIcon = [System.Windows.MessageBoxImage]::Exclamation
$MessageBody = "In order to complete setup, Windows needs to restart. Click Yes to restart now or No if you plan to restart later."
$MessageTitle = "Cloudwyse Set-up Completion"
$ButtonType2 = [System.Windows.MessageBoxButton]::OK
$MessageIcon2 = [System.Windows.MessageBoxImage]::Error
$MessageBody2 = "The system will not operate correctly until a restart is completed. Remember to restart ASAP!"
$MessageTitle2 = "WARNING!!"
$Choice = [System.Windows.MessageBox]::Show($MessageBody,$MessageTitle,$ButtonType,$MessageIcon)
If ($Choice –eq "No" –OR $Choice –eq "Cancel") {
} Else {