Add Domain Security Group to Local Administrators Group of Workstations

I tried to use PSEXEC to leverage a command to add a newly created security group from Active Directory to the local workstations local administrators group. no matter how I wrote the command, it did not work. Any suggestions? Is this not possible?

I kept getting error code 1 and error code 2

1st attempt
psexec @c:\computers.txt net localgroup Administrators "US\New Security Group" /add

2nd attempt
psexec @c:\computers.txt net localgroup Administrators /add  "US\New Security Group"

3rd attempt
psexec @c:\computers.txt net localgroup Administrators US\New Security Group /add

4th attempt
psexec @c:\computers.txt net localgroup Administrators /add US\New Security Group

nothing worked. I think it has to do with syntax or the fact that I have a space in the name of hte security group.

any help...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


Looks like there is something similar here where they used group policy to push this to the workstations on the domain join. Perhaps this can point you in the right direction.
thesurg3onAuthor Commented:
group policy would be great, but this is more of a unique situation and we need to target a subset of computers, rather than reorganize them and write a group policy.

surely there is a scripted way to do this.
I had a feeling you were gonna say that....

How about this:

Its a utility that is apart of the server software.
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

You can give this a try;

Dim DomainName
Dim GroupAccount

Set net = WScript.CreateObject("WScript.Network")
local = net.ComputerName
DomainName = "your domain"
GroupAccount = "your group"
set group = GetObject("WinNT://"& local &"/Administrators")

on error resume next

group.Add "WinNT://"& DomainName &"/"& GroupAccount &""

sub CheckError
     if not err.number=0 then
          set ole = CreateObject("ole.err")
          MsgBox ole.oleError(err.Number), vbCritical
     end if
end sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thesurg3onAuthor Commented:
not sure if cusrmgr is available for server 2003. I am going to try this script that jrespo wrote.
thesurg3onAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.