RE: Deploying user list to workgroup
- From: "Nick Staff" <nick.staff@xxxxxxxxxxx>
- Date: Thu, 7 Apr 2005 00:13:05 -0700
Tom-
You are not bothering me in the least - if anything it's my fault for giving
you code that doesn't work right. I don't know why I did this, but when I
initially tested the script I didn't use multiple computer names, I just
tested the local machine then ran it again for a remote machine. After your
post tonight I tried using multiple machines in the members.txt and it didn't
work for me either. I have made the neccesary changes though and now it
works. Here is the new code:
On error resume next
Set WSHShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
members = "c:\members.txt"
users = "c:\users.txt"
Const ForReading = 1
Set objMembers = objFSO.OpenTextFile _
(members, ForReading)
Do Until objMembers.AtEndOfStream
StrComputer = objmembers.Readline
Set objTextFile = objFSO.OpenTextFile _
(users, ForReading)
Do Until objTextFile.AtEndOfStream
acctInfo = objTextFile.Readline
uP = Split(acctInfo, ",", -1, 1)
Set colAccounts = GetObject("WinNT://" & strComputer & "")
Set objUser = colAccounts.Create("user", uP(0))
objUser.SetPassword uP(1)
objUser.SetInfo
Set objGroup = GetObject("WinNT://" & strComputer & "/Power Users,group")
Set objUseraDD = GetObject("WinNT://" & strComputer & "/" & uP(0) & ",user")
objGroup.Add(objUseraDD.ADsPath)
Loop
Loop
wscript.echo "Accounts have been created"
wscript.quit
"Goatbiker" wrote:
> Nick,
>
> I'll try to stop bothering you with this, but I can only deploy to one
> computer at a time, no matter how many are on the members list. Each
> computer name (the network ID) is on a seperate line. Any clues?
>
> Tom
>
> "Nick Staff" wrote:
>
> > Tom-
> >
> > I retested the script and it worked fine for me, unfortunately I guess that
> > doesn't really matter since the goal is to get it working for you ;)
> >
> > Do you have any XP boxes where you're at? I'm guessing the reason it's
> > working for me and not for you is I ran it on an XP box and possibly some of
> > the code is not supported when run from 2000. If you want to verify this,
> > open the script in notepad and put an appostrophe before the line on error
> > resume next (should be like the first or second line in the script. Save it
> > and then try running it - I bet you get an error (the on error resume next
> > line basically supresses errors and the appostrophe comments out the line so
> > you can see what's really going on).
> >
> > If my guess is right, then I think the script will still be able to update
> > the 2000 boxes but it might just need to be run via windows xp. Would that
> > be feasable or is there no way you can get a box set up with XP (if not I'll
> > try to modify the script but I don't have a 2k box to test it on so it'll be
> > a bit tricky).
> >
> > Please let me know, thanks.
> >
> > Nick
> >
> > "Goatbiker" wrote:
> >
> > > Nick,
> > >
> > > No Joy. Did as instructed, script runs and says "accounts have been
> > > created", but no accounts on computers. It will not deploy and it will not
> > > install the user to the computer it is on. Any thoughts?
> > >
> > > Tom
> > >
> > > "Nick" wrote:
> > >
> > > > okay, i wrote you a script that will do this for you.
> > > >
> > > > requirements:
> > > > - admin account on all workstations has same username/password (if not
> > > > you'll have to run it locally from each machine)
> > > > -must be able to resolve names of workstations
> > > > -adds users to Power Users group, change to desired group if Power Users is
> > > > wrong (search the code for Power Users and replace with group name you want)
> > > > - on 1 workstation create the file members.txt located at c:\members.txt
> > > > (this contains the names of all workstations you want the users added to - 1
> > > > name per line)
> > > > - on the same workstation create the text file users.txt located at
> > > > c:\users.txt (contains user accounts & their passwords - the format must be
> > > > user,password 1 per line and no space after the comma unless you want
> > > > the password to start with a space.
> > > > - on the same workstation create the text file enjoy.txt open it and past
> > > > the following code inside then save as "enjoy.vbs" with the quotes
> > > > - Double click enjoy.vbs and come back later - a message will alert you when
> > > > its done.
> > > >
> > > > 'START COPY
> > > >
> > > > On error resume next
> > > >
> > > > Set WSHShell = WScript.CreateObject("WScript.Shell")
> > > > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > > >
> > > > members = "c:\members.txt"
> > > > users = "c:\users.txt"
> > > >
> > > > Const ForReading = 1
> > > >
> > > > strInputFile = members
> > > >
> > > > Set objTextStream = objFSO.OpenTextFile(strInputFile, ForReading)
> > > > arrComputers = Split(objTextStream.ReadAll, vbCrLf)
> > > > objTextStream.Close
> > > >
> > > > Set objTextFile = objFSO.OpenTextFile _
> > > > (users, ForReading)
> > > >
> > > > For Each strComputer In arrComputers
> > > >
> > > > Do Until objTextFile.AtEndOfStream
> > > > acctInfo = objTextFile.Readline
> > > >
> > > > uP = Split(acctInfo, ",", -1, 1)
> > > >
> > > > Set colAccounts = GetObject("WinNT://" & strComputer & "")
> > > > Set objUser = colAccounts.Create("user", uP(0))
> > > > objUser.SetPassword uP(1)
> > > > objUser.SetInfo
> > > >
> > > > Set objGroup = GetObject("WinNT://" & strComputer & "/Power Users,group")
> > > > Set objUseraDD = GetObject("WinNT://" & strComputer & "/" & uP(0) & ",user")
> > > > objGroup.Add(objUseraDD.ADsPath)
> > > >
> > > >
> > > > Loop
> > > >
> > > > Next
> > > >
> > > > wscript.echo "Accounts have been created"
> > > >
> > > > wscript.quit
> > > > 'END COPY
> > > >
> > > > Hope this helps.
> > > >
> > > > Nick
> > > >
> > > >
> > > > "Goatbiker" wrote:
> > > >
> > > > > This should be easy but I am stumped.
> > > > >
> > > > > How do I deploy, or copy, 150 user names to a 23 computer workgroup so I
> > > > > don't have to make 3,450 entries? 20 computers are 2K/SP4 and three are
> > > > > XP/SP2. All are on the same workgroup.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Tom
.
- Follow-Ups:
- RE: Deploying user list to workgroup
- From: Goatbiker
- RE: Deploying user list to workgroup
- References:
- Deploying user list to workgroup
- From: Goatbiker
- RE: Deploying user list to workgroup
- From: Nick
- RE: Deploying user list to workgroup
- From: Goatbiker
- RE: Deploying user list to workgroup
- From: Nick Staff
- RE: Deploying user list to workgroup
- From: Goatbiker
- Deploying user list to workgroup
- Prev by Date: Re: Using photoedit
- Next by Date: RE: The password does not meet the password policy requirements
- Previous by thread: RE: Deploying user list to workgroup
- Next by thread: RE: Deploying user list to workgroup
- Index(es):
Relevant Pages
|