IPB

Google Frontpage Forums Unattended CD/DVD Guide
 Forum Rules Unattended CD/DVD Guide Homepage · MSFN Forum Rules
 
Reply to this topicStart new topic
> ComputerName over GUID
kobo3
post May 5 2008, 08:04 AM
Post #1





Group: Members
Posts: 2
Joined: 18-April 08
Member No.: 187443
OS: none
Country Flag


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
Go to the top of the page
 
+Quote Post
painbreak
post May 5 2008, 02:23 PM
Post #2





Group: Members
Posts: 8
Joined: 6-June 05
Member No.: 59290
Country Flag


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...
Go to the top of the page
 
+Quote Post
Jazkal
post May 6 2008, 10:05 AM
Post #3


Senior Member
****

Group: Members
Posts: 533
Joined: 16-January 04
From: Texas
Member No.: 12605
Country Flag


QUOTE (painbreak @ May 5 2008, 03:23 PM) *
I haven't found a good find and replace tool that works in WinPE 2.1 yet...


FYI:

The AutoIt3 scripting language is easy to use and has great built in functions to do search and replace. I use it exactly for what you are describing here. The scripts can be compiled into native x86 or x64 EXE files, so they will work in any WinPE environment.



EDIT:

I put this Autoit script togeather to show you how you can load the hive, grab the computername, and edit your sysprep.inf file with the wanted computername. Of course there would be a number of steps between these, just showing you how it can be done.

CODE
#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=C:\Program Files\AutoIt3\Icons\filetype2.ico
#AutoIt3Wrapper_outfile=.\GrabComputerName.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Comment=Grab Computer Name
#AutoIt3Wrapper_Res_Description=Grab Computer Name
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=© 2008
#AutoIt3Wrapper_Res_Language=1033
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
AutoIt Version:     3.2.10.0
Author:             Jazkal
Date:                05/06/2008
Script Function:    Grab Computer Name
#ce ----------------------------------------------------------------------------

RunWait(@ComSpec&" /c reg load HKLM\PE-SYS C:\Windows\system32\config\system", "", @SW_HIDE)
Sleep(500)

$thisComputersName = RegRead("HKLM\PE-SYS\ControlSet001\Control\ComputerName\ComputerName", "ComputerName")

RunWait(@ComSpec&" /c reg unload HKLM\PE-SYS", "", @SW_HIDE)

IniWrite("C:\Sysprep\sysprep.inf", "UserData", "ComputerName", $thisComputersName)


This post has been edited by Jazkal: May 6 2008, 10:19 AM
Go to the top of the page
 
+Quote Post
kobo3
post May 6 2008, 10:57 AM
Post #4





Group: Members
Posts: 2
Joined: 18-April 08
Member No.: 187443
OS: none
Country Flag


Hey,

cool Great

that seems to be something what I'am looking for... So I will compile a .exe which is creating me textfile with the computername ...
I already created a hta file with a GUI for the other deploying stuff .....

But if there is anybody who knows a way to query the Computername with the UUID from the AD, I'am also interested in.... :-)


Thanks for all your Help!


kobo3
Go to the top of the page
 
+Quote Post

Google Frontpage Forums Unattended CD/DVD Guide

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 8th January 2009 - 11:53 PM
All trademarks mentioned on this page are the property of their respective owners
MSFN is not affiliated with Microsoft
Copyright © 2001-2008 msfn.org
Privacy Policy