Jump to content

computername change


Recommended Posts

Hello,

Can anyone provide me a script to change the computername?

my setup is:

after the unattended install, we run a script to localize the PC settings according to the user's location and install the appropriate apps. The first step would be to change the computername to the standard naming convention used depending on the user's location.

The unattended setup is set to initially assign a random computername on winnt.sif. After windows installation is complete and during the first logon, I need a script to run and prompt the user for location and based from this change the computername.

The reason why we are doing this is so we can distribute unattended cds to remote users and all they have to do is plug the cd in. As soon as setup is finished, the user logs in and prompted for their office location. That's the only prompt we want to ask the user, the rest done automatically.

Thanks... :whistle:

Link to comment
Share on other sites


Or you can try this vbscript

Dim pc, pcU, value1, value2, title, ws
Set ws = WScript.CreateObject("WScript.Shell")

value1 = "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\"
value2 = "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ParameterS\"
title = "Windows XP Professional - Unattended Setup"

'--------------------------------Change ComputerName in Registry-------------------------------------
pc = InputBox("Enter New Computername.", title)
pcU= UCase(pc)
If pc <> "" Then
 ws.RegWrite value1 & "ComputerName", pcU
 ws.RegWrite value2 & "NV Hostname", pcU
End If

Link to comment
Share on other sites

I'd change one thing, put a loop around the inputbox so that they have to enter a name before it will continue as changed here.

Dim pc, pcU, value1, value2, title, ws
Set ws = WScript.CreateObject("WScript.Shell")

value1 = "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\"
value2 = "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ParameterS\"
title = "Windows XP Professional - Unattended Setup"

'--------------------------------Change ComputerName in Registry-------------------------------------
do
   pc = InputBox("Enter New Computername.", title)
   pcU= UCase(pc)
loop while pc=""

If pc <> "" Then
ws.RegWrite value1 & "ComputerName", pcU
ws.RegWrite value2 & "NV Hostname", pcU
End If

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...