Andrew Aronoff
2012-05-07 15:13:55 UTC
I have a Windows Server 2008 R2 domain and a Windows XP Pro workstation that has been joined to the domain and then logged off. I am trying to create a VBS script to add a domain user to the local Administrators group.
I log onto the workstation as a local admin and run the following script:
Dim oNetwork : Set oNetwork = WScript.CreateObject("WScript.Network")
Dim strPC : strPC = oNetwork.ComputerName
Dim oGroup : Set oGroup = GetObject("WinNT://" & strPC & "/Administrators")
Dim oUser : Set oUser = GetObject("WinNT://domainname/username")
oGroup.Add(oUser.ADsPath)
This script returns the error "The network path was not found."
However, I am able to go into Control Panel > User Accounts > enter the username and the domainname > click Next... > choose the Administrators group from "Other" and the (domain-level) username will be added to the local Admin group.
The same script runs without error if it's launched after logging the workstation onto the domain with a domain Admin account.
How do I get my script to run without error when logged onto the workstation as a local admin?
regards, AndyA
I log onto the workstation as a local admin and run the following script:
Dim oNetwork : Set oNetwork = WScript.CreateObject("WScript.Network")
Dim strPC : strPC = oNetwork.ComputerName
Dim oGroup : Set oGroup = GetObject("WinNT://" & strPC & "/Administrators")
Dim oUser : Set oUser = GetObject("WinNT://domainname/username")
oGroup.Add(oUser.ADsPath)
This script returns the error "The network path was not found."
However, I am able to go into Control Panel > User Accounts > enter the username and the domainname > click Next... > choose the Administrators group from "Other" and the (domain-level) username will be added to the local Admin group.
The same script runs without error if it's launched after logging the workstation onto the domain with a domain Admin account.
How do I get my script to run without error when logged onto the workstation as a local admin?
regards, AndyA