Jump to content
Sign in to follow this  
myspacee

Hardware info : SCIS / SATA controller

Recommended Posts

myspacee

Hello world,

start a small project to migrate windows installation to new hardware.

Need some pieces, and i think Autoit is best solution to automatize this task.

Using Autoit :

- Is possible to obtain info about hardware in general ?

- Is possible to obtain these info about SATA / SCSI controler installed/in use by my system ?

thank you for any info,

m.

Share this post


Link to post
Share on other sites
Kerros

You can pull SCSI/SATA or IDE controllers through the WMI information

SCSI/SATA

; Generated by AutoIt Scriptomatic
 
 $wbemFlagReturnImmediately = 0x10
 $wbemFlagForwardOnly = 0x20
 $colItems = ""
 $strComputer = "localhost"
 
 $Output=""
 $Output = $Output & "Computer: " & $strComputer  & @CRLF
 $Output = $Output & "==========================================" & @CRLF
 $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
 $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_SCSIController", "WQL", _
                                           $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
 
 If IsObj($colItems) then
    For $objItem In $colItems
       $Output = $Output & "Availability: " & $objItem.Availability & @CRLF
       $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
       $Output = $Output & "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF
       $Output = $Output & "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF
       $Output = $Output & "ControllerTimeouts: " & $objItem.ControllerTimeouts & @CRLF
       $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF
       $Output = $Output & "Description: " & $objItem.Description & @CRLF
       $Output = $Output & "DeviceID: " & $objItem.DeviceID & @CRLF
       $Output = $Output & "DeviceMap: " & $objItem.DeviceMap & @CRLF
       $Output = $Output & "DriverName: " & $objItem.DriverName & @CRLF
       $Output = $Output & "ErrorCleared: " & $objItem.ErrorCleared & @CRLF
       $Output = $Output & "ErrorDescription: " & $objItem.ErrorDescription & @CRLF
       $Output = $Output & "HardwareVersion: " & $objItem.HardwareVersion & @CRLF
       $Output = $Output & "Index: " & $objItem.Index & @CRLF
       $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
       $Output = $Output & "LastErrorCode: " & $objItem.LastErrorCode & @CRLF
       $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF
       $Output = $Output & "MaxDataWidth: " & $objItem.MaxDataWidth & @CRLF
       $Output = $Output & "MaxNumberControlled: " & $objItem.MaxNumberControlled & @CRLF
       $Output = $Output & "MaxTransferRate: " & $objItem.MaxTransferRate & @CRLF
       $Output = $Output & "Name: " & $objItem.Name & @CRLF
       $Output = $Output & "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF
       $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0)
       $Output = $Output & "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF
       $Output = $Output & "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF
       $Output = $Output & "ProtectionManagement: " & $objItem.ProtectionManagement & @CRLF
       $Output = $Output & "ProtocolSupported: " & $objItem.ProtocolSupported & @CRLF
       $Output = $Output & "Status: " & $objItem.Status & @CRLF
       $Output = $Output & "StatusInfo: " & $objItem.StatusInfo & @CRLF
       $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF
       $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF
       $Output = $Output & "TimeOfLastReset: " & WMIDateStringToDate($objItem.TimeOfLastReset) & @CRLF
       if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
       $Output=""
    Next
 Else
    Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_SCSIController" )
 Endif


Func WMIDateStringToDate($dtmDate)

    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc

IDE

; Generated by AutoIt Scriptomatic
 
 $wbemFlagReturnImmediately = 0x10
 $wbemFlagForwardOnly = 0x20
 $colItems = ""
 $strComputer = "localhost"
 
 $Output=""
 $Output = $Output & "Computer: " & $strComputer  & @CRLF
 $Output = $Output & "==========================================" & @CRLF
 $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
 $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_IDEController", "WQL", _
                                           $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
 
 If IsObj($colItems) then
    For $objItem In $colItems
       $Output = $Output & "Availability: " & $objItem.Availability & @CRLF
       $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
       $Output = $Output & "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF
       $Output = $Output & "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF
       $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF
       $Output = $Output & "Description: " & $objItem.Description & @CRLF
       $Output = $Output & "DeviceID: " & $objItem.DeviceID & @CRLF
       $Output = $Output & "ErrorCleared: " & $objItem.ErrorCleared & @CRLF
       $Output = $Output & "ErrorDescription: " & $objItem.ErrorDescription & @CRLF
       $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
       $Output = $Output & "LastErrorCode: " & $objItem.LastErrorCode & @CRLF
       $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF
       $Output = $Output & "MaxNumberControlled: " & $objItem.MaxNumberControlled & @CRLF
       $Output = $Output & "Name: " & $objItem.Name & @CRLF
       $Output = $Output & "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF
       $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0)
       $Output = $Output & "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF
       $Output = $Output & "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF
       $Output = $Output & "ProtocolSupported: " & $objItem.ProtocolSupported & @CRLF
       $Output = $Output & "Status: " & $objItem.Status & @CRLF
       $Output = $Output & "StatusInfo: " & $objItem.StatusInfo & @CRLF
       $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF
       $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF
       $Output = $Output & "TimeOfLastReset: " & WMIDateStringToDate($objItem.TimeOfLastReset) & @CRLF
       if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
       $Output=""
    Next
 Else
    Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_IDEController" )
 Endif
 
 
 Func WMIDateStringToDate($dtmDate)
 
     Return (StringMid($dtmDate, 5, 2) & "/" & _
     StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
     & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
 EndFunc

Edit: Fixed code tags

Edited by Kerros

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites
myspacee

Nice!

so you use WMI... use same with vbs script.

I need more information about files used by a driver...

Is possible to obtain these info ? (see picture)

Posted Image

thank you,

m.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×