Sign in to follow this  
Followers 0
DirtDBaK

How do I find the Processor Speed?

5 posts in this topic

How do I find the Processor Speed?

No luck on my search..

Thanks!


[center][/center]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Found this... not sure if it'll work or not.

$cpu0 = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "~MHz")

and this by Gary

MsgBox(0, "Clock Speed", _GetClockSpeed(@ComputerName))

Func _GetClockSpeed($s_Machine)
    Local Const $wbemFlagReturnImmediately = 0x10
    Local Const $wbemFlagForwardOnly = 0x20
    Local $objWMIService = ObjGet("winmgmts:\\" & $s_Machine & "\root\CIMV2")
    Local $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Processor", "WQL", _
            $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If @error Then
        MsgBox(16, "_GetClockSpeed", "ExecQuery Error: SELECT * FROM Win32_Processor")
        Return
    EndIf
   
    Local $s_info = "", $objItem
    If IsObj($colItems) Then
        For $objItem In $colItems
            If $objItem.MaxClockSpeed > 999 Then
                $s_info = StringFormat("%1.2f", $objItem.MaxClockSpeed / 1000) & " GHz"
            Else
                $s_info = $objItem.MaxClockSpeed & " MHz"
            EndIf
        Next
    EndIf
    Return $s_info
EndFunc;==>_GetClockSpeed

And this ...

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$computerName = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $computerName & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$CPUSpeed = $objItem.CurrentClockSpeed
Next
MsgBox(0,"",$CPUSpeed)
EndIf
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
    For $objItem In $colItems
        $Memory = $objItem.TotalPhysicalMemory
    Next
EndIf
MsgBox(0,"",$Memory)

.... and this by Gif

Opt('MustDeclareVars', 1)

#region
    #NoTrayIcon
    #Include <Array.au3>
#endregion

;====================================================================================
;   Programmed by: Tefkros Pavlou (Gif) ,   www.randomsoft.tk
;     Reference at: http://msdn2.microsoft.com
;        WINMGMTS functions
;====================================================================================

MsgBox(64, 'Mouse Properties', _Mouse_Properties())
MsgBox(64, 'Processor Speed', _Processor_Speed())
MsgBox(64, 'Computer Type', _Computer_Type())
MsgBox(64, 'Total RAM installed', _Physical_RAM_Available())
MsgBox(64, 'Number of Processors', _Number_Of_Processors())
MsgBox(64, 'Floppy check', _Check_Floppy())
MsgBox(64, 'MS Office Version', _Office_GetVersion())
MsgBox(64, 'Operating System Status', _Determine_Operating_System_Status())
MsgBox(64, 'Detailed Date/Time', _Retrieve_Date_And_Time())
MsgBox(64, 'Time Zone', _Get_Time_Zone())
MsgBox(64, 'Username', _Get_Username())

Global $Accounts_Array = _Get_Local_Accounts()
If ($Accounts_Array <> 0) Then _ArrayDisplay($Accounts_Array, 'Local Accounts')

Global $Drives_Array = _Drives_Determine()
If ($Drives_Array <> 0) Then _ArrayDisplay($Drives_Array, 'Drives (determine DVD drives)')

Global $usb_Array = _USB_Devices()
If ($usb_Array <> 0) Then _ArrayDisplay($usb_Array, 'USB Devices')

Global $Logs_Array = _Get_Events_From_Log()
If ($Logs_Array <> 0) Then _ArrayDisplay($Logs_Array, 'Local Accounts')

Global $Startup_Services_Array = _Get_Startup_Services()
If ($Startup_Services_Array <> 0) Then _ArrayDisplay($Startup_Services_Array, 'Startup Items')

Exit (0)

