QUOTE (kobo3 @ May 5 2008, 08:04 AM)

Hello,
I searched the complete Internet without success ... :-( ....
I'am looking for a way to get the computer name (with my HTA Sycript) from the Active Directory. The GUID (Computers Unique ID) is maintained for each computer in the Active Directory.
Or is there any other way to get the Computername with a script from the Registry File of the old System (C:\WINDOWS\System32\Config\System)?
I'am trying to make a full automated Sysprep Installation of Windows XP ....
Thanks,
Kobo3
It's going to be a pain in the a** to get the computer name from the registry, because you'd have to mount the hives sitting in system32\config and then be able to edit them automatically somehow. It'd be a lot easier to create a GPO that runs on every computer that simply calls this batch file:
@echo off
echo %computername% > c:\windows\computername.txt
That way, in your startnet.cmd you can do something like...
set /p oldpcname=>c:\windows\computername.txt
So, you hang onto that variable and image the machine... Then once it's imaged, you inject that into your sysprep.inf.
I haven't found a good find and replace tool that works in WinPE 2.1 yet...so you could copy the sysprep.inf to the PE image, sans the ComputerName= portion, have another text file called sysprep1.txt that had this:
[UserData]
ComputerName =
Then you could echo %oldpcname% > whatever.txt and mash them together with copy /b whatever.txt + sysprep1.txt + sysprep.inf c:\sysprep\sysprep.inf
It's a Charlie Foxtrot way to go about it, but it got the job done for me...