Question : Script to Add Users to Local Group Remotely

I'm looking for a script (vbs or kixtart) that would allow me to remotely add each user to the local Power Users group on their W2K workstation.  Anybody have one they're willing to share?
Thanks,
ssherbin

Answer : Script to Add Users to Local Group Remotely

Not really...  the "run as" feature would require you to expose the Administrators password in the script.  If that's OK with you... then they're no need to go any futher.

Another answer is to modify the script to find all of the PC that are on the network.  Cycle thru each one, figure out the current user, then apply the script. Admittantly, you'd have to run it several time to get 'em all (they'll always be somebody on leave with their PC turned off).

Down-side to this plan is the detection of the current user... if somebody is "wandering" and is logged onto somebody else's PC... So, how about this idea.. you create a text file that has a list of all PC names and the account name you want to use for that PC.  The file would look like this:

pcname001,smithj
pcname002,doej

The script below will parse this list, and apply the changes to the groups. (BTW: I haven't run/debugged the script, so there might be typo)

Dim objs, obj
Dim wsh, Cmd, i, buf, RemotePC
dim fso, ts, AcctList(600), PCList(600), skip, list

' read a text file with "PC,Acct"
set fso = createobject("Scripting.FileSystemObject")
list = 0
set ts = fso.OpenTextFile("c:\somepath\somefile.txt", 1)
do while not ts.atendofstream
     buf = ts.readline
     i = instr(buf, ",")
     PCList(list) = mid(buf, 1, i-1)
     AcctList(list) = mid(buf, i+1)
     list = list +1
     loop
end if

' execute the "Net View" command
Set wsh = CreateObject("WScript.Shell")
set Cmd = wsh.Exec("Net View /Domain:" & RESOURCE_DOMAIN)
wscript.sleep 100

' read the output and parse the computer names
do while Not Cmd.StdOut.AtEndOfStream
      buf = cmd.stdout.readline
      if left(buf, 2) = "\\" then
            i = instr(buf, " ")
            RemotePC = mid(buf, 3, i-3)
            skip = true
            for i = 0 to list -1
                  if ucase(RemotePC) = ucase(PCList(i)) then
                        skip = false
                        exit for
                  end if
            next
            if not skip then
                                            Set Group = GetObject("WinNT://" & RemotePC & "/Power Users,Group")
                                            Group.add("WinNT://" & ACCT_DOMAIN & "/" & AcctList(i) & ",User")
                                            Group.Set
            end if

       end if
loop
Random Solutions  
 
programming4us programming4us