Relative Content

Tag Archive for powershellprofile

PowerShell Removing Profiles (registry, profile folder, and local account)

I am looking to remove all unused local accounts on all of our computers (400+/-.) I have a script that works for the basic part of removing the 2 local accounts that I’m mainly targeting, but I want to ensure it keeps all domain accounts. Is there a way to add a wildcard to the $AccountsToKeep line that would keep all domain accounts without typing each in? I tried ‘DOMAIN*’ but that didn’t seem to work.