Because of some issue between Windows XP and a HP 6000 Pro system, i needed to rollout a script to ~10000 clients that detected the type of system and change the boot.ini accordingly.
Microsoft’s article on this “bug”.
' Quick'n Dirty HP 6000 Pro boot.ini (/usepmtimer) changer (c) Hugo
On Error Resume Next
Set objFSO = CreateObject("Scripting.FilesystemObject")
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set WSHProcessEnvironment = objShell.Environment("Process")
strComputerName = "."
strWinMgt = "winmgmts://" & strComputerName &""
Set ComputerSystemSet = GetObject(strWinMgt).ExecQuery("select * from Win32_ComputerSystem")
For Each objComputerSystem In ComputerSystemSet
strComputerSystem_Model = objComputerSystem.Model
strComputerSystem_Description = objComputerSystem.Description
Next
WScript.Echo " Found: " + strComputerSystem_Model
' Learned so far:
' - "HP Compaq 6000 Pro MT PC"
' - "HP Compaq 6000 Pro SFF PC"
' - "HP Compaq 6000 Small Form Factor"
' - ..
Select Case strComputerSystem_Model
Case "HP Compaq 6000 Pro MT PC"
boot_ini_aanpassen()
Case "HP Compaq 6000 Pro SFF PC"
boot_ini_aanpassen()
Case "HP Compaq 6000 Small Form Factor"
boot_ini_aanpassen()
Case "blablabla pro 6000 type 4 that will be found some day or the next"
boot_ini_aanpassen()
Case Else
WScript.Echo " No Pro 6000 detected, exit ..."
End Select
'#########################################################################
' support function(s)
'#########################################################################
Function boot_ini_aanpassen()
WScript.Echo " Match found, now change boot.ini"
' make the file accessable
objShell.Run "c:\windows\system32\attrib.exe -h -a -r -s c:\boot.ini"
' sleep for a while because it needs time to process the attribute change (10 sec will do for sure)
WScript.Sleep(10000)
' define new boot.ini layout
strMyBootIni_line1 = "[boot loader]"
strMyBootIni_line2 = "timeout=30"
strMyBootIni_line3 = "default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS"
strMyBootIni_line4 = "[operating systems]"
strMyBootIni_line5 = "multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=""Microsoft Windows XP Professional"" /fastdetect /usepmtimer"
Const WriteMode = 2 '2 = ForWrite, 8 = ForAppend
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile ("c:\boot.ini", WriteMode, True)
objTextFile.WriteLine(strMyBootIni_line1)
objTextFile.WriteLine(strMyBootIni_line2)
objTextFile.WriteLine(strMyBootIni_line3)
objTextFile.WriteLine(strMyBootIni_line4)
objTextFile.WriteLine(strMyBootIni_line5)
objTextFile.Close
' re-attribute the file
objShell.Run "c:\windows\system32\attrib.exe +h +a +r +s c:\boot.ini"
WScript.Echo " Boot.ini changed. Active after next reboot"
End Function