Jump to content
JSThePatriot

Computer Info UDF's

Recommended Posts

JSThePatriot

This is some really great stuff JS :) !

SmOke_N I really appreciate it. :whistle: I am trying to make a complete library like IE and Excel and a few others out there. I feel that with all the PC Info and other such similar programs it would be helpful to everyone if this data could be gleaned with ease.

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)

Share this post


Link to post
Share on other sites
JSThePatriot

Added _ComputerGetThreads

Example:

Dim $Threads

_ComputerGetThreads($Threads)
If @error Then
    $error = @error
    $extended = @extended
    Switch $extended
        Case 1
            _ErrorMsg("Array contains no information.")
        Case 2
            _ErrorMsg("$colItems isnt an object.")
    EndSwitch
EndIf

For $i = 1 To $Threads[0][0] Step 1
    MsgBox(0, "Test _ComputerGetThreads", "Name: " & $Threads[$i][0] & @CRLF & _
                                    "Creation Class Name: " & $Threads[$i][1] & @CRLF & _
                                    "CS Creation Class Name: " & $Threads[$i][2] & @CRLF & _
                                    "CS Name: " & $Threads[$i][3] & @CRLF & _
                                    "Description: " & $Threads[$i][4] & @CRLF & _
                                    "Elapsed Time: " & $Threads[$i][5] & @CRLF & _
                                    "Execution State: " & $Threads[$i][6] & @CRLF & _
                                    "Handle: " & $Threads[$i][7] & @CRLF & _
                                    "Kernel Mode Time: " & $Threads[$i][8] & @CRLF & _
                                    "OS Creation Class Name: " & $Threads[$i][9] & @CRLF & _
                                    "OS Name: " & $Threads[$i][10] & @CRLF & _
                                    "Priority: " & $Threads[$i][11] & @CRLF & _
                                    "Priority Base: " & $Threads[$i][12] & @CRLF & _
                                    "Process Creation Class Name: " & $Threads[$i][13] & @CRLF & _
                                    "Process Handle: " & $Threads[$i][14] & @CRLF & _
                                    "Start Address: " & $Threads[$i][15] & @CRLF & _
                                    "Status: " & $Threads[$i][16] & @CRLF & _
                                    "Thread State: " & $Threads[$i][17] & @CRLF & _
                                    "Thread Wait Reason: " & $Threads[$i][18] & @CRLF & _
                                    "User Mode Time: " & $Threads[$i][19])
Next

Func _ErrorMsg($message, $time = 0)
    MsgBox(48 + 262144, "Error!", $message, $time)
EndFunc

