Jump to content

Can AutoIT get hardware infomation ?


Recommended Posts

Yes it can but you should ask these questions in the SUPPORT FORUM !!

#Include <Constants.au3>

Dim $strComputer, $objWMIService
Const $wbemFlagReturnImmediately = 0x10
Const $wbemFlagForwardOnly = 0x20

$strComputer = inputbox( "Please enter the name of the computer you want", "Input","localhost")
$objWMIService = ObjGet("winmgmts:{(RemoteShutdown)}//" & $strComputer & "\root\CIMV2")

_Read_BioS()
_Read_CPU()
_Read_OS()
_Read_OS_Inst()
_Read_DriveInfo()

Func _Read_BioS()
Local $colItems = ""
  $colItems = $objWMIService.ExecQuery("Select * from Win32_BIOS")
   
   For $objItem in $colItems
     Local $item = $objItem.SerialNumber
        MsgBox(0,'Output','Bios Serial #: ' & $Item)    
   Next
EndFunc

Func _Read_CPU()
Local $colItems = ""
  $colItems = $objWMIService.ExecQuery("Select * from Win32_Processor")
   
   For $objItem in $colItems
     Local $item = $objItem.Name
        MsgBox(0,'Output','CPU Type: ' & $Item) 
   Next
EndFunc

Func _Read_OS()
Local $colItems = ""
  $colItems = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
   
   For $objItem in $colItems
     Local $item = $objItem.SerialNumber
        MsgBox(0,'Output','OS Serial #: ' & $Item)  
   Next
EndFunc

Func _Read_OS_Inst()
Local $colItems = ""
  $colItems = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
   
   For $objItem in $colItems
     Local $date = $objItem.InstallDate
            
    $CDate = (StringMid($Date, 5, 2) & "/" & _
        StringMid($Date, 7, 2) & "/" & StringLeft($Date, 4) _
            & " " & StringMid ($Date, 9, 2) & ":" & _
                StringMid($Date, 11, 2) & ":" & StringMid($Date, _
                    13, 2))
    MsgBox(0,'Output','Install Date/Time #: ' & $CDate)
    Next
EndFunc

Func _Read_DriveInfo()
    Local $colItems = ""
    $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_DiskDrive", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    For $objItem in $colItems
     Local $item = $objItem.Model
        MsgBox(0,'Output','Drive Model : ' & $Item)
        Local $item = $objItem.Signature
        MsgBox(0,'Output','Drive Signature : ' & $Item)
     Next
EndFunc

Enjoy !!

Link to comment
Share on other sites

Yes and please see my signature for a set of UDF's that should get you most of the information you are wanting. I will be working on more hardware features soon.

Thanks,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Could be for inventory, at an old intership I had we had to write down the serial #'s for every part that wasnt original to a computer. I tired to pull the serial off 100 cdrw's we installed (with wmi), but though the property was there they never filled it in.

(Long day writing down alphanumeric strings.

Link to comment
Share on other sites

Puff... First v3 Script and Scraps is been full of questions, and now Developers. I think somewhere needs to be a sticky with title "READ ME FIRST" and description "Do not post questions here, post them in Support!".

Can someone make it?

i542

I can do signature me.

Link to comment
Share on other sites

Could be for inventory, at an old intership I had we had to write down the serial #'s for every part that wasnt original to a computer. I tired to pull the serial off 100 cdrw's we installed (with wmi), but though the property was there they never filled it in.

(Long day writing down alphanumeric strings.

You can run down to the corner store and buy some striped paint to mark the units with their serial numbers. It goes well with the large packet of mounting holes for the drives.

You aren't pulling our collective legs, are you? :whistle:

Link to comment
Share on other sites

You can run down to the corner store and buy some striped paint to mark the units with their serial numbers. It goes well with the large packet of mounting holes for the drives.

You aren't pulling our collective legs, are you? :whistle:

Huh? No, I am not pulling your leg. I worked for the county government as an IT intern a few summers ago and we were required to have the serial number for every part that wasn't original to the computer. That means when we got a shipment in from HP all we needed was the computer seial number, but when we replaced or added new hardware we had to write down the serial for the hardware indentory db. It normally wasnt an issue since these kind of replacements were rare, but once we had to upgrade ~100 computers to have cdrw's (instead of their current cdrs) and one guy put them all in forgetting to write down the serials. Naturally the intern (me) was tasked to correct his mistake. I tried to do it wia the intranet and wmi but no luck. Was an extra pain since they had been spread across ~10 different geographic locations.

Link to comment
Share on other sites

I feel for you. Are you sure they didn't give you this useless task as an exercise to keep you out of mischief and waste your time so they didn't have to closely supervise you? :whistle:

Most equipment that has machine readable serial numbers is because somebody asked for it. If it is not offered, then I would be querying the need to obtain it in the first place. In your situation, unless you were attempting to track stolen CDRW drives, why would you bother? Just store the fact that it either has a CDRW drive installed or doesn't, not what the serial number is. If you needed to, track the model number, which is usually electronically available amongst your PNP attributes via WMI calls, as needed for driver support in a SOE type environment.

Link to comment
Share on other sites

I think you missed somthing, I said I worked for the GOVERNMENT. This was their SOP, and to be fair I have seen this doen at other places as well. The hardware database was used for life cycle replacement planning and warrentee checking. If XXXXX sent them an email saying "my drives broke" they could look up the serial check the warentee and model and see what the next step was. It might not have been the best way in the world but it worked pretty well. The need for serial numbers is one that almost every organization has.

Link to comment
Share on other sites

  • 7 years later...

Don't necro a thread that is 7 years old!

Search for "Scriptomatic" or "Computer info" on the forum. You'll find a lot of information.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...