I am using get-WmiObject -class Win32_Group
to get a list of groups to interrogate. I am having the issue of no naming convention. There are group names like Admin Users
, AdminUsers
, Admin_Users
, Admin WWW Users
, Admin Users_
, etc.
My issue is that when the group name is returned, the spaces are removed. So I'll end up with something like AdminUsers
, AdminUsers
, Admin_Users
, AdminWWWUsers, AdminUsers_
, etc.
As you can see some will work and some will end up broken. I handled some issues with Regex but ALL of the conditions are getting out of control (started simple, expanding as I started noticing there was no naming convention).
How can I return the list of group names as they exist, so I can look them up for interrogation.
I have had no luck finding a solution to this, but I'm sure it can be done!