VB Script to change workgroup name - Windows 7

I call from within a setup cmd file a vbs file which prompts to enter the new machine name of the PC. i would like to add within this same vbs file a prompt to change the PCs workgroup name.
The PC will not be joining a Domain.

Many thanks

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

From what you're saying you have a good grasp of VB script and using pop up boxes etc,

I think you just need to make another input box which links to a hostname string which will write into the registry. These registry locations and setup may help you

strCCS = "HKLM\SYSTEM\CurrentControlSet\"
strTcpipParamsRegPath = strCCS & "Services\Tcpip\Parameters\"
strCompNameRegPath = strCCS & "Control\Computername\"

'Delete current settings in registry and write new ones
With WSH  
.RegDelete strTcpipParamsRegPath & "Hostname"  
.RegDelete strTcpipParamsRegPath & "NV Hostname"  
.RegWrite strCompNameRegPath & "Computername\Computername", strComputername  
.RegWrite strCompNameRegPath & "ActiveComputername\Computername", strComputername  
.RegWrite strTcpipParamsRegPath & "Hostname", strComputername  
.RegWrite strTcpipParamsRegPath & "NV Hostname", strComputername
End With   ' WSH
WSH.RegWrite "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AltDefaultDomainName", strComputername
WSH.RegWrite "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName", strComputername
WSH.RegWrite "HKCU\Software\Microsoft\Windows\ShellNoRoam\", strComputername

This should give you all the little scriptlets that you need to write the workgroup in from the input box, as long as you add your own script in for the input box etc. modify the StrComputername to whatever you need it to be obviously.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
oh, wait.

you'll need to use Netdom to finish off from what i'm seeing.

'Get user input
strWorkgroup = InputBox("Enter the name to use as the Workgroup, e.g SS38COL")
strWorkgroup = UCase(strWorkgroup) 'Force capitalization
WSH.Popup "Please wait.",2, strTitle 'Inform user
'Use Win2k resource kit utility to make change
WSH.Run "NETDOM.EXE  MEMBER \\" & strComputername & " /JOINWorkgroup " & strWorkgroup, 0, True
WSH.Popup "OK... Done!",2, strTitle 'Inform user
Rick_PenneyAuthor Commented:
Wow, that was quick
Nice one, many thanks for your help
Kind Regards
Rick_PenneyAuthor Commented:
thanks for the additional info
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.