Topic: hi. my script has error in sysprep. any expert guy knows script?

------------------------

' CheckForIntel.vbs
' Checks if the processor is an Intel and re-enables the power managment driver if it is.
' Written by Ryan D - based off the WMI sample script by Guy Thomas http://computerperformance.co.uk/
'
' ===Version History===
' 1.0 - Initial release
' 1.1 - Changed the way that the script checks for Intel machines. Now it looks at the CPU type and looks
'         to see if the string "GenuineIntel" is present.
' --------------------------------------------------------------'
option explicit
const HKEY_LOCAL_MACHINE = &H80000002
dim objWMIService, objItem, colItems, strComputer, compModel, strKeyPath, strValueName, strValue, oReg

strKeyPath = "SYSTEM\ControlSet001\Services\intelppm"
strValueName = "Start"
strValue = "1"
strComputer = "."

' WMI connection to Root CIM and get the computer type
set objWMIService = GetObject("winmgmts:\\" _
& strComputer & "\root\cimv2")
set colItems = objWMIService.ExecQuery(_
"Select Manufacturer from Win32_Processor")

'Loop through the results and store the type in compModel
for each objItem in colItems
compModel = objItem.Manufacturer
next

'Get a registry object
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")



'Check the computer type. If the processor is an Intel, then re-enable the driver
if compModel = "GenuineIntel" then
    oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
else
   
end if

wmic cpu get Manufacturer | findstr /i intel
if "%errorlevel%" == "0" (sc config intelppm start= system)

' Exit
WSCript.Quit
-----------------------------------------------------
ok
first, i ran a script to disable intelppm and it said "invalid key name". so the key isn't existed in my registry

echo Enabling image for AMD and Intel processors
reg add "HKLM\SYSTEM\ControlSet001\Services\intelppm" /v Start /t REG_DWORD /d 4 /f

so, the above command isn't working. So i worry about intelppm. then i run this before i sysprep it:

sc config intelppm start= disabled

This will disable intelppm.

Then i used above script and add these 2 lines:
wmic cpu get Manufacturer | findstr /i intel
if "%errorlevel%" == "0" (sc config intelppm start= system)

basically these 2 lines are doing the same. i add it because i use "sc config intelppm start= disabled"

so after i deploy the image and run the script, it said error in end of file.
i think those 2 lines cause errors. anyone know how to fix the 2 lines.
I found those 2 lines from other site and it is used to disable the intelppm.

The error message is "expected end of statement"
Please help me correct the last 2 lines. does it needs endif?

Last edited by roadorange (2010-12-21 16:33:28)

Re: hi. my script has error in sysprep. any expert guy knows script?

another problem:
@echo off

:DRIVER_HAL_UPDATE
SET HAL=

IF %NUMBER_OF_PROCESSORS%==1 (
devcon.exe /find @ROOT\ACPI_HAL000 | find /i "Multiprocessor" > NUL && SET HAL=ACPIAPIC_UP
devcon.exe /find @ROOT\PCI_HAL000 | find /i "Multiprocessor" > NUL && SET HAL=MPS_UP
) ELSE (
devcon.exe /find @ROOT\ACPI_HAL000 | find /i "Uniprocessor" > NUL && SET HAL=ACPIAPIC_MP
devcon.exe /find @ROOT\PCI_HAL000 | find /i "Uniprocessor" > NUL && SET HAL=MPS_MP
)

IF NOT "%HAL%"=="" (
ECHO.
ECHO ----------------------------------------
ECHO Installing %HAL% HAL
ECHO ----------------------------------------
ECHO.

devcon.exe sethwid @ROOT\PCI_HAL000 := !E_ISA_UP !ACPIPIC_UP !ACPIAPIC_UP !ACPIAPIC_MP !MPS_UP !MPS_MP !SGI_MPS_MP !SYSPRO_MP !SGI_MPS_MP
devcon.exe sethwid @ROOT\ACPI_HAL000 := !E_ISA_UP !ACPIPIC_UP !ACPIAPIC_UP !ACPIAPIC_MP !MPS_UP !MPS_MP !SGI_MPS_MP !SYSPRO_MP !SGI_MPS_MP
devcon.exe sethwid @ROOT\PCI_HAL000 := +%HAL%
devcon.exe sethwid @ROOT\ACPI_HAL000 := +%HAL%
devcon.exe update %windir%\inf\hal.inf %HAL%
devcon.exe ReScan

ECHO.
ECHO ----------------------------------------
ECHO Rebooting
ECHO ----------------------------------------
ECHO.
devcon.exe Reboot
) ELSE (
ECHO.
ECHO ----------------------------------------
ECHO Correct HAL Detected
ECHO ----------------------------------------
ECHO.
)
GOTO :EOF


This batch file doesn't update my AMD Turion 64 X2 CPU
I made the sysprep with intel single core CPU and i use ACPI PC
I even run the command after reboot couple time and still doesn't update the HAL. it should be dual cores.
i failed.

C:\tools\deleteThis>dir
Volume in drive C has no label.
Volume Serial Number is 789B-B5B4

Directory of C:\tools\deleteThis

12/21/2010 12:36 AM <DIR> .
12/21/2010 12:36 AM <DIR> ..
11/14/2002 10:32 PM 55,808 devcon.exe
12/18/2010 11:31 PM 1,348 Hal_Update.bat
2 File(s) 57,156 bytes
2 Dir(s) 110,912,729,088 bytes free

C:\tools\deleteThis>Hal_Update.bat

----------------------------------------
Correct HAL Detected
----------------------------------------

Last edited by roadorange (2010-12-21 18:58:00)