Scripting Question

Prompt for AD account to add to local admin group

07/28/2017 768 views
I've been using the standard "join_domain.vbs" script on my K2000 as a post install task for adding systems to the domain, which works fine.  I'd like to improve my post install by prompting for the users AD account name and adding that name to the local administrators group. Is there an easy way to add this to the join domain script?  I see there are quite a few examples of adding a user account to the local admin group but I don't see any specifying prompting.  In the worst case if I could pre-populate the local admin group with the account of a local AD admin in that location that would work as well.  Appreciate any help.  Just getting into scripting so excuse the remedial nature of the post :)

0 Comments   [ + ] Show comments


  • This content is currently hidden from public view.
    Reason: Removed by member request For more information, visit our FAQ's.

All Answers

You may find it easier to use GPO instead of scripting for this, that way you control centrally who gets added by way of OU etc.
Answered 07/30/2017 by: ambrish7
White Belt

Dim dicLocalAdminGroupMembers
Dim objUser
Dim blnReturnValue

For Each objUser In dicLocalAdminGroupMembers
MsgBox "This is a spectacularly BAD idea."    
blnReturnValue = RemoveFromLocalAdminGroup(objUser)    
If blnReturnValue Then        
MsgBox "Phew!    
End If
Answered 07/31/2017 by: VBScab
Red Belt

I get it.  But if I go with a GPO, I still have to have a way to get the system in the proper OU during the deploy.  These are for remote sites that don't have local IT support. So maybe I should use this to do the add OU portion?
Answered 07/31/2017 by: kenrinc
Senior Yellow Belt

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