Jump to content

Computer Info UDF's


 Share

Recommended Posts

I'm using Windows 7 and it was while running your script.

I faced the issue above but what I did is that I created an error handler and just ignored the error in it. Then the script works fine .Note sure where it went wrong :D

Link to comment
Share on other sites

  • 3 weeks later...
  • 4 weeks later...

I tried to create a program in vista using the udf but it fails with the error message below. The code runs beautifully on XP all versions but runs inside scite in vista. When i use compiled exe or a3x it fails

Line -1:

Error: The requested action with this object has failed.

Complete code given below

#include "CompInfo.au3"
Dim $Processes, $Services, $aOS,$Processors,$drv

msgbox(64,"Welcome","I am about to gather info about this system" & @CRLF & "All data will be saved in this folder once completed" & @CRLF & "Press OK to start",10)


$file=FileOpen ("info.html",2)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file to save info in current folder: " & @ScriptDir)
    Exit
EndIf
;setup file
FileWriteLine($file,"<html><body><font face=Arial size=-1><table width=100% border=1>")
FileWriteLine ($file,"<tr><td colpsan=4><b>SYSTEM INFO</b></td></tr>")
FileWriteLine($file,"<tr><td colspan=2><b>Server Name:</b></td><td colpsan=2>" &  @ComputerName & "</td></tr>")

FileWriteLine($file,"<tr><td colpsan=4><b>DRIVE(s) INFORMATION</b></td></tr>")
;Drive details
_ComputerGetDrives($drv,"ALL")
If NOT @error Then
    FileWriteLine($file, "<tr><td colpsan=4>Found <b>" & $drv[0][0] & "</b> drive(s)</td></tr>")
    FileWriteLine($file, "<tr><td ><b>DriveName</b></td><td><b>Total Space</b></td><td colpsan=2><b>Free Space</b></td></tr>")
    For $i = 1 to $drv[0][0] Step 1
        FileWriteLine($file,"<tr><td > " & $drv[$i][0] & "</td><td>" & Round($drv[$i][5] / 1024, 2) & "GB</td><td colspan=2>" & Round($drv[$i][4] / 1024, 2) & "GB</td> </tr>")
    Next
Else
    FileWriteLine($file,"<tr><td colpsan=4>Failed To enumerate drives. Could not fetch info !</td></tr>" )
EndIf
FileWriteLine($file,"<tr><td colpsan=4><b>PROCESS LIST</b></td></tr>")
;process list
$Processes = _ProcessListProperties()
If NOT @error Then
    FileWriteLine($file,"<tr><td><b>Process Name</b> </td><td><b>Binary</b>  </td><td><b>Memory</b> </td><td><b>CPU Usage</b> </td></tr>")
    
    For $i = 1 To $Processes[0][0] Step 1
        FileWriteLine($file,"<tr><td>" & $Processes[$i][0] & "</td><td>" & $Processes[$i][5]  & "</td><td>" & Round($Processes[$i][7]/1024)  & "KB</td><td>" & $Processes[$i][6] & "</td></tr>")
    
    Next 
Else
    FileWriteLine($file,"<tr><td colpsan=4>Failed To enumerate processes. Could not fetch info !</td></tr>" )   
EndIf

;Page File details
FileWriteLine($file, "<tr><td colpsan=4><b>PAGEFILE</b></td></tr>")
_ComputerGetOSs($aOS)
If NOT @error Then
    FileWriteLine($file,"<tr><td colpsan=4>Page File Size: <b>" & $aOS[1][56] & "</b></td></tr>")
Else
    FileWriteLine($file,"<tr><td colpsan=4>Failed To obtain Page File Info. Could not fetch info !</td></tr>")  
EndIf
;Processor details

FileWriteLine($file,"<tr><td colpsan=4><b>CPU-PROCESSOR(S)</b></td></tr>")
_ComputerGetProcessors($Processors)
If NOT @error Then
    For $i = 1 To $Processors[0][0] Step 1
        FileWriteLine($file,"<tr><td>Processor Name:</td><td><b>" & $Processors[$i][0] &  "</b></td><td>Load Percentage:</td><td> <b>" & $Processors[$i][21]& "</b></td></tr>")
    
    Next 
Else
    FileWriteLine($file,"<tr><td colpsan=4>Failed To enumerate Processors. Could not fetch info !</td></tr>" )  
