Articles & News
Graphics & Displays
Tom's IT Pro
Login | Sign Up
The authority on tech
[vbscript]Adding domain user to local admin
Jan 17, 2013, 1:00 PM
Here is my situation:
I'm trying to run a script at the end of sysprep that will add a Domain group to the local Admins group. I found a few scripts while searching around, but none will work for my application.
This is what I have so far.
SET objNet = CREATEOBJECT("WScript.Network" )
' Set the user you want to make local administrator here
strUser = "<username here>"
strNetBIOSDomain = objNet.UserDomain
strComputer = objNet.ComputerName
SET objGroup = GETOBJECT("WinNT://" & strComputer & "/Administrators,group" )
SET objUser = GETOBJECT("WinNT://" & strNetBIOSDomain & "/" & strUser & ",user" )
' ignore error if user is already a member of the group
ON ERROR RESUME NEXT
ON ERROR GOTO 0
The problem I'm having is that I need to be able to provide a username and password of a domain admin so that it can authenticate. I need to know how to do this when I try to add the user.
Jan 17, 2013
vbscript adding domain user local admin
Jan 17, 2013, 1:26 PM
What Server OS are you running, 2003, 2005, 2010? and Im also assuming XP Pro?
Jan 17, 2013, 2:39 PM
We are running a mixed server os, both server 2003 and 2008, however our domain level is 2000. And I would be doing this customization on a Windows 7 PC.
Adding domain user to admin group
How to make domain user as local computer admin
Add Domain user to Local Group via vb script
Domain user local rights
Script for http that will fill in the domain for username
Can't find your answer ? Ask !
Get the answer
Jan 17, 2013, 3:28 PM
I would recomend using GPO to accomplish this because user names and passwords are stored as plain text in the sysprep files. try this link and see if it work for your situation
Jan 17, 2013, 3:48 PM
Although I would love to be able to accomplish this with the use of GPO's, however, I do not have access to the GPO, thus the reason I'm doing it via a vbscript.
Ask a new question
Local user V/s Domain user
Script to list users and groups in domain admin and local ..
Cannot add user to local admins group
Problem with giving domain users local admim rights
Local admin access granted to domain user acct
Script that adds domain grp to local Admn group when joini..
Applying shutdown script by local GPO
Adding a domain user to local administrative group
Need Help with a Script!!!!
Add Domain Group to Local Admin Group
Workgroup versus Domain
Create user account from one domain to another domain
Changing Local Admin Password Across the Domain
XP Pro User - Can't Find W2K Domain
AD Local User Profiles
Subscribe to our newsletter
icon arrow stem circle
About Tom's Hardware
Licensing and Reprints
Other Purch sites
© 2018 Purch All Rights Reserved.