Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding domain local groups to computer local groups 2

Status
Not open for further replies.
Jul 27, 2004
397
0
0
US
I need to add a domain local group to all workstations in the local admins group for machine management. I don't want to touch or logon to these machines. What is the easiest way possible. Do I have to use a script, or is there something in gp I don't know about. Thanks a lot.
 
Best way would be to do it via a vbscript. Do a search in the VBScript forum, you should be able to find a few examples there.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Try with Net localgroup /?. You'll see how to use the command. Then You can put it in login script or deploy on other way.

Regards, Iztok
 
Restricted groups will do this. Be careful to include any existing groups in the computer local groups.

That is, if the administrators group on the workstation includes the domain admins group, put that group along with the new domain local group in the restricted groups policy.

 
here is some sample code to demo how you might automate the process. Shows how to add and delete from the local admins group.

[script]
'==========================================================================
'
' NAME: AddUserToLocalAdminGroup.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: ' DATE : 8/8/2004
'
' COMMENT: <comment>
'
'==========================================================================
On Error Resume Next

Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")

'Edit the next line with your domain name
DomainString = "DomainName"
UserString = WSHNetwork.UserName

'Add the user to the local admins group
Call WSHShell.Run("cmd.exe /C net localgroup administrators " & DomainString & "\" & UserString & " /add")

'Remove the user from the local admins group
Call WSHShell.Run("cmd.exe /C net localgroup administrators " & DomainString & "\" & UserString & " /delete")
[/script]

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top