04 May 2012

Add domain group to local group script

I found and used this little scrip and know I will probably try and find it again in the future...

To use, just change the group names and the "mywindowsdomain"

'get main objects/variables
Set ws = WScript.CreateObject ( "WScript.Shell" )
compname = ws.ExpandEnvironmentStrings ( "%COMPUTERNAME%" )
Set adGrp = GetObject ( "WinNT://" & compname & "/Administrators,group" )

'add domain groups to local admin group
adGrp.Add ( "WinNT://mywindowsdomain/Domain Admins,group" )

No comments:

Post a Comment