Func _Mouse_Properties()
    Local $a_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_PointingDevice')
       
        Local $Obj_Item
        For $Obj_Item In $Col_Items
            Local $a_Text = 'Description: ' & $Obj_Item.Description & @CRLF
            $a_Text &= 'Device ID: ' & $Obj_Item.DeviceID & @CRLF
            $a_Text &= 'Device Interface: ' & $Obj_Item.DeviceInterface & @CRLF
            $a_Text &= 'Double Speed Threshold: ' & $Obj_Item.DoubleSpeedThreshold & @CRLF
            $a_Text &= 'Handedness: ' & $Obj_Item.Handedness & @CRLF
            $a_Text &= 'Hardware Type: ' & $Obj_Item.HardwareType & @CRLF
            $a_Text &= 'INF File Name: ' & $Obj_Item.InfFileName & @CRLF
            $a_Text &= 'INF Section: ' & $Obj_Item.InfSection & @CRLF
            $a_Text &= 'Manufacturer: ' & $Obj_Item.Manufacturer & @CRLF
            $a_Text &= 'Name: ' & $Obj_Item.Name & @CRLF
            $a_Text &= 'Number Of Buttons: ' & $Obj_Item.NumberOfButtons & @CRLF
            $a_Text &= 'PNP Device ID: ' & $Obj_Item.PNPDeviceID & @CRLF
            $a_Text &= 'Pointing Type: ' & $Obj_Item.PointingType & @CRLF
            $a_Text &= 'Quad Speed Threshold: ' & $Obj_Item.QuadSpeedThreshold & @CRLF
            $a_Text &= 'Resolution: ' & $Obj_Item.Resolution & @CRLF
            $a_Text &= 'Sample Rate: ' & $Obj_Item.SampleRate & @CRLF
            $a_Text &= 'Synch: ' & $Obj_Item.Synch
        Next
       
        Return String($a_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Processor_Speed()
    Local $s_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_Processor')
       
        Local $Obj_Item
        For $Obj_Item In $Col_Items
            Local $s_Text = 'Processor Id: ' & $Obj_Item.ProcessorId & @CRLF
            $s_Text &= 'Maximum Clock Speed: ' & $Obj_Item.MaxClockSpeed
        Next
       
        Return String($s_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Computer_Type()
    Local $u_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Chassis = $Obj_WMIService.ExecQuery('Select * from Win32_SystemEnclosure')
       
        Local $Obj_Chassis
        For $Obj_Chassis In $Col_Chassis
           
            Local $Obj_Items
            For $Obj_Item In $Obj_Chassis.ChassisTypes
                If (Number($Obj_Item) = 1) Then
                    Local $u_Text = 'Type: Other' & @CRLF
                ElseIf (Number($Obj_Item) = 2) Then
                    Local $u_Text = 'Type: Unknown' & @CRLF
                ElseIf (Number($Obj_Item) = 3) Then
                    Local $u_Text = 'Type: Desktop' & @CRLF
                ElseIf (Number($Obj_Item) = 4) Then
                    Local $u_Text = 'Type: Low profile Desktop' & @CRLF
                ElseIf (Number($Obj_Item) = 5) Then
                    Local $u_Text = 'Type: Pizza Box' & @CRLF
                ElseIf (Number($Obj_Item) = 6) Then
                    Local $u_Text = 'Type: Mini Tower' & @CRLF
                ElseIf (Number($Obj_Item) = 7) Then
                    Local $u_Text = 'Type: Tower' & @CRLF
                ElseIf (Number($Obj_Item) = 8) Then
                    Local $u_Text = 'Type: Portable' & @CRLF
                ElseIf (Number($Obj_Item) = 9) Then
                    Local $u_Text = 'Type: Laptop' & @CRLF
                ElseIf (Number($Obj_Item) = 10) Then
                    Local $u_Text = 'Type: Notebook' & @CRLF
                ElseIf (Number($Obj_Item) = 11) Then
                    Local $u_Text = 'Type: Hand Held' & @CRLF
                ElseIf (Number($Obj_Item) = 12) Then
                    Local $u_Text = 'Type: Docking Station' & @CRLF
                ElseIf (Number($Obj_Item) = 13) Then
                    Local $u_Text = 'Type: All in One' & @CRLF
                ElseIf (Number($Obj_Item) = 14) Then
                    Local $u_Text = 'Type: Sub Notebook' & @CRLF
                ElseIf (Number($Obj_Item) = 15) Then
                    Local $u_Text = 'Type: Space saving' & @CRLF
                ElseIf (Number($Obj_Item) = 16) Then
                    Local $u_Text = 'Type: Lunch Box' & @CRLF
                ElseIf (Number($Obj_Item) = 17) Then
                    Local $u_Text = 'Type: Main System Chassis' & @CRLF
                ElseIf (Number($Obj_Item) = 18) Then
                    Local $u_Text = 'Type: Expansion Chassis' & @CRLF
                ElseIf (Number($Obj_Item) = 19) Then
                    Local $u_Text = 'Type: SubChassis' & @CRLF
                ElseIf (Number($Obj_Item) = 20) Then
                    Local $u_Text = 'Type: Bus Expansion Chassis' & @CRLF
                ElseIf (Number($Obj_Item) = 21) Then
                    Local $u_Text = 'Type: Peripheral Chassis' & @CRLF
                ElseIf (Number($Obj_Item) = 22) Then
                    Local $u_Text = 'Type: Storage Chassis' & @CRLF
                ElseIf (Number($Obj_Item) = 23) Then
                    Local $u_Text = 'Type: Rack Mount Chassis' & @CRLF
                ElseIf (Number($Obj_Item) = 24) Then
                    Local $u_Text = 'Type: Sealed-Case PC' & @CRLF
                Else
                    Local $u_Text = 'Type: Unable to retrieve' & @CRLF
                EndIf
            Next
           
           ; Might not work properly
            $u_Text &= 'Name: ' & $Obj_Chassis.Name & @CRLF
            $u_Text &= 'Caption: ' & $Obj_Chassis.Caption & @CRLF
            $u_Text &= 'Manufacturer: ' & $Obj_Chassis.Manufacturer & @CRLF
            $u_Text &= 'Model: ' & $Obj_Chassis.Model & @CRLF
            $u_Text &= 'Description: ' & $Obj_Chassis.Description & @CRLF
            $u_Text &= 'Height: ' & $Obj_Chassis.Height & @CRLF
            $u_Text &= 'Width: ' & $Obj_Chassis.Width & @CRLF
            $u_Text &= 'Weight: ' & $Obj_Chassis.Weight & @CRLF
            $u_Text &= 'Depth: ' & $Obj_Chassis.Depth & @CRLF
            $u_Text &= 'Heat Generation: ' & $Obj_Chassis.HeatGeneration & @CRLF
            $u_Text &= 'Install Date: ' & $Obj_Chassis.InstallDate & @CRLF

        Next
       
        Return String($u_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Physical_RAM_Available()
    Local $y_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_ComputerSystem')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            Local $y_Text = 'RAM: ' & Round((($Obj_Items.TotalPhysicalMemory / 1024) / 1024), 3) & ' MB'
        Next
       
        Return String($y_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Number_Of_Processors()
    Local $z_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_ComputerSystem')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            Local $z_Text = 'Found: ' & $Obj_Items.NumberOfProcessors & ' processor(s)'
        Next
       
        Return String($z_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Drives_Determine()
    Local $Columns = 4
    Local $Number_DRV = DriveGetDrive('CDROM')
    Local $Drives[($Number_DRV[0] + 1)][$Columns]
    $Drives[0][0] = -1
   
    Dim $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_CDROMDrive')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            $Drives[0][0] += 1
            $Drives[Number($Drives[0][0] + 1)][0] = $Obj_Items.DeviceID
            $Drives[Number($Drives[0][0] + 1)][1] = $Obj_Items.Description
            $Drives[Number($Drives[0][0] + 1)][2] = $Obj_Items.Name
            $Drives[Number($Drives[0][0] + 1)][3] = $Obj_Items.Drive
        Next
       
        $Drives[0][0] += 1
       
        Return $Drives
    Else
        Return 0
    EndIf
EndFunc

Func _USB_Devices()
    Local $Columns = 3
    Local $usb_Array[9][$Columns]
    $usb_Array[0][0] = -1
   
    Dim $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_USBHub')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            $usb_Array[0][0] += 1
            $usb_Array[Number($usb_Array[0][0] + 1)][0] = $Obj_Items.DeviceID
            $usb_Array[Number($usb_Array[0][0] + 1)][1] = $Obj_Items.PNPDeviceID
            $usb_Array[Number($usb_Array[0][0] + 1)][2] = $Obj_Items.Description
            If (($Obj_Items.Description) <> ($Obj_Items.Name)) Then
                ReDim $usb_Array[Number($usb_Array[0][0] + 1)][$Columns + 1]
                $usb_Array[Number($usb_Array[0][0] + 1)][3] = $Obj_Items.Name
            EndIf
        Next
       
        $usb_Array[0][0] += 1
       
        Return $usb_Array
    Else
        Return 0
    EndIf
   
EndFunc

Func _Check_Floppy()
    Local $m_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery("Select * From Win32_LogicalDisk Where DeviceID = 'A:'")
       
        For $Obj_Items In $Col_Items
            Local $IntFreeSpace = $Obj_Items.FreeSpace
            If (IsNull($IntFreeSpace)) Then
                Local $m_Text = 'No disk in floppy drive.'
            Else
                Local $m_Text = 'Disk found in the floppy drive.'
            EndIf
        Next
       
        Return String($m_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Office_GetVersion()
    Local $h_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_Product ' & _
                'Where IdentifyingNumber ='  _
                 & " '{90280409-6000-11D3-8CFE-0050048383C9}'")
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            Local $h_Text = 'Name: ' & $Obj_Items.Name & @CRLF
            $h_Text &= 'Version: ' & $Obj_Items.Version
        Next
       
        Return String($h_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Get_Startup_Services()
    Local $Columns = 6
    Local $Startup_Services_Array[2][$Columns]
    $Startup_Services_Array[0][0] = 0
   
    Dim $Obj_WMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_StartupCommand')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            $Startup_Services_Array[0][0] += 1
            $Startup_Services_Array[Number($Startup_Services_Array[0][0])][0] = $Obj_Items.Command
            $Startup_Services_Array[Number($Startup_Services_Array[0][0])][1] = $Obj_Items.Description
            $Startup_Services_Array[Number($Startup_Services_Array[0][0])][2] = $Obj_Items.Location
            $Startup_Services_Array[Number($Startup_Services_Array[0][0])][3] = $Obj_Items.Name
            $Startup_Services_Array[Number($Startup_Services_Array[0][0])][4] = $Obj_Items.SettingID
            $Startup_Services_Array[Number($Startup_Services_Array[0][0])][5] = $Obj_Items.User
            ReDim $Startup_Services_Array[Number($Startup_Services_Array[0][0] + 2)][$Columns]
        Next
       
        $Startup_Services_Array[0][0] += 1
       
        Return $Startup_Services_Array
    Else
        Return 0
    EndIf
EndFunc

Func _Determine_Operating_System_Status()
    Local $j_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_WindowsProductActivation')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            Global $Active_Require = $Obj_Items.ActivationRequired
           
            Switch $Active_Require
                Case 0
                    Local $j_Text = 'Activation Not Required' & @CRLF
                Case 1
                    Local $j_Text = 'Activation Is Required' & @CRLF
                Case Else
                    Local $j_Text = 'unknown' & @CRLF
            EndSwitch
           
            $j_Text &= 'Remaining Evaluation Period (in days): ' & $Obj_Items.RemainingEvaluationPeriod & @CRLF
            $j_Text &= 'Remaining Grace Period: (in days): ' & $Obj_Items.RemainingGracePeriod
        Next
       
        Return String($j_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Retrieve_Date_And_Time()
    Local $t_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_LocalTime')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            Local $t_Text = 'Day: ' & $Obj_Items.Day & @CRLF
            $t_Text &= 'Day Of Week: ' & $Obj_Items.DayOfWeek & @CRLF
            $t_Text &= 'Hour: ' & $Obj_Items.Hour & @CRLF
            $t_Text &= 'Minute: ' & $Obj_Items.Minute & @CRLF
            $t_Text &= 'Month: ' & $Obj_Items.Month & @CRLF
            $t_Text &= 'Quarter: ' & $Obj_Items.Quarter & @CRLF
            $t_Text &= 'Second: ' & $Obj_Items.Second & @CRLF
            $t_Text &= 'Week In Month: ' & $Obj_Items.WeekInMonth & @CRLF
            $t_Text &= 'Year: ' & $Obj_Items.Year
        Next
       
        Return String($t_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Get_Time_Zone()
    Local $l_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_TimeZone')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            Local $l_Text = 'Description: ' & $Obj_Items.Description & @CRLF
            $l_Text &= 'Daylight Name: ' & $Obj_Items.DaylightName & @CRLF
            $l_Text &= 'Standard Name: ' & $Obj_Items.StandardName
        Next
       
        Return String($l_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Get_Username()
    Local $p_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_ComputerSystem')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            Local $p_Text = 'Name: ' & $Obj_Items.Name & @CRLF
            $p_Text &= 'Username: ' & $Obj_Items.Username
        Next
       
        Return String($p_Text)
    Else
        Return 0
    EndIf
EndFunc

Func _Get_Local_Accounts()
    Local $Columns = 4
    Local $Local_Accounts_Array[2][$Columns]
    $Local_Accounts_Array[0][0] = 0
   
    Dim $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_Group  Where LocalAccount = True')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            $Local_Accounts_Array[0][0] += 1
            $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][0] = $Obj_Items.Name
            $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][1] = $Obj_Items.Sid
            Local $Sz_SetType = Number($Obj_Items.SidType)
           
            Select
                Case $Sz_SetType = 1
                    $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][2] = 'User'
                Case $Sz_SetType = 2
                    $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][2] = 'Group'
                Case $Sz_SetType = 3
                    $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][2] = 'Domain'
                Case $Sz_SetType = 4
                    $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][2] = 'Alias'
                Case $Sz_SetType = 5
                    $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][2] = 'Well Known Group'
                Case $Sz_SetType = 6
                    $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][2] = 'Deleted Account'
                Case $Sz_SetType = 7
                    $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][2] = 'Invalid'
                Case $Sz_SetType = 8
                    $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][2] = 'Unknown'
                Case $Sz_SetType = 9
                    $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][2] = 'Computer'
            EndSelect
           
            $Local_Accounts_Array[Number($Local_Accounts_Array[0][0])][3] = $Obj_Items.Status
            ReDim $Local_Accounts_Array[Number($Local_Accounts_Array[0][0] + 2)][$Columns]
        Next
       
        Return $Local_Accounts_Array
    Else
        Return 0
    EndIf