;===============================================================================
; Description:      Returns the Thread information in an array.
; Parameter(s):     $aThreadInfo - By Reference - Thread Information array.
; Requirement(s):   None
; Return Value(s):  On Success - Returns array of Thread Information.
;                       $aThreadInfo[$i][0]  = Name
;                       $aThreadInfo[$i][1]  = Creation Class Name
;                       $aThreadInfo[$i][2]  = CS Creation Class Name
;                       $aThreadInfo[$i][3]  = CS Name
;                       $aThreadInfo[$i][4]  = Description
;                       $aThreadInfo[$i][5]  = Elapsed Time
;                       $aThreadInfo[$i][6]  = Execution State
;                       $aThreadInfo[$i][7]  = Handle
;                       $aThreadInfo[$i][8]  = Kernel Mode Time
;                       $aThreadInfo[$i][9]  = OS Creation Class Name
;                       $aThreadInfo[$i][10] = OS Name
;                       $aThreadInfo[$i][11] = Priority
;                       $aThreadInfo[$i][12] = Priority Base
;                       $aThreadInfo[$i][13] = Process Creation Class Name
;                       $aThreadInfo[$i][14] = Process Handle
;                       $aThreadInfo[$i][15] = Start Address
;                       $aThreadInfo[$i][16] = Status
;                       $aThreadInfo[$i][17] = Thread State
;                       $aThreadInfo[$i][18] = Thread Wait Reason
;                       $aThreadInfo[$i][19] = User Mode Time
;                   On Failure - @error = 1 and Returns 0
;                               @extended = 1 - Array contains no information
;                                           2 - $colItems isnt an object
; Author(s):        Jarvis Stubblefield (support "at" vortexrevolutions "dot" com)
; Note(s):
;===============================================================================
Func _ComputerGetThreads(ByRef $aThreadInfo)
    Local $cI_Compname = @ComputerName, $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20
    Local $colItems, $objWMIService, $objItem
    Dim $aThreadInfo[1][20], $i = 1
    
    $objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Thread", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    
    If IsObj($colItems) Then
        For $objItem In $colItems
            ReDim $aThreadInfo[UBound($aThreadInfo) + 1][20]
            $aThreadInfo[$i][0]  = $objItem.Name
            $aThreadInfo[$i][1]  = $objItem.CreationClassName
            $aThreadInfo[$i][2]  = $objItem.CSCreationClassName
            $aThreadInfo[$i][3]  = $objItem.CSName
            $aThreadInfo[$i][4]  = $objItem.Description
            $aThreadInfo[$i][5]  = $objItem.ElapsedTime
            $aThreadInfo[$i][6]  = $objItem.ExecutionState
            $aThreadInfo[$i][7]  = $objItem.Handle
            $aThreadInfo[$i][8]  = $objItem.KernelModeTime
            $aThreadInfo[$i][9]  = $objItem.OSCreationClassName
            $aThreadInfo[$i][10] = $objItem.OSName
            $aThreadInfo[$i][11] = $objItem.Priority
            $aThreadInfo[$i][12] = $objItem.PriorityBase
            $aThreadInfo[$i][13] = $objItem.ProcessCreationClassName
            $aThreadInfo[$i][14] = $objItem.ProcessHandle
            $aThreadInfo[$i][15] = $objItem.StartAddress
            $aThreadInfo[$i][16] = $objItem.Status
            $aThreadInfo[$i][17] = $objItem.ThreadState
            $aThreadInfo[$i][18] = $objItem.ThreadWaitReason
            $aThreadInfo[$i][19] = $objItem.UserModeTime
            $i += 1
        Next
        $aThreadInfo[0][0] = UBound($aThreadInfo) - 1
        If $aThreadInfo[0][0] < 1 Then
            SetError(1, 1, 0)
        EndIf
    Else
        SetError(1, 2, 0)
    EndIf
EndFunc ;_ComputerGetThreads

Let me know if you have any comments, questions, or feedback of any kind.

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)

Share this post


Link to post
Share on other sites
JSThePatriot

Changed _ComputerGetCPUs to _ComputerGetProcessors

Example

Dim $Processors

_ComputerGetProcessors($Processors)
If @error Then
    $error = @error
    $extended = @extended
    Switch $extended
        Case 1
            _ErrorMsg("Array contains no information.")
        Case 2
            _ErrorMsg("$colItems isnt an object.")
    EndSwitch
EndIf

For $i = 1 To $Processors[0][0] Step 1
    MsgBox(0, "Test _ComputerGetProcessors", "Name: " & $Processors[$i][0] & @CRLF & _
                                    "Address Width: " & $Processors[$i][1] & @CRLF & _
                                    "Architecture: " & $Processors[$i][2] & @CRLF & _
                                    "Availability: " & $Processors[$i][3] & @CRLF & _
                                    "Description: " & $Processors[$i][4] & @CRLF & _
                                    "Config Manager Error Code: " & $Processors[$i][5] & @CRLF & _
                                    "Config Manager User Config: " & $Processors[$i][6] & @CRLF & _
                                    "CPU Status: " & $Processors[$i][7] & @CRLF & _
                                    "Creation Class Name: " & $Processors[$i][8] & @CRLF & _
                                    "Current Clock Speed: " & $Processors[$i][9] & @CRLF & _
                                    "Current Voltage: " & $Processors[$i][10] & @CRLF & _
                                    "Data Width: " & $Processors[$i][11] & @CRLF & _
                                    "Device ID: " & $Processors[$i][12] & @CRLF & _
                                    "Error Cleared: " & $Processors[$i][13] & @CRLF & _
                                    "Error Description: " & $Processors[$i][14] & @CRLF & _
                                    "Ext Clock: " & $Processors[$i][15] & @CRLF & _
                                    "Family: " & $Processors[$i][16] & @CRLF & _
                                    "L2 Cache Size: " & $Processors[$i][17] & @CRLF & _
                                    "L2 Cache Speed: " & $Processors[$i][18] & @CRLF & _
                                    "Last Error Code: " & $Processors[$i][19] & @CRLF & _
                                    "Level: " & $Processors[$i][20] & @CRLF & _
                                    "Load Percentage: " & $Processors[$i][21] & @CRLF & _
                                    "Manufacturer: " & $Processors[$i][22] & @CRLF & _
                                    "Max Clock Speed: " & $Processors[$i][23] & @CRLF & _
                                    "Other Family Description: " & $Processors[$i][24] & @CRLF & _
                                    "PNP Device ID: " & $Processors[$i][25] & @CRLF & _
                                    "Power Management Capabilities: " & $Processors[$i][26] & @CRLF & _
                                    "Power Management Supported: " & $Processors[$i][27] & @CRLF & _
                                    "Processor ID: " & $Processors[$i][28] & @CRLF & _
                                    "Processor Type: " & $Processors[$i][29] & @CRLF & _
                                    "Revision: " & $Processors[$i][30] & @CRLF & _
                                    "Role: " & $Processors[$i][31] & @CRLF & _
                                    "Socket Designation: " & $Processors[$i][32] & @CRLF & _
                                    "Status: " & $Processors[$i][33] & @CRLF & _
                                    "Status Info: " & $Processors[$i][34] & @CRLF & _
                                    "Stepping: " & $Processors[$i][35] & @CRLF & _
                                    "System Creation Class Name: " & $Processors[$i][36] & @CRLF & _
                                    "System Name: " & $Processors[$i][37] & @CRLF & _
                                    "Unique ID: " & $Processors[$i][38] & @CRLF & _
                                    "Upgrade Method: " & $Processors[$i][39] & @CRLF & _
                                    "Version: " & $Processors[$i][40] & @CRLF & _
                                    "Voltage Caps: " & $Processors[$i][41])
