Skip to content

Instantly share code, notes, and snippets.

@automationhaus
Created November 4, 2016 12:28
Show Gist options
  • Save automationhaus/3626dd332c8b624e757726d6bad05e3a to your computer and use it in GitHub Desktop.
Save automationhaus/3626dd332c8b624e757726d6bad05e3a to your computer and use it in GitHub Desktop.
PowerShell script to remove user profiles from Citrix or RDS session host servers
$Exclusions = "NetworkService","LocalService","systemprofile"
Get-CimInstance win32_UserProfile | ?{$Exclusions -notcontains $(Split-Path -Path $_.LocalPath -Leaf)} | Remove-CimInstance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment