Jump to content


  • 0
Johnson

Prompt: Add Domain Users to the Local Administrators Group

Question

Hi.

 

During my Deployment of Windows 7 within my Task Sequence I would like to add a popup-prompt where I can type in a domain username.

And the domain user I type in will be added to the local Administrator Group.

 

I did find something on google, but I´m not able to get rid of why it isnt working. Anyone out there who have an idea?

 

/Johnson

 

domain = InputBox("What is the Domain name?") 
myUser = InputBox _
("What NT LOGON NAME do you wish to add to the Local Administrator Group?")

strDomainGroup = "WinNT://" & domain & "/" & myGroup & ",group"

Set objDomainGroup = GetObject(strDomainGroup)

Set objNetwork = CreateObject("Wscript.Network")

strComputer = objNetwork.ComputerName

Set objLocalGroup = GetObject("WinNT://" & strComputer _
& "/Administrators,group")

If Not objLocalGroup.IsMember(objDomainGroup.AdsPath) Then
objLocalGroup.Add(objDomainGroup.AdsPath)
End If

strDomainUser = "WinNT://" & domain & "/" & MyUser & ",user"

Set objDomainUser = GetObject(strDomainUser)

Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName

Set objLocalGroup = GetObject("WinNT://" & strComputer _
& "/Administrators,group")

If Not objLocalGroup.IsMember(objDomainUser.AdsPath) Then
objLocalGroup.Add(objDomainUser.AdsPath)

end IF 

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.