Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How can i change the computer's name and workgroup in a batch file?

Posted on 2009-04-02
6
Medium Priority
?
1,353 Views
Last Modified: 2012-05-06
I am writing a batch file to automate some simple task on install and I can't find anything to change the computer name or workgroup on the local system just ones to change them in a domain which we are not using. Any help would be great Oh and setting the DNS suffixes would be a great help too.
0
Comment
Question by:glenwdri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 21

Expert Comment

by:AmazingTech
ID: 24053286
Not too sure how to change the workgroup name at the moment.

You'll need to reboot for this to take effect.
:ChangeComputerName
 
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v "ComputerName" /t REG_SZ /f /d "NewName"
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters" /v "NV Hostname" /t REG_SZ /f /d "NewName"
 
 
:DNS SerachList
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters" /v "SearchList" /t REG_SZ /f /d "Domain.com,Domain2.com"

Open in new window

0
 

Author Comment

by:glenwdri
ID: 24053295
I need to does this without the windows domain controller or anything involving the windows domain.
0
Looking for the Wi-Fi vendor that's right for you?

We know how difficult it can be to evaluate Wi-Fi vendors, so we created this helpful Wi-Fi Buyer's Guide to help you find the Wi-Fi vendor that's right for your business! Download the guide and get started on our checklist today!

 

Author Comment

by:glenwdri
ID: 24053329
AmaizingTech
Can I use 127.0.0.1 for the old computer name or is this something I leave and only set the "new name" part to what I want the name to be?
0
 
LVL 21

Accepted Solution

by:
AmazingTech earned 1000 total points
ID: 24054269
Just change the 2 occurances of NewName

Or we can set a variable so you only need to so it once.

Not sure what you're going to use 127.0.0.1 for this needs to be run on the workstation.
Set NewName=Computer1
 
:ChangeComputerName
 
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v "ComputerName" /t REG_SZ /f /d "%NewName%"
REG ADD "HKLM\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters" /v "NV Hostname" /t REG_SZ /f /d "%NewName%"

Open in new window

0
 

Author Comment

by:glenwdri
ID: 24054738
I figured that out. Thanks
Now all i need to the workgroup setting
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
There have been a lot of times when we have seen the need to enter a large number of DNS entries in a forward lookup zone. The standard procedure would be to launch the DNS Manager console, create the Zone and start adding new hosts using the New…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question