We recently had a customers server have several User Profile issues and we were not able to log onto the server. The solution was to delete the user profiles remotely using this simple PowerShell command which was:
- as an Administrator
- logged into a different server on the same subnet
- with a user that was a Domain Administrator (but local admin on the target server would work aswell)
$Computer = "EXCH01" # Replace with your server's name or IP address
$Username = "alan" # Replace with the username of the profile you want to delete
Invoke-Command -ComputerName $Computer -ScriptBlock {
param($Username)
$profile = Get-WmiObject -Class Win32_UserProfile | Where-Object { $_.LocalPath.split('\')[-1] -eq $Username }
$profile | Remove-WmiObject
} -ArgumentList $Username
0 Comments