[vbscript]Adding domain user to local admin

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

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.
4 answers Last reply
More about vbscript adding domain user local admin
  1. What Server OS are you running, 2003, 2005, 2010? and Im also assuming XP Pro?
  2. 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.
  3. 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

  4. 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

Read More

Configuration VBScript Domain Windows 7