workgroup account management problem

by testmanps at 2013-04-18 07:17:48

help:
I can add user account at local machine’s administrators group,the code like this:

PS C:> [ADSI]$server="WinNT://mypc"
PS C:> $testuser=$server.Create(“User”,“testuser”)
PS C:> $testuser.SetPassword(“abc”)
PS C:> $testuser.SetInfo()
PS C:> [ADSI]$group="WinNT://mypc/Administrators,Group"
PS C:> $group.Add($testuser.path)


but how can i use a script to add user account from machine a,to b,c by powershell v2??
BTW: i know b,c 's administrator password. i don’t use Enter-PSSession comlet.

thx!
by DonJ at 2013-04-18 07:26:00
So, this is not a remoting question, as you are not using PowerShell’s Remoting feature. You are welcome to post in the Q&A forum. But, a short answer to your question is that you can’t “add an account from machine A to Machine B and C.” You have to create a new account on B and C, exactly as you’ve done here.