sam
2003-12-17 16:21:23 UTC
hi,
I use this code in my login script to add the current user to the
administrator local group, it functions if the user who try to
connect have local admin right (domain\admins, for exemple),
if the user who's connected does not have admin rights
(domain\newuser, for exemple), the script can't add the
account to the local admin group.
what can i do ? use an order like runas ?
if somebody can help me
thank you
Dim Domain
Dim UserName
Set net = WScript.CreateObject("WScript.Network")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Domain = WshNetwork.UserDomain
UserName = WshNetwork.UserName
local = net.ComputerName
set group = GetObject("WinNT://"& local &"/Administrateurs")
on error resume next
group.Add "WinNT://"& Domain &"/"& UserName &""
sam
I use this code in my login script to add the current user to the
administrator local group, it functions if the user who try to
connect have local admin right (domain\admins, for exemple),
if the user who's connected does not have admin rights
(domain\newuser, for exemple), the script can't add the
account to the local admin group.
what can i do ? use an order like runas ?
if somebody can help me
thank you
Dim Domain
Dim UserName
Set net = WScript.CreateObject("WScript.Network")
Set WshNetwork = WScript.CreateObject("WScript.Network")
Domain = WshNetwork.UserDomain
UserName = WshNetwork.UserName
local = net.ComputerName
set group = GetObject("WinNT://"& local &"/Administrateurs")
on error resume next
group.Add "WinNT://"& Domain &"/"& UserName &""
sam