Link to home
Start Free TrialLog in
Avatar of tenchulyo
tenchulyo

asked on

Add user to Group remotely via batch

I am not on a domain controller (on a TS)  and I want to create a batch file that adds users to a certain group.

basically: [net local "MYGroup" User1 /add]  from a TS server.

I have some ideas but I was looking to see what others have in mind.

Thanks
Avatar of alicain
alicain

Lots of ways to do this one, but perhaps the most basic is with the net command which you are familiar with.  The full syntax being here : http://technet.microsoft.com/en-us/library/bb490703.aspx
net group [groupname username[ ...] {/add | /delete} [/domain]]

net ThisIsMyGroupName ThisIsAUserName /add /domain

Assuming the terminal server is in the same domain...

Regards,
Alastair.
Avatar of tenchulyo

ASKER

Hi Alastair,

The issue with using this command is that there are spaces in my group names so it doesn't find the group, I tried a wildcard (*), but that doesn't work...but this is what I was originally looking at... (ex VPN Users rather than VPNUsers)...Unless you know a way around this... and changing all my group names is not an option...

Thanks,

Lyo
ASKER CERTIFIED SOLUTION
Avatar of alicain
alicain

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome!! Thanks a lot sir!