Add User to A local Group (Script)

Ally77Ally77 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

Comments

Sign In or Register to comment.