Next

Func _ErrorMsg($message, $time = 0)
    MsgBox(48 + 262144, "Error!", $message, $time)
EndFunc

;===============================================================================
; Description:      Returns the Processor information in an array.
; Parameter(s):     $aProcessorInfo - By Reference - Processor Information array.
; Requirement(s):   None
; Return Value(s):  On Success - Returns array of Processor Information.
;                       $aProcessorInfo[$i][0]  = Name
;                       $aProcessorInfo[$i][1]  = Address Width
;                       $aProcessorInfo[$i][2]  = Architecture
;                       $aProcessorInfo[$i][3]  = Availability
;                       $aProcessorInfo[$i][4]  = Description
;                       $aProcessorInfo[$i][5]  = Config Manager Error Code
;                       $aProcessorInfo[$i][6]  = Config Manager User Config
;                       $aProcessorInfo[$i][7]  = CPU Status
;                       $aProcessorInfo[$i][8]  = Creation Class Name
;                       $aProcessorInfo[$i][9]  = Current Clock Speed
;                       $aProcessorInfo[$i][10] = Current Voltage
;                       $aProcessorInfo[$i][11] = Data Width
;                       $aProcessorInfo[$i][12] = Device ID
;                       $aProcessorInfo[$i][13] = Error Cleared
;                       $aProcessorInfo[$i][14] = Error Description
;                       $aProcessorInfo[$i][15] = Ext Clock
;                       $aProcessorInfo[$i][16] = Family
;                       $aProcessorInfo[$i][17] = L2 Cache Size
;                       $aProcessorInfo[$i][18] = L2 Cache Speed
;                       $aProcessorInfo[$i][19] = Last Error Code
;                       $aProcessorInfo[$i][20] = Level
;                       $aProcessorInfo[$i][21] = Load Percentage
;                       $aProcessorInfo[$i][22] = Manufacturer
;                       $aProcessorInfo[$i][23] = Max Clock Speed
;                       $aProcessorInfo[$i][24] = Other Family Description
;                       $aProcessorInfo[$i][25] = PNP Device ID
;                       $aProcessorInfo[$i][26] = Power Management Capabilities
;                       $aProcessorInfo[$i][27] = Power Management Supported
;                       $aProcessorInfo[$i][28] = Processor ID
;                       $aProcessorInfo[$i][29] = Processor Type
;                       $aProcessorInfo[$i][30] = Revision
;                       $aProcessorInfo[$i][31] = Role
;                       $aProcessorInfo[$i][32] = Socket Designation
;                       $aProcessorInfo[$i][33] = Status
;                       $aProcessorInfo[$i][34] = Status Info
;                       $aProcessorInfo[$i][35] = Stepping
;                       $aProcessorInfo[$i][36] = System Creation Class Name
;                       $aProcessorInfo[$i][37] = System Name
;                       $aProcessorInfo[$i][38] = Unique ID
;                       $aProcessorInfo[$i][39] = Upgrade Method
;                       $aProcessorInfo[$i][40] = Version
;                       $aProcessorInfo[$i][41] = Voltage Caps
;                   On Failure - @error = 1 and Returns 0
;                               @extended = 1 - Array contains no information
;                                           2 - $colItems isnt an object
; Author(s):        Jarvis Stubblefield (support "at" vortexrevolutions "dot" com)
; Note(s):
;===============================================================================
Func _ComputerGetProcessors(ByRef $aProcessorInfo)
    Local $cI_Compname = @ComputerName, $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20
    Local $colItems, $objWMIService, $objItem
    Dim $aProcessorInfo[1][42], $i = 1
    
    $objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    
    If IsObj($colItems) Then
        For $objItem In $colItems
            ReDim $aProcessorInfo[UBound($aProcessorInfo) + 1][42]
            $aProcessorInfo[$i][0]  = StringStripWS($objItem.Name, 1)
            $aProcessorInfo[$i][1]  = $objItem.AddressWidth
            $aProcessorInfo[$i][2]  = $objItem.Architecture
            $aProcessorInfo[$i][3]  = $objItem.Availability
            $aProcessorInfo[$i][4]  = $objItem.Description
            $aProcessorInfo[$i][5]  = $objItem.ConfigManagerErrorCode
            $aProcessorInfo[$i][6]  = $objItem.ConfigManagerUserConfig
            $aProcessorInfo[$i][7]  = $objItem.CpuStatus
            $aProcessorInfo[$i][8]  = $objItem.CreationClassName
            $aProcessorInfo[$i][9]  = $objItem.CurrentClockSpeed
            $aProcessorInfo[$i][10] = $objItem.CurrentVoltage
            $aProcessorInfo[$i][11] = $objItem.DataWidth
            $aProcessorInfo[$i][12] = $objItem.DeviceID
            $aProcessorInfo[$i][13] = $objItem.ErrorCleared
            $aProcessorInfo[$i][14] = $objItem.ErrorDescription
            $aProcessorInfo[$i][15] = $objItem.ExtClock
            $aProcessorInfo[$i][16] = $objItem.Family
            $aProcessorInfo[$i][17] = $objItem.L2CacheSize
            $aProcessorInfo[$i][18] = $objItem.L2CacheSpeed
            $aProcessorInfo[$i][19] = $objItem.LastErrorCode
            $aProcessorInfo[$i][20] = $objItem.Level
            $aProcessorInfo[$i][21] = $objItem.LoadPercentage
            $aProcessorInfo[$i][22] = $objItem.Manufacturer
            $aProcessorInfo[$i][23] = $objItem.MaxClockSpeed
            $aProcessorInfo[$i][24] = $objItem.OtherFamilyDescription
            $aProcessorInfo[$i][25] = $objItem.PNPDeviceID
            $aProcessorInfo[$i][26] = $objItem.PowerManagementCapabilities(0)
            $aProcessorInfo[$i][27] = $objItem.PowerManagementSupported
            $aProcessorInfo[$i][28] = $objItem.ProcessorId
            $aProcessorInfo[$i][29] = $objItem.ProcessorType
            $aProcessorInfo[$i][30] = $objItem.Revision
            $aProcessorInfo[$i][31] = $objItem.Role
            $aProcessorInfo[$i][32] = $objItem.SocketDesignation
            $aProcessorInfo[$i][33] = $objItem.Status
            $aProcessorInfo[$i][34] = $objItem.StatusInfo
            $aProcessorInfo[$i][35] = $objItem.Stepping
            $aProcessorInfo[$i][36] = $objItem.SystemCreationClassName
            $aProcessorInfo[$i][37] = $objItem.SystemName
            $aProcessorInfo[$i][38] = $objItem.UniqueId
            $aProcessorInfo[$i][39] = $objItem.UpgradeMethod
            $aProcessorInfo[$i][40] = $objItem.Version
            $aProcessorInfo[$i][41] = $objItem.VoltageCaps
            $i += 1
        Next
        $aProcessorInfo[0][0] = UBound($aProcessorInfo) - 1
        If $aProcessorInfo[0][0] < 1 Then
            SetError(1, 1, 0)
        EndIf
    Else
        SetError(1, 2, 0)
    EndIf
