Windows Thread, Rename a PC from a batch file - Any ideas? in Technical; Hi,
I want to write a couple of batch files that will be run automatically after a PC has been ...
-
22nd November 2007, 04:43 PM #1
- Rep Power
- 0
Rename a PC from a batch file - Any ideas?
Hi,
I want to write a couple of batch files that will be run automatically after a PC has been imaged using ghost. I want the batch files to rename the PC, restart it and then join it to a domain.
Getting the PC to auto login and run a batch file is easy enough, but how do I rename it or add it to the domain?
I know the netdom utility from one of the MS Resource Kits can do the domain join, but it seems as though the rename only works on PCs already joined to a domain. I need a way of doing it for PC's that aren’t yet on a domain.
Thanks
-
-
IDG Tech News
-
22nd November 2007, 04:50 PM #2 Re: Rename a PC from a batch file - Any ideas?
Why not use sysprep before you ghost the machines? http://support.microsoft.com/kb/302577
What version of ghost are you using?
-
-
22nd November 2007, 04:56 PM #3 Re: Rename a PC from a batch file - Any ideas?
Yeh you need to sysprep before taking an image otherwise you'lll have lots of issues including SID and HAL issues.
Erm, google is your friend ubt I use the following sysprep commands:
sysprep -bmsd
followed by
sysprep -clean
then
sysprep -quiet -mini -reseal
MY sysprep file will add the computer to the domain but I still rename them when they've finished first boot as I've not configured any autonaming yet and I just get names like 'school-123486'
-
-
22nd November 2007, 05:04 PM #4 Re: Rename a PC from a batch file - Any ideas?

Originally Posted by
mrforgetful MY sysprep file will add the computer to the domain but I still rename them when they've finished first boot as I've not configured any autonaming yet and I just get names like 'school-123486'
If you go for the solution suite, it is brilliant for sysprepping. Once it has a configuration stored for a PC, reimaging is as simple as clicking Execute. The machine then names as it should be etc...
-
-
22nd November 2007, 05:07 PM #5 Re: Rename a PC from a batch file - Any ideas?
To change the name, all that is needed in the batch file is a line to insert a reg file and the use of reg frag file to change the key with the computer name.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\ComputerName\ActiveComputerName]
"ComputerName"="THE-NAME-FOR-YOUR-COMP"
-
-
22nd November 2007, 05:39 PM #6
- Rep Power
- 0
Re: Rename a PC from a batch file - Any ideas?
I'm using Ghost (and GhostCast server) v8.
We avoid the HAL issue by having separate images for each model of PC, and NewSID from SysInternals gets around cloned SIDs.
After a sysprep'ed ghost image is cloned onto a new PC, does Windows do a mini-setup the same way it does after installation via RIS?
Also, would prestaging work in this situation?
I setup most of our PCs via RIS, but one room of nForce based machines refuse to work with RIS no matter what I do, so these are still done using GhostCasting. I wanted to achieve the same prestaging and domain join you get with RIS, but for the ghosted PCs, if that makes sense.
Thanks
-
-
22nd November 2007, 06:06 PM #7 Re: Rename a PC from a batch file - Any ideas?

Originally Posted by
MrLudwig I'm using Ghost (and GhostCast server) v8.
We avoid the HAL issue by having separate images for each model of PC, and NewSID from SysInternals gets around cloned SIDs.
After a sysprep'ed ghost image is cloned onto a new PC, does Windows do a mini-setup the same way it does after installation via
RIS?
Yes - but you can automate all of it except the naming part (unless you use ghost solution suite, then it'll handle that too).
Also, would prestaging work in this situation?
I setup most of our PCs via
RIS, but one room of nForce based machines refuse to work with
RIS no matter what I do, so these are still done using GhostCasting. I wanted to achieve the same prestaging and domain join you get with
RIS, but for the ghosted PCs, if that makes sense.
I don't know that one - wouldn't see why you'd want to use RIS if you used Ghost...
-
-
23rd November 2007, 09:26 AM #8 Re: Rename a PC from a batch file - Any ideas?
Also Sysprep itself gets the SID sorted so why do you need other software for that?
*remembers back to the day of Windows 98 and having to run Ghostwalker on every PC*
-
-
23rd November 2007, 02:40 PM #9 Re: Rename a PC from a batch file - Any ideas?
You can use the 'netdom' command to do this.
-
-
23rd November 2007, 05:39 PM #10
- Rep Power
- 0
Re: Rename a PC from a batch file - Any ideas?
You can use the 'netdom' command to do this.
How?
I can get netdom to join a machine to a domain, but I need a way to rename it first. When I try using netdoms /renamecomputer switch, it fails saying the machine is not joined to a domain.
Can netdom only rename machines already joined to a domain? Surely it makes more sense to rename a machine, then join it to the domain? :?
Thanks
-
-
24th November 2007, 10:01 PM #11
- Rep Power
- 12
Re: Rename a PC from a batch file - Any ideas?
I used to Ghost with my own AutoIT file in steps.
Step 1 - Add auto logon info to run the other autoit files in c:\autoit\autoit3.exe step2.au3 etc etc
Step 2 - Used autoit to prompt for a computer name which u type in then it executed newsid.exe /a [computernameVariable] and add new autorun info into registry and remove the old autorun info. (reboot automatically)
Step 3 - Obviously removes the old autorun and autologin info and uses netdom to join the domain and put pc in correct OU.
I've used this on serveral ghost setups. Works 90% of the time but its a massive time saver when you've got 30-60 workstations to do. I just modify the au3 files from time to time and dump it onto the next machine for ghosting.
-
-
25th November 2007, 10:14 PM #12 Re: Rename a PC from a batch file - Any ideas?
Can netdom only rename machines already joined to a domain?
I think that's correct, although the next version of netdom (for W2K8) definitely will rename a non-domain machine.
-
-
27th November 2007, 02:59 PM #13
- Rep Power
- 0
Re: Rename a PC from a batch file - Any ideas?
Thanks everyone.
techyphil:
Your method sounds exactly like what I was trying to achieve, although I hadn't thought of using AutoIT. That's a stroke of genius! :idea:
Thanks again.
-
-
8th December 2007, 03:40 AM #14 Re: Rename a PC from a batch file - Any ideas?
there's a command line utility to name/rename machines 'off domain' here
see /? for instructions
-
SHARE:
Similar Threads
-
By Kyle in forum How do you do....it?
Replies: 10
Last Post: 19th November 2009, 07:31 AM
-
By Halfmad in forum Scripts
Replies: 12
Last Post: 6th November 2007, 10:25 PM
-
By macca in forum Windows
Replies: 5
Last Post: 3rd May 2007, 09:20 AM
-
By tosca925 in forum Scripts
Replies: 4
Last Post: 23rd March 2006, 07:27 AM
-
By beeswax in forum Scripts
Replies: 9
Last Post: 3rd March 2006, 08:48 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules