#76810 - 2005-01-21 02:49 AM
Re: How to Determine System Type - ie Laptop
|
ClientMaster
Fresh Scripter
Registered: 2005-01-19
Posts: 46
Loc: Tokyo, Japan
|
Well, I have been able to answer my own question. If anyone has any ideas on how to make it easier, they would be appreciated.
DIM $Set1, $Set2, $CaseType, $SystemType,$SerialNumb,$Mfg,$PCMAKER,$PCTYPE,$PCNAME $Set1=SetOption('Explicit','ON') $Set2=SetOption('NoVarsInStrings','ON')
$CaseType=WMIQuery('ChassisTypes','Win32_SystemEnclosure')[0] $SerialNumb=WMIQuery('SerialNumber','Win32_BIOS')[0] $Mfg=WMIQuery('Manufacturer','Win32_SystemEnclosure')[0]
SELECT CASE $CaseType = 1 $SystemType = 'Other' CASE $CaseType = 2 $SystemType = 'Unknown' CASE $CaseType = 3 $SystemType = 'Dekstop' CASE $CaseType = 4 $SystemType = 'Low Profile Desktop' CASE $CaseType = 5 $SystemType = 'Pizza Box' CASE $CaseType = 6 $SystemType = 'Mini Tower' CASE $CaseType = 7 $SystemType = 'Tower' CASE $CaseType = 8 $SystemType = 'Portable' CASE $CaseType = 9 $SystemType = 'Laptop' CASE $CaseType = 10 $SystemType = 'Notebook' CASE $CaseType = 11 $SystemType = 'Hand Held' CASE $CaseType = 12 $SystemType = 'Docking Station' CASE $CaseType = 13 $SystemType = 'All in One' CASE $CaseType = 14 $SystemType = 'Sub Notebook' CASE $CaseType = 15 $SystemType = 'Space-Saving' CASE $CaseType = 16 $SystemType = 'Lunch Box' CASE $CaseType = 17 $SystemType = 'Main System Chassis' CASE $CaseType = 18 $SystemType = 'Expansion Chassis' CASE $CaseType = 19 $SystemType = 'SubChassis' CASE $CaseType = 20 $SystemType = 'Bus Expansion Chassis' CASE $CaseType = 21 $SystemType = 'Peripheral Chassis' CASE $CaseType = 22 $SystemType = 'Storage Chassis' CASE $CaseType = 23 $SystemType = 'Rack Mount Chassis' CASE $CaseType = 24 $SystemType = 'Sealed-Case PC' ENDSELECT
IF $MFG = "IBM" $PCMAKER = "I" ENDIF IF $SystemType = "Low Profile Desktop" $PCTYPE = "D" ENDIF
$PCNAME = +$PCMAKER+$PCTYPE+$SerialNumb ? 'PCName: '+$PCNAME
FUNCTION WMIQuery($sWhat, $sFrom, Optional $sComputer, Optional $sWhere, Optional $x, Optional $root) Dim $sQuery, $objEnum, $sValue, $sItem, $TMP, $SystemSet, $, $objInstance If Not $sComputer $sComputer="." EndIf if instr($sComputer,'\') $sComputer=right($sComputer,instrrev($sComputer,'\')) Endif if not $root $root="\root\cimv2" Endif $sQuery = "Select " + $sWhat + " From "+ $sFrom If $sWhere AND $x $sQuery = $sQuery+" Where "+$sWhere+" = '"+$x+"'" EndIf $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"+$sComputer+$root) If @ERROR Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf $objEnum = $SystemSet.ExecQuery($sQuery) If @ERROR Exit VAL("&"+Right(DecToHex(@ERROR),4)) EndIf For Each $objInstance in $objEnum If $objInstance $=Execute("$"+"sValue = $"+"objInstance."+$sWhat) if VarType($sValue) & 8192 For Each $sItem in $sValue $tmp=$tmp+'|'+Trim($sItem) Next else $tmp=$tmp+'|'+Trim($svalue) Endif EndIf Next $WMIQuery = split(substr($tmp,2),'|') Exit VAL("&"+Right(DecToHex(@ERROR),4)) ENDFUNCTION
_________________________
How can you know good, unless you experience bad.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1471 anonymous users online.
|
|
|