EndIf
;Service Details
FileWriteLine($file,"<tr><td colpsan=4><b>SERVICES LIST</b></td></tr>")
_ComputerGetServices($Services)
If NOT @error Then
        FileWriteLine($file,"<tr><td colspan=2><b>Service Name</b></td><td colspan=2> <b>Status</b></td></tr>")

For $i = 1 To $Services[0][0] Step 1
        FileWriteLine($file,"<tr><td colspan=2>" & $Services[$i][7] &  "</td><td colspan=2>" & $Services[$i][17] & "</td></tr>")
    
    Next 
Else
    FileWriteLine($file,"<tr><td colpsan=4>Failed To enumerate processes. Could not fetch info !</td></tr>" )   
EndIf
FileWriteLine($file,"</table></font></body></html>")
FileClose($file)
msgbox(64,"Process Complete","All the information is saved in"& @CRLF & "Info.html"& @CRLF & "in the same folder" & @CRLF & "Press OK to launch file",10)
ShellExecute("info.html", "", @ScriptDir, "open")

Where did you get "_ProcessListProperties"? I don't have this as a UDF, and it's not included with your code. When running compiled, you may be having issues with the security level you're running the program as. Try right clicking the EXE and telling it to "Run as Administrator". Then run it and let me know.

I'm using Windows 7 and it was while running your script.

Was this in SciTE, or was the script compiled? Was this using one of my examples? (I assume so since you said my script). Try running it not compiled, and if it still has trouble, please provide more details. Also you can look up on MSDN whether those properties are still there for Windows 7. It could be that I need to update my script for Vista / Win7, but we'll see. I don't have either of those to test on, but I can try.

Wow! dont know how i've overlooked this UDF.Great scripting.

froufrou, I am very happy you like this UDF. I don't have as much time as I previously had to keep it updated, but I do try to keep track of it.

I faced the issue above but what I did is that I created an error handler and just ignored the error in it. Then the script works fine .Note sure where it went wrong :)

Like I said above, this may just be some missing parameters that Win 7 doesn't have.

In _ComputerGetNetworkCards() don't retrieve IPAddress, there is a way to get it from each Adapter? (DHCP)

Windows Vista Business

I suppose there is probably a way to get it from each adapter, but have you looked at the macros that are native to AutoIt? @IPAddress1-4?

Thanks everyone for your continued interest!

Jarvis

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

  • 1 month later...

Where did you get "_ProcessListProperties"? I don't have this as a UDF, and it's not included with your code.

Its a standalone UDF in Example Scripts, not in an include file: _ProcessListProperties()

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 2 months later...
  • 6 months later...
  • 5 weeks later...

can we add Group membership to _ComputerGetGroup?

Like have a three dimensional array for the groups and put every thing in $aGroupInfo[$i][0-6][0] and in $agroupInfo[$i][7][0-n] you put the members of said group.

It would look like this :

;$aGroupInfo[0][0][0] = Number of Groups

;$aGroupInfo[$i][0][0] = Name ($i starts at 1)

;$aGroupInfo[$i][1][0] = Doamin

;$aGroupInfo[$i][2][0] = Status

;$aGroupInfo[$i][3][0] = Local Account

;$aGroupInfo[$i][4][0] = Description

;$aGroupInfo[$i][5][0] = SID

;$aGroupInfo[$i][6][0] = SID Type

;$aGroupInfo[$i][7][0] = Number of Members

;$aGroupInfo[$i][7][1] = Member number 1

;$aGroupInfo[$i][7][n] = Member number n

I found a script(I am not the author) which demonstrates how to get the members of such account:

Func _GetLocalAdmins($host = @ComputerName)
    Dim $filter[1] = ["group"]
    $colGroups = ObjGet("WinNT://" & $host & "")
    If Not IsObj($colGroups) Then Return 0
    $colGroups.Filter = $filter
    For $objGroup In $colGroups
        If $objGroup.name = "Administrators" Then
            ConsoleWrite($host & @CRLF)
            For $objUser In $objGroup.Members
                ConsoleWrite("--" & $objUser.name & @CRLF)
            Next
            ConsoleWrite(@CRLF & @CRLF)
        EndIf
    Next
EndFunc

If you have another way you'd like to implement this, I'm fine with it aswell.

Link to comment
Share on other sites

  • 2 months later...

Thank you for this great UDF ;)

For my case I needed an additional specification. I'm posting my code here since it makes sense in the given context.

EDIT: I can't believe I didn't find this before... Drive Info UDFs by NerdFencer

If you want to get the physical drives' sizes (Hard Drives, Hard Disks):