EndFunc

Func _Get_Events_From_Log()
    Local $Columns = 9
    Local $Events_Array[2][$Columns]
    $Events_Array[0][0] = 0
   
    Dim $Obj_WMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery("Select * from Win32_NTLogEvent "  _
                 & "Where Logfile = 'System'")
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            $Events_Array[0][0] += 1
            $Events_Array[Number($Events_Array[0][0])][0] = $Obj_Items.Category
            $Events_Array[Number($Events_Array[0][0])][1] = $Obj_Items.ComputerName
            $Events_Array[Number($Events_Array[0][0])][2] = $Obj_Items.EventCode
            $Events_Array[Number($Events_Array[0][0])][3] = $Obj_Items.Message
            $Events_Array[Number($Events_Array[0][0])][4] = $Obj_Items.RecordNumber
            $Events_Array[Number($Events_Array[0][0])][5] = $Obj_Items.SourceName
            $Events_Array[Number($Events_Array[0][0])][6] = $Obj_Items.TimeWritten
            $Events_Array[Number($Events_Array[0][0])][7] = $Obj_Items.Type
            $Events_Array[Number($Events_Array[0][0])][8] = $Obj_Items.User
            ReDim $Events_Array[Number($Events_Array[0][0] + 2)][$Columns]
        Next
       
        Return $Events_Array
    Else
        Return 0
    EndIf
