if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$PSCommandPath`"" -Verb RunAs exit } Unregister-ScheduledTask -TaskName WinDynamicDesktop -Confirm:$false Add-Type -AssemblyName PresentationCore,PresentationFramework [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") [System.Windows.MessageBox]::Show("Scheduled task deleted successfully.", "WinDynamicDesktop")