Hello.
Environment = WinXP client, joined to AD domain. User logged in as their user account.
Here is the desired result. User logs in, script runs, gathers username of whoevers logged in. Adds that user to the local administrators group. I found this script but requires the manual entry of a user name.
Dim DomainName
Dim UserAccount
Set net = WScript.CreateObject("WScript.Network")
local = net.ComputerName
DomainName = "DomainName"
UserAccount = "userAccount"
set group = GetObject("WinNT://"& local &"/Administrators") on error resume next
group.Add "WinNT://"& DomainName &"/"& UserAccount &"" CheckError sub
CheckError if not err.number=0
then set ole = CreateObject("ole.err") MsgBox ole.oleError (err.Number), vbCritical err.clear
else
MsgBox "Done."
end if
end sub
I know you guys are certified geniuses here so please lend me a hand
Thanks in advance!
Cory
Environment = WinXP client, joined to AD domain. User logged in as their user account.
Here is the desired result. User logs in, script runs, gathers username of whoevers logged in. Adds that user to the local administrators group. I found this script but requires the manual entry of a user name.
Dim DomainName
Dim UserAccount
Set net = WScript.CreateObject("WScript.Network")
local = net.ComputerName
DomainName = "DomainName"
UserAccount = "userAccount"
set group = GetObject("WinNT://"& local &"/Administrators") on error resume next
group.Add "WinNT://"& DomainName &"/"& UserAccount &"" CheckError sub
CheckError if not err.number=0
then set ole = CreateObject("ole.err") MsgBox ole.oleError (err.Number), vbCritical err.clear
else
MsgBox "Done."
end if
end sub
I know you guys are certified geniuses here so please lend me a hand
Thanks in advance!
Cory