Jump to content

Basic computer info script


Wus
 Share

Recommended Posts

Just a note for you to remember once the next version comes out this code

AutoItSetOption("ProvideRunStdout",1)

Local $foo = Run(@ComSpec & " /c netsh diag show adapter",'',@SW_HIDE)
While 1
    $line = StdoutRead($foo)
    If @error = -1 Then ExitLoop
     Sleep ( 500 )
     $NICkey  = $line
;~     MsgBox(0, "STDOUT read:", $NICkey )
Wend
$niccard = StringTrimRight(StringStripCR(StringStripWS(StringMid( $NICkey , StringInStr($NICkey ,"]")+1),3)),1)

could replace the following:

RunWait("cmd.exe")
MouseMove(1152, 864, 0)
WinWaitActive( "C:\WINDOWS\system32\cmd.exe")
MouseMove(1152, 864, 0)
Send("netsh diag show adapter{enter}")
MouseMove(1152, 864, 0)
WinWaitClose("C:\WINDOWS\system32\cmd.exe - netsh diag show adapter")
MouseMove(1152, 864, 0)
send("!{space}")
MouseMove(1152, 864, 0)
Send("e")
MouseMove(1152, 864, 0)
Sleep(100)
MouseMove(1152, 864, 0)
Send("s")
MouseMove(1152, 864, 0)
Sleep(150)
MouseMove(1152, 864, 0)
Send("{enter}")
MouseMove(1152, 864, 0)
Sleep(150)
MouseMove(1152, 864, 0)
send("!{space}")
Sleep(150)
MouseMove(1152, 864, 0)
send("c")
$networkcard = ClipGet()
$files = FileOpen( "temp.txt", 2)
FileWrite( $files, $networkcard)
Fileclose( $files)
FileOpen( "$files", 0)
$NICfull = FileReadLine( "temp.txt", 6)
$niccard = RegRead( "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & $NICkey, "driverdesc")

Did notice it's displaying my old video card which was an All-in Wonder 128 Pro, now have

RADEON 7500 series

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

version 15 fixed the nasty cmd thing i had earlier... that @comspec command looks real useful

at the moment it looks here in the registry and seachches for the value of the "driverdesc"

HKEY_LOCAL_MACHINE\SYSTEM\\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000

Im curious if perhaps this

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\0000

is a better place to look...

or perhaps is you new card the last one of the 000X's

i could come up with a scheme to fix it if I could look a bunch of different comps registries...

maybe if you post where the correct location is in your registry and then tell me how many different sets there are (ie... ,0000, 0001, 0002, 0003....)

btw what exactly does

AutoItSetOption("ProvideRunStdout",1)

do .. it isnt in my help file

Link to comment
Share on other sites

Guest Chaos2

For those of you using Autoit w/COM:

It use COM to get all info except Nic card.

I have not found a way to get the rigth info from COM about nic card,

but working on it.

Just want to show what COM can be used for :)

Pcinfo.au3

Link to comment
Share on other sites

That will redirect stdout, that's in the beta version currently

as for the registry it's the same in both locations

mine lists 0000,0001,0002 and 0002 is the one that is currently in my system.

If I remember tomorrow i'll look at my perl code to see what location it's retreiving the information from.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Yeah I think that the last installed device has the highest numbered key so ill put in a some stuff to use the highest numbered key...

Im just using this script to learn autoIT... Im planning onmaking a script very similar to yours in kixscript using wmi's.

Link to comment
Share on other sites

For those of you using Autoit w/COM:

It use COM to get all info except Nic card.

I have not found a way to get the rigth info from COM about nic card,

but working on it.

Just want to show what COM can be used for  :)

<{POST_SNAPBACK}>

might try something like this

;
; Test File
;
; Use WMI to collect network adapter(s)  information


$objcol=ObjGet("winmgmts:")

$instance=$objcol.instancesof("Win32_NetworkAdapter")

if @error then
    Msgbox (0,"","error getting object. Error code: " & @error)
    exit
