
Member

Group: .script developer
Posts: 71
Member No.: 56
Joined: 23-June 06

|
New version on 2006-JUL-12
During my experiments with some scripts I often had to decide whether the OS was XP or 2003 server.
Therefore I wrote a script retreiving this information. When it was finished I thought it may be helpful for some other scripts to have some more information. The result may be worth to be published here.
The script generates an INI file which may look like:
| QUOTE | [OS] Type="XP" SubType="Pro" SercicePack="SP2"
[Cabs] Driver=driver.cab SP_CAB=SP2.cab |
or
| QUOTE | [OS] Type="W2003" SubType="Enterprise" SercicePack="R2"
[Cabs] Driver=driver.cab SP_CAB=sp1.cab |
Here the script code:
| QUOTE | [main] Title=0 - Check Source Operating System Description=This script checks the source CD and writes information about OS and service pack into the OSInfo.ini file Selected=True Level=1 Locked=false Author=Boot Land community Version=044 Contact=http://Bootland.pt.vu Date=2006-07-11 Credits=d4vr0s for his post http://www.911cd.net/forums//index.php?sho...354entry97354
[Variables] %iniFile%= %OSType%= %OSSubType%= %OSServicePack%=NO_SP %temp%= %driverIndex%=DRVINDEX.INF %spFile%= %spFound%=0
[process] Set,"%iniFile%","%ProjectDir%\OSInfo.ini" If,ExistFile,"%iniFile%",FileDelete,"%iniFile%" If,ExistFile,"%SourceDir%\WIN51IP",Set,"%OSType%","XP" If,ExistFile,"%SourceDir%\WIN51IP.SP1",Set,"%OSType%","XP" If,ExistFile,"%SourceDir%\WIN51IP.SP2",Set,"%OSType%","XP" If,ExistFile,"%SourceDir%\WIN51IC",Set,"%OSType%","XP" If,ExistFile,"%SourceDir%\WIN51IC.SP1",Set,"%OSType%","XP" If,ExistFile,"%SourceDir%\WIN51IC.SP2",Set,"%OSType%","XP" If,ExistFile,"%SourceDir%\WIN51IL",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IL.SP1",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IL.R2",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51ID",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51ID.SP1",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51ID.R2",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IA",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IA.SP1",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IA.R2",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IS",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IS.SP1",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IS.R2",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IB",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IB.SP1",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IB.R2",Set,"%OSType%","W2003" If,ExistFile,"%SourceDir%\WIN51IP",Set,"%OSSubType%","Pro" If,ExistFile,"%SourceDir%\WIN51IP.SP1",Set,"%OSSubType%","Pro" If,ExistFile,"%SourceDir%\WIN51IP.SP2",Set,"%OSSubType%","Pro" If,ExistFile,"%SourceDir%\WIN51IC",Set,"%OSSubType%","Home" If,ExistFile,"%SourceDir%\WIN51IC.SP1",Set,"%OSSubType%","Home" If,ExistFile,"%SourceDir%\WIN51IC.SP2",Set,"%OSSubType%","Home" If,ExistFile,"%SourceDir%\WIN51IL",Set,"%OSSubType%","Small Business" If,ExistFile,"%SourceDir%\WIN51IL.SP1",Set,"%OSSubType%","Small Business" If,ExistFile,"%SourceDir%\WIN51IL.R2",Set,"%OSSubType%","Small Business" If,ExistFile,"%SourceDir%\WIN51ID",Set,"%OSSubType%","Data Center" If,ExistFile,"%SourceDir%\WIN51ID.SP1",Set,"%OSSubType%","Data Center" If,ExistFile,"%SourceDir%\WIN51ID.R2",Set,"%OSSubType%","Data Center" If,ExistFile,"%SourceDir%\WIN51IA",Set,"%OSSubType%","Enterprise" If,ExistFile,"%SourceDir%\WIN51IA.SP1",Set,"%OSSubType%","Enterprise" If,ExistFile,"%SourceDir%\WIN51IA.R2",Set,"%OSSubType%","Enterprise" If,ExistFile,"%SourceDir%\WIN51IS",Set,"%OSSubType%","Standard" If,ExistFile,"%SourceDir%\WIN51IS.SP1",Set,"%OSSubType%","Standard" If,ExistFile,"%SourceDir%\WIN51IS.R2",Set,"%OSSubType%","Standard" If,ExistFile,"%SourceDir%\WIN51IB",Set,"%OSSubType%","Web" If,ExistFile,"%SourceDir%\WIN51IB.SP1",Set,"%OSSubType%","Web" If,ExistFile,"%SourceDir%\WIN51IB.R2",Set,"%OSSubType%","Web" If,ExistFile,"%SourceDir%\WIN51IB.SP1",Set,"%OSServicePack%","SP1" If,ExistFile,"%SourceDir%\WIN51IP.SP1",Set,"%OSServicePack%","SP1" If,ExistFile,"%SourceDir%\WIN51IC.SP1",Set,"%OSServicePack%","SP1" If,ExistFile,"%SourceDir%\WIN51IL.SP1",Set,"%OSServicePack%","SP1" If,ExistFile,"%SourceDir%\WIN51ID.SP1",Set,"%OSServicePack%","SP1" If,ExistFile,"%SourceDir%\WIN51IS.SP1",Set,"%OSServicePack%","SP1" If,ExistFile,"%SourceDir%\WIN51IA.SP1",Set,"%OSServicePack%","SP1" If,ExistFile,"%SourceDir%\WIN51IP.SP2",Set,"%OSServicePack%","SP2" If,ExistFile,"%SourceDir%\WIN51IC.SP2",Set,"%OSServicePack%","SP2" If,ExistFile,"%SourceDir%\WIN52IB.R2",Set,"%OSServicePack%","R2" If,ExistFile,"%SourceDir%\WIN52IL.R2",Set,"%OSServicePack%","R2" If,ExistFile,"%SourceDir%\WIN52ID.R2",Set,"%OSServicePack%","R2" If,ExistFile,"%SourceDir%\WIN52IS.R2",Set,"%OSServicePack%","R2" If,ExistFile,"%SourceDir%\WIN52IA.R2",Set,"%OSServicePack%","R2" FileCreateBlank,"%iniFile%" IniWrite,"%iniFile%","OS","Type",%OSType% IniWrite,"%iniFile%","OS","SubType",%OSSubType% IniWrite,"%iniFile%","OS","SercicePack",%OSServicePack% IniRead,"%SourceDir%\I386\%driverIndex%","Cabs","Driver","%temp%" If,%temp%,NotEqual,"",IniWrite,"%iniFile%","Cabs","Driver","%temp%" Set,%spFile%,SP1 Run,%ScriptFile%,read-sp If,%spFound%,Equal,0,Set,%spFile%,SP2 If,%spFound%,Equal,0,Run,%ScriptFile%,read-sp If,%spFound%,Equal,0,Set,%spFile%,SP3 If,%spFound%,Equal,0,Run,%ScriptFile%,read-sp If,%spFound%,Equal,0,Set,%spFile%,SP4 If,%spFound%,Equal,0,Run,%ScriptFile%,read-sp If,%spFound%,Equal,0,Set,%spFile%,SP5 If,%spFound%,Equal,0,Run,%ScriptFile%,read-sp
[read-sp] Set,"%temp%","" IniRead,"%SourceDir%\I386\%driverIndex%","Cabs",%spFile%,"%temp%" If,%temp%,NotEqual,"",IniWrite,"%iniFile%","Cabs","SP_CAB","%temp%" If,%temp%,NotEqual,"",Set,%spFound%,1
[AuthorEncoded] authorlogo.jpg=1078,1438
[EncodedFile-AuthorEncoded-authorlogo.jpg] lines=0 0= .... too much for the Web page
|
Members can download the code at My WebpageSend me a PM to get the access codes. Peter This post has been edited by psc on Jul 12 2006, 12:31 PM
--------------------
This text contains 100% recyclable bits and bytes only!
|