; ###############
; HARD DRIVE SIZES
; ###############
$objWMIService = ObjGet("winmgmts:\\"&@ComputerName&"\root\cimv2")
$colHardDisk = $objWMIService.ExecQuery("select Size from Win32_DiskDrive where MediaType='Fixed hard disk media' or MediaType='Fixed hard disk'")
; 'Fixed hard disk media' --> WinVista+
; 'Fixed hard disk' --> NT4...XP
$sHardDrives=""
For $objHardDisk in $colHardDisk
    $sHardDrives&=Floor($objHardDisk.Size / (1000^3))&"+"
Next
$sHardDrives=StringTrimRight($sHardDrives,1)&" GB"
ConsoleWrite("-> Hard Drive(s): "&$sHardDrives&@CRLF)

Tested under Windows 7 32-bit.

Should work on NT4+, as specified.

Not sure about 64-bit editions, though (Win32_...?).

footswitch

Edited by footswitch
Link to comment
Share on other sites

  • 1 month later...

@footswitch,

Thanks for posting that. His code is excellent. I have linked him in the main post for anyone looking for more support of Drives.

Thanks,

Jarvis

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

  • 1 month later...
  • 3 months later...
  • 5 months later...

Hello

I added a command to the processor and it worked, and the command line this way.

Func _ComputerGetProcessors(ByRef $aProcessorInfo)

Local $colItems, $objWMIService, $objItem

Dim $aProcessorInfo[1][43], $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][43]

$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

$aProcessorInfo[$i][42] = $objItem.NumberOfLogicalProcessors

$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

Link to comment
Share on other sites

While running the examples I get this error: can you provide some direction?

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "H:\Service Desk\CompInfoExamples.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams

+>10:19:12 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86)

>Running AU3Check (1.54.19.0) from:C:\Program Files\AutoIt3

+>10:19:12 AU3Check ended.rc:0

>Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "H:\Service Desk\CompInfoExamples.au3"

H:\Service Desk\CompInfo.au3 (58) : ==> Variable must be of type "Object".:

$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BootConfiguration", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

$colItems = $objWMIService^ ERROR

->10:19:13 AutoIT3.exe ended.rc:1

>Exit code: 1 Time: 2.096

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

I ran the command and found it was running: anything else i can try, as I am running this local on my computer...I may use the code from Xenobiologist later if/when I am working with remote systems.

These Windows services are started:

Application Layer Gateway Service

Audio Service

Automatic Updates

Background Intelligent Transfer Service

Cisco Systems Secure Desktop

Cisco Systems, Inc. VPN Service

COM+ Event System

CryptSvc

DameWare Mini Remote Control

DCOM Server Process Launcher

DHCP Client

Distributed Link Tracking Client

DNS Client

Error Reporting Service

Event Log

Help and Support

HID Input Service

iClarityQoSService

Intel® PROSet/Wireless Event Log

Intel® PROSet/Wireless Registry Service

Intel® PROSet/Wireless SSO Service

Intel® PROSet/Wireless WiFi Service

IPSEC Services

Logical Disk Manager

Lotus Notes Diagnostics

McAfee Engine Service

McAfee Framework Service

McAfee McShield

McAfee Task Manager

McAfee Validation Trust Protection Service

Multi-user Cleanup Service

Net Driver HPZ12

Net Logon

Network Connections

Network Location Awareness (NLA)

Plug and Play

Pml Driver HPZ12

Print Spooler

Protected Storage

Remote Access Connection Manager

Remote Procedure Call (RPC)

Remote Registry

SafeBoot Client Manager

Secondary Logon

Security Accounts Manager

Server

Shell Hardware Detection

Smart Card

System Event Notification

System Restore Service

Task Scheduler

TCP/IP NetBIOS Helper

Telephony

Terminal Services

Themes

WebClient

Windows Audio

Windows Firewall/Internet Connection Sharing (ICS)

Windows Image Acquisition (WIA)

Windows Management Instrumentation

Windows Time

Workstation

The command completed successfully.

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Strange, seems like the service is running. To debug add following lines

ConsoleWrite("$cI_Compname" & @tab & $cI_Compname & @crlf)

ConsoleWrite("IsObj($objWMIService)" & @tab & IsObj($objWMIService) & @crlf)

directly after the first

$objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2")

Link to comment
Share on other sites

obtain the follow results - computer name removed (verified correct computer name)

$cI_Compname **************

IsObj($objWMIService) 0

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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...