Quantcast
Channel: PowerShell.org » All Posts
Viewing all articles
Browse latest Browse all 13067

Reply To: Deleting Old User Profiles

$
0
0

If you are using Windows Vista or higher, and Server 2008R2 or up, you can do it like this:

( Get-WmiObject -Class Win32_UserProfile | Where-Object { $_.LocalPath -eq 'c:\users\user' } ).Delete()

There is a lot of fuss about if the .Delete method exists or not, it is not in the MSDN, however I just did it on a test 2008R2 machine and it worked as expected.


Viewing all articles
Browse latest Browse all 13067

Trending Articles