Categories
Welcome Center
Education & Development
Discussions
Certification Preparation
Recent Posts
Groups
Free Resources
Ebooks
Free Workshops
Trending Certifications Infographic
Infosec Training
IT & Security Training
Live Boot Camps
Security Awareness Training
About Infosec Institute
Home
Certification Preparation
Microsoft
Add User to A local Group (Script)
Ally77
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
Find more posts tagged with
Save $250 on 2025 certification boot camps from Infosec!
Book now with code EOY2025
Button
Comments
woodworm
Tried 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
Aaaah 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
Ally77
Cheers
It was just the wrong extension!what was i thinkin .exe instead of .vbs lol. been workin too much lately, gonna give it a break an get
@~"
;"ed tonight. probably do me good!!
Thanks again
Quick Links
All Categories
Recent Posts
Activity
Unanswered
Groups
Best Of
INFOSEC Boot Camps
$250
OFF
Use code
EOY2025
to receive $250 off your 2025 certification boot camp!
BROWSE BOOT CAMPS