EndFunc ;_ComputerGetProcessors

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)

Share this post


Link to post
Share on other sites
GaryFrost

MsgBox(0, "Chassis Type", _ChassisType())

Func _ChassisType($strComputer = "localhost")
    Local $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20
    Local $colItems = "", $objItem, $objWMIService
    Local $ChassisType[25] = [24, 'Other', 'Unknown', 'Desktop', 'Low Profile Desktop', 'Pizza Box', 'Mini Tower', _
            'Tower', 'Portable', 'Laptop', 'Notebook', 'Hand Held', 'Docking Station', 'All in One', _
            'Sub Notebook', 'Space-Saving', 'Lunch Box', 'Main System Chassis', 'Expansion Chassis', _
            'SubChassis', 'Bus Expansion Chassis', 'Peripheral Chassis', 'Storage Chassis', _
            'Rack Mount Chassis', 'Sealed-Case PC']
    
    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_SystemEnclosure", "WQL", _
            $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    
    If IsObj($colItems) Then
        For $objItem In $colItems
            $strChassisTypes = $objItem.ChassisTypes (0)
            Return $ChassisType[$strChassisTypes] & @LF
        Next
    EndIf
    Return ""
EndFunc   ;==>_ChassisType


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
JSThePatriot

MsgBox(0, "Chassis Type", _ChassisType())

