VBScript GPO
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
VBScript GPO

 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming
Author Message
Frodd
Guest





Posted: Wed Nov 09, 2005 5:50 pm    Post subject: VBScript GPO Reply with quote

Hi,
I´m trying to add the logged in domain user into the local administrators
group in a VBScript through a group policy. The script works locally on w2k3
server with a normal useraccount. This script doesn´t run on XP computers
with a normal user account, no error reports. If I add domain admins to the
local administrators group then I can run the script locally. Maby there is
an easier way to accomplish this?

Dim DomainName
Dim objNet, strUserName
Set objNet = CreateObject("Wscript.Network")
strUserName =objNet.UserName
Set net = WScript.CreateObject("WScript.Network")
local = net.ComputerName
DomainName = "nordiclan"
set group = GetObject("WinNT://"& local &"/Administrators")
on error resume next
group.Add "WinNT://"& DomainName &"/"& strUserName &""
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
--
AD/Exchange admin, 2003.
Back to top
Eric Lin
Guest





Posted: Thu Nov 10, 2005 8:58 am    Post subject: Re: VBScript GPO Reply with quote

me,too ..!
I think that domain user can't change group...!
Who can help us ???

"Frodd" <Frodd@discussions.microsoft.com> ¼¶¼g©ó¶l¥ó·s»D:DBBA4D95-E8DC-4BB1-B69C-D0F8668ECB62@microsoft.com...
Hi,
I¡¦m trying to add the logged in domain user into the local administrators
group in a VBScript through a group policy. The script works locally on w2k3
server with a normal useraccount. This script doesn¡¦t run on XP computers
with a normal user account, no error reports. If I add domain admins to the
local administrators group then I can run the script locally. Maby there is
an easier way to accomplish this?

Dim DomainName
Dim objNet, strUserName
Set objNet = CreateObject("Wscript.Network")
strUserName =objNet.UserName
Set net = WScript.CreateObject("WScript.Network")
local = net.ComputerName
DomainName = "nordiclan"
set group = GetObject("WinNT://"& local &"/Administrators")
on error resume next
group.Add "WinNT://"& DomainName &"/"& strUserName &""
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
--
AD/Exchange admin, 2003.
Back to top
Mark
Guest





Posted: Fri Nov 11, 2005 1:50 am    Post subject: Re: VBScript GPO Reply with quote

Hi Frodd\Erin,

A normal user won't be able to elevate themselves to admins. Not too sure
how this worked on your server.

If you want to give a group access then place the script under Machine
configuration. It will use the system account to run and no "Access Denied"
errors.

You won't be able to read the users name from the network object at this
point though because they haven't logged in yet. You could read what profiles
directories are stored under "Docs&Settings", stick the folder name into a
string and add that. But this isn't not very clean, prone to error, and
wouldn't work if this is the first time they have logged in.
Let me know.

Thanks,
Mark
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB