Skip to content

Instantly share code, notes, and snippets.

@jhamilton09
Created February 17, 2016 20:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhamilton09/d33569e6209ad36c9606 to your computer and use it in GitHub Desktop.
Save jhamilton09/d33569e6209ad36c9606 to your computer and use it in GitHub Desktop.
PowerShell script to remove profiles at shutdown/restart
$profiles = $null
$profiles = Get-WMIObject -class Win32_UserProfile | Where {((!$_.Special) -and ($_.LocalPath -ne "C:\Users\Administrator") -and ($_.LocalPath -ne "C:\Users\UpdatusUser"))}
if ($profiles -ne $null) {
$profiles | Remove-WmiObject
}
Exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment