Sign in to follow this  
Followers 0
boyemillar

Add Domain Users to a Group

6 posts in this topic

Does anyone know how to add Domain Users to a Goup Like the "Power Users Group"

Usually i do this in a DOS batch file...

(net localgroup "Power Users" "{mydomain}\Domain Users" /add)

Share this post


Link to post
Share on other sites



Does anyone know how to add Domain Users to a Goup Like the "Power Users Group"

Usually i do this in a DOS batch file...

(net localgroup "Power Users" "{mydomain}\Domain Users" /add)

You could just put that in a Run() statement.

Are you comfortable with COM objects? If so, you could do it with ADSI objects.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Do you mean run it like below where it just calls the batch file and tells it to run silent...

Run(@ComSpec & "\\{myserver}\Folder\Batchfile.bat",'',@sw_hide)

Edited by boyemillar

Share this post


Link to post
Share on other sites

Do you mean run it like below where it just calls the batch file and tells it to run silent...

Run(@ComSpec & "\\{myserver}\Folder\Batchfile.bat",'',@sw_hide)

Sort of, you don't have to put it inside a batch file:

$sDomain = "MyDomain"
$sDosCmd = 'net localgroup "Power Users" "' & $sDomain & '\Domain Users" /add'
$RET = RunWait(@ComSpec & " /c " & $sDosCmd, @WorkingDir, @SW_SHOW)
MsgBox(64, "Result", "Return code was: " & $RET)

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Cheerz PsaltyDS

I have changed it a little bit but you defo get top marks for the solution to my problem...

RunWait(@ComSpec & " /c " & 'net localgroup "Power Users" "' & "Domain1" & '\Domain Users" /add', @WorkingDir, @SW_HIDE)

RunWait(@ComSpec & " /c " & 'net localgroup "Power Users" "' & "Domain2" & '\Domain Users" /add', @WorkingDir, @SW_HIDE)

RunWait(@ComSpec & " /c " & 'net localgroup "Power Users" "' & "Domain3" & '\Domain Users" /add', @WorkingDir, @SW_HIDE)

Thanks again mate.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0