Func _ChassisType($strComputer = "localhost")
    Local $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20
    Local $colItems = "", $objItem, $objWMIService
    Local $ChassisType[25] = [24, 'Other', 'Unknown', 'Desktop', 'Low Profile Desktop', 'Pizza Box', 'Mini Tower', _
            'Tower', 'Portable', 'Laptop', 'Notebook', 'Hand Held', 'Docking Station', 'All in One', _
            'Sub Notebook', 'Space-Saving', 'Lunch Box', 'Main System Chassis', 'Expansion Chassis', _
            'SubChassis', 'Bus Expansion Chassis', 'Peripheral Chassis', 'Storage Chassis', _
            'Rack Mount Chassis', 'Sealed-Case PC']
    
    $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
    $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_SystemEnclosure", "WQL", _
            $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    
    If IsObj($colItems) Then
        For $objItem In $colItems
            $strChassisTypes = $objItem.ChassisTypes (0)
            Return $ChassisType[$strChassisTypes] & @LF
        Next
    EndIf
    Return ""
EndFunc   ;==>_ChassisType
Hrm... that means I need to figure out what the values of my other .ObjectName(0) could possibly be and put them in how you have it.

gafrost, I appreciate your response, and will be moving to hardware shortly.

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)

Share this post


Link to post
Share on other sites
FeReNGi

What about a _ComputerSetUsers in stead of _ComputerGetUsers

Set for unlocking a local user ?

Share this post


Link to post
Share on other sites
JSThePatriot

What about a _ComputerSetUsers in stead of _ComputerGetUsers

Set for unlocking a local user ?

It definitely wouldnt be "instead of", but I do see how this could be somewhat useful. It doesnt exactly follow down the path that I am walking at the moment, but I will keep it in mind for future expansion of functions.

I really appreciate your input,

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)

Share this post


Link to post
Share on other sites
soulcaliburvn

Some questions :

"SELECT * FROM Win32_BIOS"

"SELECT * FROM Win32_Thread"

why you know there is a table name like Win32_BIOS, Win32_Thread

Can you tell me where to read to know what table WindowsXP have ?

$aBIOSInfo[$i][0] = $objItem.Name

$aBIOSInfo[$i][1] = $objItem.Status

$aBIOSInfo[$i][2] = $objItem.BiosCharacteristics(0)

why you know what field a table have ?

Share this post


Link to post
Share on other sites
GaryFrost

Some questions :

why you know there is a table name like Win32_BIOS, Win32_Thread

Can you tell me where to read to know what table WindowsXP have ?

why you know what field a table have ?

WMI Reference

AutoIt Scriptomatic


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
ptrex

@Gafrost

Regarding your example "Local $ChassisType[25] ="

Instead of adding everything in an Array you can use as an alternative the

$oDict = ObjCreate("Scripting.Dictionary")

And created a dictionary. This has contains more flexibilty and has more features.

Scripting Dictionary

Just a tip :whistle:

@JSThePatriot

What is missing in every example is a COM error check !!

;This is SvenP's COM error handler
Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"COM Error Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            )
  SetError(1)  ; to check for after this function returns
Endfunc

By the way, I would not put too much effort in all the UDF's,

since Microsoft is releasing PowerShell (Monad) as a replacement of WMI.

Just a hint :)

Regards,

Share this post


Link to post
Share on other sites
JSThePatriot

@Gafrost

Regarding your example "Local $ChassisType[25] ="

