Jump to content

Change HAL sysprep mini-setup.


mbkowns
 Share

Recommended Posts

I needed some code that would get the serial number and model during the sysprep mini-setup. I usually just use WMI but it didn't work during this time. I have to change the HAL on systems during this period because after it finished mini-setup it won't boot if the wrong HAL is used.

I use cpuz from the link below. When I run it I use a command line switch to output its contents to a txt file. I then use autoit to parse this file for what I want. After this you run the script below and If you display $Serial[2] or $Model[2] you will get the model and the serial without spaces.

http://www.cpuid.com/cpuz.php

From this I compiled a list of the models for the different systems and what HAL they use. I don't have this code included but the basic part of getting the model and serial was hard to do during sysprep mini-setup without WMI since everything for it isn't loaded yet. Based on the model and my list that goes with the different hals I have the script modify the boot.ini to include the different hal. I have all the HALs copied to my system32 directory so that I am able to point the different boot.ini's

I haven't seen anyone with a better solution then this. Some of you are lucky that you have a few like hals that can work good together and sysprep does automatically but my in my settings I have so many and I don't want to manage all those images.

CMDLINES.txt

"CPUZ.exe -txt=c:\systeminfo"

"AutoitScript.exe"

#include <Array.au3>
#include <file.au3>
Dim $aRecords
If Not _FileReadToArray("c:\system2.txt",$aRecords) Then
;~ If Not _FileReadToArray("c:\systemlog.txt.txt",$aRecords) Then

   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf

$Serial_Search = _ArraySearch($aRecords, "  serial      " , 0, 0, 0, 1)
$Model_Search = _ArraySearch($aRecords, "   product     " , 0, 0, 0, 1)

If @error Then
    MsgBox(0, "Info", "The Serial and Model was not found!")
    Exit
Else
;~  MsgBox(0, "Info", "Serial and Model was Found!" )
EndIf


$Serial_NOSPC = StringStripWS ($aRecords[$Serial_Search], 8)
$Model_NOSPC = StringStripWS ($aRecords[$Model_Search], 8)
$Serial = StringSplit($Model_NOSPC, "product", 1)
$Model = StringSplit($Serial_NOSPC, "serial", 1)

;USE BELOW TO DO SOMETHING
MsgBox(4096, "", $Serial[2])
MsgBox(4096, "", $Model[2])

[boot loader]
timeout=0
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Pro (Last Configuration)"                                     /noexecute=optin /fastdetect /HAL=hal.dll /KERNEL=ntoskrnl.exe
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Pro (ACPI Multiprocessor PC) for multi-core, hyperthreading"   /noexecute=optin /fastdetect /HAL=H-AMPS.DLL /KERNEL=H-AMPS.exe
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Pro (ACPI Uniprocessor PC) for single-core, no hyperthreading" /noexecute=optin /fastdetect /HAL=H-AUNI.DLL /KERNEL=H-AUNI.exe
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Pro (ACPI PC) for most compatability on ACPI computers"     /noexecute=optin /fastdetect /HAL=H-ACPI.DLL /KERNEL=H-ACPI.exe
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Pro (MPS Multiprocessor PC) for multi-core Xeons"             /noexecute=optin /fastdetect /HAL=H-MPSM.DLL /KERNEL=H-MPSM.exe
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Pro (MPS Uniprocessor PC) for single-core Xeons"               /noexecute=optin /fastdetect /HAL=H-MPSU.DLL /KERNEL=H-MPSU.exe
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="XP Pro (Standard PC) for old non-ACPI computers"                 /noexecute=optin /fastdetect /HAL=H-STD.DLL  /KERNEL=H-STD.exe
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...