Clear Up Windows 2008 User Profiles

This code can be used in a StartUp GPO script or as a manual script to clear out stuck profiles on a server. This probably won’t delete the entire profile of users that are in use, but I haven’t tested that yet. This will just leave the default required profiles behind.

If you need any others left, just add them to the exclude list seperated by comma’s

$dirs = Get-ChildItem c:\Users -exclude Public,Default,Administrator,”All Users”,”Default User” $dirs |% {rd $_ -recurse -force}

Hope this helps

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: