I have this script here that works to create a local user account w/ password. What I'm trying to do is get it to also add that same user to the local admins group. I know the user is created because I can see it within the GUI managment console, but it won't add it to the admin groups. It outputs this error:
Exception calling "add" with "1" argument(s): "A member could not be added to or removed from the local group because
the member does not exist.
At C:\VM_scripts\CreateLocalUser02.ps1:103 char:1
+ $group.add("WinNT://"+ $user +",user")
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : CatchFromBaseAdapterMethodInvokeTI