Sign in to follow this  
Followers 0
michaelslamet

Getting computer dan user information

5 posts in this topic

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 :)

Share this post


Link to post
Share on other sites



No until I saw your post :P

I'm going to see that, thanks! :)

Share this post


Link to post
Share on other sites

There is a very good >computer info UDF available.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

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