(view source code of hardware.kix as plain text)
; Check KiXtart version
$KixMajorVer = SubStr( @Kix, 1, InStr( @Kix, "." ) - 1 )
If $KixMajorVer < 4
GoTo Syntax
EndIf
; Header line for screen output
? "Hardware summary for @WKSTA:"
?
; Connect to specified computer
$objWMIService = GetObject( "winmgmts://./root/cimv2" )
; Display error number if applicable
If @ERROR
GoTo ShowError
EndIf
? "Processor(s)"
?
; Query processor properties
$colItems = $objWMIService.ExecQuery( "Select * from Win32_Processor", "WQL", 48 )
; Display error number if applicable
If @ERROR
GoTo ShowError
EndIf
; Display results
For Each $objItem in $colItems
? " Name: " + Trim( $objItem.Name )
? " Manufacturer: " + $objItem.Manufacturer
? " Description: " + $objItem.Description
? " Current Clock Speed: " + $objItem.CurrentClockSpeed + " MHz"
?
Next
? "Memory"
?
; Query number of meory banks
$colItems = $objWMIService.ExecQuery( "Select * from Win32_PhysicalMemoryArray", "WQL", 48 )
; Display error number if applicable
If @ERROR
GoTo ShowError
EndIf
; Display results
For Each $objItem In $colItems
? " Memory Banks: " + $objItem.MemoryDevices
Next
; Query memory modules properties
$cntMod = 0
$strMod = ""
$colItems = $objWMIService.ExecQuery( "Select * from Win32_PhysicalMemory", "WQL", 48 )
For Each $objItem In $colItems
$cntMod = $cntMod + 1
$strCap = ( Val( $objItem.Capacity ) + 1023 ) / ( 1024 * 1024 )
$strMod = $strMod + " + " + $strCap
Next
? " Memory Modules: " + $cntMod + " (" + SubStr( $strMod, 4 ) + " MB)"
; Query total memory
$colItems = $objWMIService.ExecQuery( "Select * from Win32_LogicalMemoryConfiguration", "WQL", 48 )
; Display error number if applicable
If @ERROR
GoTo ShowError
EndIf
; Display results
For Each $objItem In $colItems
? " Total Physical Memory: " + ( $objItem.TotalPhysicalMemory + 1023 ) / 1024 + " MB"
?
Next
? "Harddisk(s)"
?
; Query harddisk properties
$colItems = $objWMIService.ExecQuery( "Select * from Win32_DiskDrive Where SCSITargetId >= 0", "WQL", 48 )
; Display error number if applicable
If @ERROR
GoTo ShowError
EndIf
; Display results
For Each $objItem in $colItems
? " Manufacturer: " + $objItem.Manufacturer
? " Model: " + $objItem.Model
; Some trickery to enable working with large numbers
$Size = $objItem.Size
$LSize = Len( $Size )
$MSize = SubStr( $Size, 1, $LSize - 3 )
$Size = ( 524288 + $MSize ) / 1048576
? " Size: $Size GB"
?
Next
? "Video"
?
; Query video adapter properties
$colItems = $objWMIService.ExecQuery( "Select * from Win32_VideoController", , 48 )
; Display error number if applicable
If @ERROR
GoTo ShowError
EndIf
; Display results
For Each $objItem in $colItems
? " Name: " + $objItem.Name
? " Video Processor: " + $objItem.VideoProcessor
? " Adapter RAM: " + ( ( $objItem.AdapterRAM + 524288 ) / 1048576 ) + " MB"
? " Video Mode Description: " + $objItem.VideoModeDescription
?
Next
; Done
Quit 0
:ShowError
? "Error # @ERROR"
?
:Syntax
? "Hardware.kix, Version 1.10"
? "Display a basic hardware summary for the local computer"
?
? "Usage: KIX32 HARDWARE.KIX"
?
? "Written by Rob van der Woude"
? "http://www.robvanderwoude.com"
?
? "This script needs KiXtart version 4.* or later."
? "Your KiXtart version is @KIX."
?
Quit 1
page last modified: 2024-04-16; loaded in 0.0083 seconds