Renaming computer and workgroup 
Author Message
 Renaming computer and workgroup

Hi All

I need a little help with a script I'm writing!

I'm trying to get a script to run on newly imaged laptops.  The script
will prompt the user to enter in new user names and passwords, the new
computer name and the new workgroup.  It will then apply all of these to
the new computer.

I've sorted the new user part, but can't find any info on how to rename
the existing computername and workgroup via VBScript.
(The machines are all win2k and are not in a domain)

Does anybody have any ideas?  I've included what I've done so far below.

Many thanks

Ross

'Define Variables

Dim NewUSer
Dim Password
Dim NewCompName
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("PROCESS")
Set grp = GetObject("WinNT://" +WshSysEnv("computername")+"/Power
Users,group")

' main program

wizard = Msgbox ("This is the first time this computer has been booted
up.  Do you wish to run the startup Wizard?", vbOkCancel)

IF wizard = vbCancel then  quit()

NewUser = InputBox("Please enter the account name for the user of this
laptop", "New user Wizard")
Password = InputBox("Please enter the new password for the account
name:" + NewUser, "New User Wizard")

Set obj = GetObject("WinNT://" +WshSysEnv("computername"))
Set usr = obj.Create ("user", newuser)
usr.SetPassword(Password)
usr.SetInfo
mem = grp.Add("WinNT://" +WshSysEnv("computername")+"/" & newuser
+",user")

function quit()
        Wscript.Quit
End function

*** Sent via Developersdex http://www.*-*-*.com/ ***
Don't just participate in USENET...get rewarded for it!



Sun, 25 Jul 2004 06:39:27 GMT  
 Renaming computer and workgroup
See answer in the thread "Renaming a computer and workgroup by VBScript" created
by the OP approx. one our later than this thread.

--
torgeir



Sun, 25 Jul 2004 08:21:08 GMT  
 Renaming computer and workgroup
Could you not use sysprep to prepare your machines during the mini setup
wizard to do the workgroup stuff and then run your add users script after
first logon?

Jon


Quote:

> Hi All

> I need a little help with a script I'm writing!

> I'm trying to get a script to run on newly imaged laptops.  The script
> will prompt the user to enter in new user names and passwords, the new
> computer name and the new workgroup.  It will then apply all of these to
> the new computer.

> I've sorted the new user part, but can't find any info on how to rename
> the existing computername and workgroup via vbscript.
> (The machines are all win2k and are not in a domain)

> Does anybody have any ideas?  I've included what I've done so far below.

> Many thanks

> Ross

> 'Define Variables

> Dim NewUSer
> Dim Password
> Dim NewCompName
> Set WshShell = WScript.CreateObject("WScript.Shell")
> Set WshSysEnv = WshShell.Environment("PROCESS")
> Set grp = GetObject("WinNT://" +WshSysEnv("computername")+"/Power
> Users,group")

> ' main program

> wizard = Msgbox ("This is the first time this computer has been booted
> up.  Do you wish to run the startup Wizard?", vbOkCancel)

> IF wizard = vbCancel then  quit()

> NewUser = InputBox("Please enter the account name for the user of this
> laptop", "New user Wizard")
> Password = InputBox("Please enter the new password for the account
> name:" + NewUser, "New User Wizard")

> Set obj = GetObject("WinNT://" +WshSysEnv("computername"))
> Set usr = obj.Create ("user", newuser)
> usr.SetPassword(Password)
> usr.SetInfo
> mem = grp.Add("WinNT://" +WshSysEnv("computername")+"/" & newuser
> +",user")

> function quit()
> Wscript.Quit
> End function

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Wed, 28 Jul 2004 06:09:54 GMT  
 Renaming computer and workgroup

Hi ya

Thanks for your comments.  

Our current environment requires the use of Novell Netware Client.  In
order to use sysprep we would then have to re-install the client back
over the top after we ran sysprep.

If we then wanted to make this an automated client install we would have
to provide a Novell installation answer file as well as the sysprep
file.  We have also optimized the bindings on the original image so that
IP doesnt get bound to the Novell client etc, etc.

In this particular instance we decided that faffing about with sysprep
may cause more complications than necessary.  (I wanted to provide a
"popup" style wizard to help some of the less experienced members of
staff remember to change some of the more important setting form the
image default i.e. computer name and workgroup.)  

So far I've sorted the computername bit due to some helpful hints with
the registry.  However I cannot find any reference to where the
Workgroup is stored in the OS.  I've searched everywhere, but with no
luck.

Once again thanks for your help.

Kind Regards

Ross

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Wed, 28 Jul 2004 06:33:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. WSH ideas regarding workgroup, computer renaming

2. Renaming a computer and workgroup by VBScript.

3. API calls for retrieving all the Workgroup/Domain/Computer names on the network

4. How to create local user on all computer in the Workgroup

5. Collection of local workgroup computers?

6. Changing Computer and Workgroup Names

7. How to get list of computers in workgroup (newbie)

8. HELP!What Domain/Workgroup a computer is a member of

9. Renaming Workstation Computer

10. Shuting Down after Renaming Computer ...

11. Renaming Computer

12. Rename Computer in Domain

 

 
Powered by phpBB® Forum Software