#Self elevate powershell to BuiltIn administrator account if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit } #List of the profiles that we need to keep $profilesToKeep='Public','Administrator','Default','NetworkService','LocalService','systemprofile' #Add the profile