$user = "USERNAME" Get-CimInstance Win32_UserProfile | Where-Object { $_.LocalPath -eq "C:\Users\$USERNAME" } | ForEach-Object { if (-not $_.Loaded) { Remove-CimInstance $_ } }