endif
$status = StringSplit("Disconnected,Connecting,Connected,Disconnecting,Hardware not present,Hardware disabled,Hardware malfunction,Media disconnected,Authenticating,Authentication succeeded,Authentication failed",",")


$string = ""
FOR $Adapter IN $instance
    If($status[$Adapter.NetConnectionStatus + 1] == "Connected") Then
        $string = $string & "Adapter: " & $Adapter.productname & @CRLF & _ 
                            "Service Name: " & $Adapter.servicename & @CRLF & _ 
                                  "Connection Status : " & $status[$Adapter.NetConnectionStatus + 1] & @CRLF & _ 
                                  "MAC Address: " & $Adapter.macaddress & @CRLF
    EndIf
NEXT

msgbox(0,"test","information: " & @CRLF & $string)
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

and here's one on the Video adapter

;
; Test File
;
; Use WMI to collect video controller information


$objcol=ObjGet("winmgmts:")

$instance=$objcol.instancesof("Win32_VideoController")

if @error then
    Msgbox (0,"","error getting object. Error code: " & @error)
    exit
endif


$string = ""
FOR $VidAdapter IN $instance
        $string = $string & "Adapter: " & $VidAdapter.description & @CRLF & _
                            "RAM: " & $VidAdapter.adapterram & @CRLF & _ 
                                  "Max Refresh Rate: " & $VidAdapter.maxrefreshrate & @CRLF & _ 
                                  "Min Refresh Rate: " & $VidAdapter.minrefreshrate
NEXT

msgbox(0,"test","information: " & @CRLF & $string)
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

  • 1 month later...

might try something like this

;
; Test File
;
; Use WMI to collect network adapter(s)  information
$objcol=ObjGet("winmgmts:")

$instance=$objcol.instancesof("Win32_NetworkAdapter")

if @error then
    Msgbox (0,"","error getting object. Error code: " & @error)
    exit
endif
$status = StringSplit("Disconnected,Connecting,Connected,Disconnecting,Hardware not present,Hardware disabled,Hardware malfunction,Media disconnected,Authenticating,Authentication succeeded,Authentication failed",",")
$string = ""
FOR $Adapter IN $instance
    If($status[$Adapter.NetConnectionStatus + 1] == "Connected") Then
        $string = $string & "Adapter: " & $Adapter.productname & @CRLF & _ 
                            "Service Name: " & $Adapter.servicename & @CRLF & _ 
                                  "Connection Status : " & $status[$Adapter.NetConnectionStatus + 1] & @CRLF & _ 
                                  "MAC Address: " & $Adapter.macaddress & @CRLF
    EndIf
NEXT

msgbox(0,"test","information: " & @CRLF & $string)

<{POST_SNAPBACK}>

Im a lil slow on the uptake, just got to actually starting to get what this meant...

curious tho... doesnt this only list on the details for the adapters that have a status of "connected"?

Id really appreciate it if you could explain this lil bit of script a bit more... I dont understand what you did with that array and why...

Link to comment
Share on other sites

  • 2 months later...

For those of you using Autoit w/COM:

It use COM to get all info except Nic card.

I have not found a way to get the rigth info from COM about nic card,

but working on it.

Just want to show what COM can be used for  :whistle:

<{POST_SNAPBACK}>

Hello i like this script from chaos2...

; ----------------------------------------------------------------------------
;
; 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")

For $object in $colCPU
    $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

MsgBox("","PcInfo",$PcInfo)

But i wanna write the results in a pcinfo.txt file.

How can i do that please?

I tried this but the results are only written to the clipboard...

ClipPut ( $PcInfo)

$filename = FileOpen( $PcInfo & "PcInfo.txt", 2)
FileWrite( $filename, $PcInfo)
Fileclose( $filename )

Sorry i found it already

ClipPut ( $PcInfo)

$filename = FileOpen( "PcInfo.txt", 2)
FileWrite( $filename, $PcInfo)
Fileclose( $filename )
Edited by Mosquitos

Sapiente vince, rex, noli vincere ferro!

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