EndFunc

Func _Rename_Computer($iName = @ComputerName)
    Local $z_Text = ''
    Dim $Obj_WMIService = ObjGet('winmgmts:{impersonationLevel=impersonate}!\\' & @ComputerName & '\root\cimv2');
    If (IsObj($Obj_WMIService)) And (Not @error) Then
        Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_ComputerSystem')
       
        Local $Obj_Items
        For $Obj_Items In $Col_Items
            Local $z_Text = $Obj_Items.Rename(String($iName))
        Next

    EndIf
EndFunc

; Logic IsNull() expression [http://msdn2.microsoft.com/en-us/library/zbchw6hz.aspx]
Func IsNull($g_Var)
    If ((String($g_Var) == '') Or (IsBinary($g_Var)) Or (Not String($g_Var)) Or (StringIsSpace($g_Var)) Or (@error)) Then
        Return True
    Else
        Return False
    EndIf
EndFunc
Edited by Fossil Rock

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

thanks i'll test it out did you find those using the search??


[center][/center]

Share this post


Link to post
Share on other sites

thanks i'll test it out did you find those using the search??

Not using the forum search.... I use this. I.P. Board doesn't do "phrase searches".

Oh, and stay away from the last example ... it takes a while for it to complete... just rip out the code you want.


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

I used Gary's code, and I can never get any good results from the I.P. Board search thats what I was doing wrong

Thanks!!!


[center][/center]

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  
Followers 0