Sign in to follow this  
Followers 0
Britbadboy

System Information

15 posts in this topic

Hi there,

am coding a script to install a program remotely. What i want to know is when istalling is it possible to get the user information about the pc.

E.g. date, time, userID etc on that machine.

Also once I have collected this information I want to save it as a .doc file on a networked drive so I can extract the information later at my convinience from there. How do I write the information on this file?

Please guide me on how to go about this.

Many thanks.

Share this post


Link to post
Share on other sites



Maybe this

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1++
; Author: Chaos2 
; Script Function:  output basic hardware info
;
; ----------------------------------------------------------------------------

$objWMIService = objget("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

$colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
$colMemory = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
$colCPU = $objWMIService.ExecQuery("Select * from CIM_Processor")
$colVideoinfo = $objWMIService.ExecQuery("Select * from Win32_VideoController")
$colSound = $objWMIService.ExecQuery("Select * from Win32_SoundDevice")
$colMouse = $objWMIService.ExecQuery("Select * from Win32_PointingDevice")
$colMonitor = $objWMIService.ExecQuery("Select * from Win32_DesktopMonitor")
$colNIC = $objWMIservice.ExecQuery("Select * from Win32_NetworkAdapter WHERE Netconnectionstatus = 2")
Dim $pcinfo


For $object in $colCPU
    $PcInfo = $pcinfo & StringStripWS($object.Name,1) & @CRLF
Next

For $objOperatingSystem in $colSettings 
    $PcInfo = $PcInfo & $objOperatingSystem.Caption & " Build " & $objOperatingSystem.BuildNumber & " Servicepack " & $objOperatingSystem.ServicePackMajorVersion & "." & $objOperatingSystem.ServicePackMinorVersion & @CRLF
    $PcInfo = $PcInfo & "Available Physical Memory: " & String(Int(Number($objOperatingSystem.FreePhysicalMemory) / 1024)) & " Mb" & @CRLF
Next

For $object in $colMemory
    $PcInfo = $PcInfo & "Total Physical Memory: " & String(Int(Number($object.TotalPhysicalMemory) / (1024 * 1024))) & " Mb" & @CRLF
Next

$objFSO = objCreate("Scripting.FileSystemObject")
$colDrives = $objFSO.Drives

$Opticaldrives = "Opticaldrives : " 

For $object in $colDrives
    If ($object.DriveType == 2) then
        $PcInfo = $PcInfo & "Total space on : " & $object.DriveLetter & ":\  (" & $object.VolumeName & ")  = " & String(Round((Number($object.TotalSize) / (1024 * 1024 * 1024)),2)) & " Gb" & @CRLF
        $PcInfo = $PcInfo & "Free space on  : " & $object.DriveLetter & ":\  (" & $object.VolumeName & ")  = " & String(Round((Number($object.FreeSpace) / (1024 * 1024 * 1024)),2)) & " Gb" & @CRLF
    Else
        $Opticaldrives = $Opticaldrives & $object.DriveLetter & ":\ "
    EndIf
Next

$PcInfo = $PcInfo & $Opticaldrives & @CRLF

For $object in $colVideoinfo
    $PcInfo = $PcInfo & "Video card: " & $object.Description & @CRLF
Next

For $object in $colSound
    $PcInfo = $PcInfo & "Sound device: " & $object.Description & @CRLF
Next

For $object in $colMouse
    $PcInfo = $PcInfo & "Mouse : " & $object.Description & @CRLF
Next

For $object in $colMonitor
    $PcInfo = $PcInfo & "Monitor : " & $object.Description & @CRLF
Next

For $object in $colNIC
    $Pcinfo = $pcinfo & $object.name & @CRLF
Next
ClipPut( $pcinfo )
MsgBox(48,"PCinfo",$PcInfo)
MsgBox( 48, "PCinfo", "Information was copied to clipboard", 5)

works great

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

please if you don't mind explain this to me?

it doesn't even work, the following erroe is displayed!

Share this post


Link to post
Share on other sites

You didn't copy it right. The ; means that the line is a comment. Copy the WHOLE thing, including the white space at the top, and it will work.

Share this post


Link to post
Share on other sites

ok now that I have looked into myself, can someone only tell me how do i use macros?!

Share this post


Link to post
Share on other sites

What about them? That question wasn't very specific.

Share this post


Link to post
Share on other sites

You didn't copy it right. The ; means that the line is a comment. Copy the WHOLE thing, including the white space at the top, and it will work.

copied it again and tried running it again too, here is what the error log says:

>"C:\Program Files\AutoIt3\SciTe\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "F:\AutoIT Files\systeminformation.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams

>Running AU3Check...C:\Program Files\AutoIt3\SciTe\Defs\Unstable\Au3Check\au3check.dat

>AU3Check Ended. No Error(s).

>Running: (3.1.1.0):C:\Program Files\AutoIt3\autoit3.exe "F:\AutoIT Files\systeminformation.au3"

F:\AutoIT Files\systeminformation.au3 (14) : ==> Unable to parse line.:

$colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

$colSettings = $objWMIService.E^ ERROR

>AutoIT3.exe ended.

>Exit code: 0 Time: 1.339

Share this post


Link to post
Share on other sites

In autoit help file it details as follows:

AutoIt has an number of Macros that are special read-only variables used by AutoIt. Macros start with the @ character instead of the usual $ so are easy to tell apart. As with normal variables you can use macros in expressions but you cannot assign a value to them.

The pre-defined macros are generally used to provide easy access to system information like the location of the Windows directory, or the name of the logged on user.

Go here for a complete list.

with the bit in orange being the eaxt thing i need to get! so how do i use these macros is my question.

Share this post


Link to post
Share on other sites

well I do have scite and am using it at the moment. What am confused about e.g. is if i use @UserName which gives me the information about the current user logged on. How do I use it? Then how do i open up a text file and save the information there?

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

FileWriteLine ("yourfile.txt", @UserName)

Smoke help me out here, I'm not sure exactly what he's asking for.

Edited by greenmachine

Share this post


Link to post
Share on other sites

sorry it must be the time of the night thats getting on my nerves too.

Well to write all this information i need to create a file then write this information on it.

so i tried using Fileopen and filecreate but stuck again!

Please tell me how do I use these functions?

Share this post


Link to post
Share on other sites

Just read the helpfile. Please.

Share this post


Link to post
Share on other sites

any easy way to get directX version in this to?

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