Re: Script to add a user to a local computer group
- From: "Eric Lin" <ericlin_csw@xxxxxxxxxxx>
- Date: Tue, 15 Nov 2005 11:46:52 +0800
Hi Scott:
It must be domain admin can do this.
But alomost users belong to "domain user",
Is there any way to do this script in domain user group ?
"Scott Monroe" <smonroe@xxxxxxxxxxxxxxxxxxxxxxxx> ¼¶¼g©ó¶l¥ó·s»D:upoYulM4FHA.400@xxxxxxxxxxxxxxxxxxxxxxx
Tom,
I use the following to add the domain users group, but you could modify
it for a domain account. I set this up as a startup script in the default
domain policy gpo.
Scott
'=======================================================
'startup.vbs
'Version 1.0
'Author sm
'Purpose: startup script to add domain admins
'Version history
'1.0 - 09/11/04 - Original version
'=======================================================
'=======================================================
'Variables used
'o_wshshell used for access to shell functions
'o_objenv used for access to environment variables
'o_fso used for access to file system functions
'v_compname netbios name of the machine
'=======================================================
'set options
'option explicit
on error resume next
'=======================================================
'Declare variables
dim o_wshshell, o_objenv, o_fso, o_net, o_drives, o_destfile, o_srcfile
dim v_compname, curdrive, temp, v_regcheck, v_username, v_rc
dim o_file, o_file1
'=======================================================
'Open objects for use later
set o_wshshell = createobject("wscript.shell")
set o_objenv = o_wshshell.environment("Process")
set o_fso = createobject("scripting.filesystemobject")
'=======================================================
'log which script was run
set o_file = o_fso.createtextfile("c:\startup.log")
o_file.writeline "startup.vbs was run at " & now
'=======================================================
'pull initial variables from environment
v_compname = o_objenv("COMPUTERNAME")
'==============================================================
'check to make sure that it's not a server
Select Case v_compname
Case "SERVERNAME" endscript
End Select
'================
'Add domain users group to local admin group
Set Domain = GetObject("WinNT://" & v_compname)
For each Object in Domain
if Object.class = "Group" and Object.name <> "None" then
set oGroup = GetObject("WinNT://" & v_compname & "/"& Object.name)
if ogroup.name="Administrators" then
ogroup.add("WinNT://ADNETBIOS/Domain Users")
end if
end if
Next
'==============================================================
'exit script
endscript
sub endscript()
'clear objects
set o_drives = nothing
set o_wshshell = nothing
set o_objenv = nothing
set o_fso = nothing
set o_net = nothing
'exit script
wscript.quit
end sub
"Tom" <taadz@xxxxxxxxxxx> wrote in message
news:uRS10$63FHA.744@xxxxxxxxxxxxxxxxxxxxxxx
> List,
>
> Hi, I was wondering where I would begin to write a script to add a user
> "NT Authority\Authenticated User" to the local Users group of many XP
> workstations in a AD domain?
>
> I'm fairly new at scripting and not sure where to look for the right
> commands..
>
> Any help or direction would be great.
>
> Tom.
>
.
- References:
- Script to add a user to a local computer group
- From: Tom
- Re: Script to add a user to a local computer group
- From: Scott Monroe
- Script to add a user to a local computer group
- Prev by Date: Re: WshShell.SendKeys(Keys, Wait)?
- Next by Date: How to invoke a system color picker dialog box in WSH?
- Previous by thread: Re: Script to add a user to a local computer group
- Next by thread: Re: Script to add a user to a local computer group
- Index(es):
Relevant Pages
|