Jump to content

Getting computer dan user information


Recommended Posts

Hi,

I try to get some computer dan user information. This is some information I think I can get:

"Computer Name" using @ComputerName

"Workgroup" using a func that I already have

"Username" using @UserName

"Home Drive" and "Home Path" using @HomeDrive & @HomePath

"OS Version" using @OSVersion

What other information I can gather and would you give a hint how to do it?

Thanks :)

Link to comment
Share on other sites

There is a very good >computer info UDF available.

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

Here is a snippet from my own computer info gathering utility, naturally I did not include everything as it contained identifying information. Also its pretty mediocre in quality. Hope it helps though!

#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <Inet.au3>
#include <CompInfo2.au3>

Func GetDrives()
    $var1 = DriveGetDrive("NETWORK")
    If @error Then
        ConsoleWrite("An error occured while retrieving the drives." & @CRLF)
        Return "No drives to display."
    EndIf
    $var2 = ""
    For $i = 1 To $var1[0]
        $var2 &= StringUpper($var1[$i]) & "         " & DriveMapGet($var1[$i]) & @CRLF
    Next
    Return $var2
EndFunc   ;==>GetDrives

; Get RAM in MBs
Func GetRAM()
    $Ramvar = MemGetStats()
    $Ram1 = StringSplit(($Ramvar[1] / 1024), ".")
    $Ram2 = $Ram1[1] & " MB"
    Return $Ram2
EndFunc   ;==>GetRAM

; Get free hard drive space.
Func GetFree()
    $freevar = DriveSpaceFree("C:")
    $free1 = StringSplit($freevar, ".")
    $free2 = $free1[1] & " MB"
    Return $free2
    ConsoleWrite($free2 & @CRLF)
EndFunc   ;==>GetFree

Func GetGateway()
    $obj = ObjGet("winmgmts:{impersonationLevel = impersonate}!\\" & "." & "\root\cimv2")
    $list = $obj.ExecQuery("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True", "WQL", 0x30)
    If IsObj($list) Then
        For $subobject In $list
            If $subobject.IPAddress(0) == @IPAddress1 Then
                $result = $subobject.DefaultIPGateway(0)
            EndIf
        Next
        Return $result
    EndIf
    Return SetError(1, 0, $result)
EndFunc   ;==>GetGateway

Func ComputerNameAndModel()
    Local $aReturn[2] = ["(Unknown)", "(Unknown)"], $oColItems, $oWMIService
    $oWMIService = ObjGet("winmgmts:\\.\root\cimv2")
    $oColItems = $oWMIService.ExecQuery("Select * From Win32_ComputerSystemProduct", "WQL", 0x30)
    If IsObj($oColItems) Then
        For $oObjectItem In $oColItems
            $aReturn[0] = $oObjectItem.Name
            $aReturn[1] = $oObjectItem.IdentifyingNumber
        Next
;~      ConsoleWrite("Model: " & $aReturn[0] & @CRLF & "Serial: " & $aReturn[1] & @CRLF)
        Return $aReturn
    EndIf
    Return SetError(1, 0, $aReturn)
EndFunc   ;==>ComputerNameAndModel

Func GetAllPrinters()
    $oWSN = ObjCreate("WScript.Network")
    $oPrt = $oWSN.EnumPrinterConnections
    For $i = 0 To $oPrt.Count - 1 Step 2
        If $defPrtNm = $oPrt($i + 1) Then
            $pm = ".=> "
            $InpDef = ($i + 2) / 2
        Else
            $pm = ".   "
        EndIf
        $prtList = $prtList & @CRLF & ($i + 2) / 2 & $pm & $oPrt($i + 1)
    Next
    If $prtList = "" Then
        $prtList = "No Printers to display."
    EndIf
    Return $prtList
EndFunc   ;==>GetAllPrinters
Edited by blckpythn
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...