Add User to A local Group (Script)
Ally77
Member Posts: 212
Hey stil studyin for this exam,
trying to get the sample script to work to add a user to the local administrators group in AD. Dont know much about scripting so need help!! The sample script is as follows :
strComputer = "MyComputer"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer,user")
objGroup.Add(objUser.ADsPath)
I pasted this into notepad, replaced "MyComputer" with my own computer name (even tried the full computer name) and saved it with the .exe extension but it would not work. Can anyone help me?Iv probably jus done somethin stupid since i dont know scripting
Thanks
trying to get the sample script to work to add a user to the local administrators group in AD. Dont know much about scripting so need help!! The sample script is as follows :
strComputer = "MyComputer"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer,user")
objGroup.Add(objUser.ADsPath)
I pasted this into notepad, replaced "MyComputer" with my own computer name (even tried the full computer name) and saved it with the .exe extension but it would not work. Can anyone help me?Iv probably jus done somethin stupid since i dont know scripting
Thanks
Comments
-
woodworm Member Posts: 153Tried it on my home PC and it worked ok (once I created a KenMyer user!).
It needs to be a .vbs extension
You're a lot better at scripting than me! I couldn't have written that -
Ally77 Member Posts: 212Aaaah i think i see what iv done! Been studyin too much am at the stage of making stupid mistakes. il go try that
Thanks for the reply