Re: Script to add a user to a local computer group



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.
>



.



Relevant Pages

  • Re: Can Anyone Tell Me Why?
    ... I'll look around to see if someone has a canned script, ... > it returned the membership results as expected. ... >> on MSDN to perform this simple second query and if fails on trying to ... >>> Domain users group is somewhat special in that most of its members are ...
    (microsoft.public.windows.server.active_directory)
  • Verifying version numbers...
    ... I was given a script that will check the version number of files and then ... compares it to an update directory of those files, if the file in the update ... 100% only if the user has Administrator rights. ... change to the Domain Users group that will allow this script to work as it ...
    (microsoft.public.windows.group_policy)
  • logon script
    ... I can run the script when logging on the ... What right do I need to grant domain users group so they ...
    (microsoft.public.win2000.security)
  • RE: Separating a word file using executable script
    ... you good in Visual Basic Tom? ... >> I have a 200 page word document that contains information on applications. ... >> I'm hoping that the script will be an executable file. ... >> in a folder along with the script and run it from the folder. ...
    (microsoft.public.word.vba.general)
  • RE: message and batch file
    ... Tom, Thank you so much for your help. ... I have now created a second script to enable the same application that was ... file I was running has a one line command to disables the application.) ... disable the apps seleted or just run a batch file for the apps selected. ...
    (microsoft.public.windows.server.scripting)