Powershell – Manage User Profiles

To Delete user profiles with PowerShell you can use Remove-CIMInstance. But with great power comes great responsibility..So lets see how we can manage profiles.

Will return some useful information but not all we need to know

It shows me:

  1. the last time a profile was used (LastUseTime)
  2. The path for the user profile (LocalPath)
  3. if the profile is loaded (Loaded) – meaning a user is logged in or a service is using a profile using
  4. If it is a roaming profile, the path to the roaming profile and the roaming preference
  5. the SID of the user.

That does not tell me everything, so lets look at just 1 user, UserAdmin

Oh look there is now a property called “Special”

Hmm what does that mean?

Ah I see , Special, looks like it is a “special account”, so probably some user profiles we do not want to mess with or the world may end.

Also messing with something that is “Loaded” is probably not good either as, that is either a user logged into  the PC or a service.

Ok so lets filter things out

Ok that cool, I not have all profiles that are not loaded and are not special… but that one looks special…. ok hang on I will create a user

hmm that’s interesting

I have users with no profiles and they are disabled… anyhow

Ok I run the command above and BritV8 does not have a profile… of course they don’t they have never logged in! I can fix that!

Ok so a quick check and their profile directory is created

Lets check the registry

Yep BritV8 is there too

 

 

 

Leave a comment

Your email address will not be published. Required fields are marked *