Instead of adding everything in an Array you can use as an alternative the

$oDict = ObjCreate("Scripting.Dictionary")

And created a dictionary. This has contains more flexibilty and has more features.

Scripting Dictionary

Just a tip :whistle:

@JSThePatriot

What is missing in every example is a COM error check !!

;This is SvenP's COM error handler
Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"COM Error Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            )
  SetError(1)  ; to check for after this function returns
Endfunc

By the way, I would not put too much effort in all the UDF's,

since Microsoft is releasing PowerShell (Monad) as a replacement of WMI.

Just a hint :)

Regards,

Thanks for the error checking... I havent been able to figure it all out yet.

I didnt know that about WMI...Are they going to just straight up remove it, or phase it out?

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)

Share this post


Link to post
Share on other sites
GaryFrost

Thanks for the error checking... I havent been able to figure it all out yet.

I didnt know that about WMI...Are they going to just straight up remove it, or phase it out?

JS

Far as I can tell It's not replacing WMI, PowerShell is another scripting language

Might want to go to the Read Articles Section at Microsoft TechNet

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
JSThePatriot

By the way, I would not put too much effort in all the UDF's,

since Microsoft is releasing PowerShell (Monad) as a replacement of WMI.

Just a hint :whistle:

Regards,

I just did a search on PowerShell...

PowerShell

On that website, it never states that PowerShell would be replacing WMI, but would be allowing for "easier" access to WMI and the Registry through its own scripting langauge.

Windows PowerShell allows Windows administrators to be more productive by providing numerous system administration utilities, consistent syntax, and improved navigation of common management data such as the registry or Windows Management Instrumentation (WMI).

I dont see "improved navigation" to be a replacement for WMI. If you have another source that would more accurately say that it is replacing WMI then please let me know.

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)

Share this post


Link to post
Share on other sites
JSThePatriot

Far as I can tell It's not replacing WMI, PowerShell is another scripting language

Might want to go to the Read Articles Section at Microsoft TechNet

Thanks gafrost. As you see in my above post (one below yours) I found that out for myself.

@Everyone

I will continue my _ComputerGet*Info* library. I am going to finish up the software side, add error checking to all of the functions, and go back and do hardware.

I do appreciate everyone's patience, and everyone who has contributed so far!

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)

Share this post


Link to post
Share on other sites
JSThePatriot

Thanks for the WMI Reference. I will be using that to further document the output of my UDF's.

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)

Share this post


Link to post
Share on other sites
ptrex

@Gafrost/JSThePatriot

Also Jeffrey Snover's Tuesday morning session Windows PowerShell: Next Generation Command Line Scripting.

Jeffrey Snover, the Windows PowerShell Architect

I don' t know what you all make out of this statement, but whatever Blog you read about Powershell,

you read it will be the future scripting language in Windows.

It' s all rather new so it'll be not for tomorrow, but for the day after that !!

WMI scripts are that much easier, and scripts that much shorter.

Why would anyone keep on writing 10 lines of code if you can do it in 2 or 3. :whistle:

See you all around

Share this post


Link to post
Share on other sites
JSThePatriot

@ptrex

I read that blog. It looked like PowerShell is going to be another scripting language. I dont see where he can write WMI code in 2 or 3 lines vs say 10. I think that PowerShell will only be a competition to AutoIt, but we are so far ahead there wont be much competition off the start.

Not to mention the code that is on that blog just looks ugly. They have tried mixing what appears to be BASIC, and C++. I prefer C++ and AutoIt's code structure. Its not mixed and matched.

Thanks for the point of view,

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)

Share this post


Link to post
Share on other sites
Skrip

JS, i've added all of the scripts that you've posted examples for. Can't wait for hard ware.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites
GaryFrost

@Gafrost

Regarding your example "Local $ChassisType[25] ="

Instead of adding everything in an Array you can use as an alternative the

$oDict = ObjCreate("Scripting.Dictionary")

And created a dictionary. This has contains more flexibilty and has more features.

Scripting Dictionary

If this was being used over and over to retrieve different values than this might be true, but in this case I see no benifits by using a dictionary.

As a matter of fact in this case it would add many lines of code not needed.

Gary


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
JSThePatriot

Edit 15: Added_ComputerGetProcesses

Edit 16: Changed _ComputerGetPrinters to include more information and documentation.

Check the first post for the new include file that I have assembled.

I will be posting a file with examples either tomorrow or Friday.

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)

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

×