Jump to content
DigDeep

Computer Info from Powershell

Recommended Posts

DigDeep

@water, your post from here is of good help.

There are few details which are appearing as blank. Could you please help on this?

$Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF

 

Share this post


Link to post
Share on other sites
Nessie

Maybe you want to know the install date of the operating system?


My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Share this post


Link to post
Share on other sites
Andreik

You can read this info directly from registry

#include <Date.au3>

MsgBox(0,'',_DateAdd('s',RegRead('HKLM' & ((@OSArch='X64')?('64'):('')) & '\SOFTWARE\Microsoft\Windows NT\CurrentVersion','InstallDate'),'1970/01/01 00:00:00'))

 


When the words fail... music speaks

Share this post


Link to post
Share on other sites
DigDeep

@Nessie, Yes.

@Andreik, I have already got all the required results coming through the registry side.

But I am seeing some of the features read from the registry is not appearing correctly on the New Models. Now this is working fine all almost all but regread doesn't on few. Looks like, this needs to be also checked by AutoIT forum.

So, I am trying to get all system details reporting in msinfo32 via the PowerShell.

Share this post


Link to post
Share on other sites
JLogan3o13

Well you are referencing a post from 8 years ago, not exactly shocked that it isn't working. How about posting the exact script you're using


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
iamtheky

If you are going to ask autoit to ask powershell to ask msconfig to ask wmi, why not just ask wmi?

wmic CSPRODUCT GET NAME

or in computersystem with these two:

WMIC COMPUTERSYSTEM GET MODEL
WMIC COMPUTERSYSTEM GET MANUFACTURER

 

Edited by iamtheky
  • Like 1

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
DigDeep

Ok, it's fixed now.

I had to get it changed

from:

"SELECT * FROM Win32_ComputerSystem"

to:

"SELECT * FROM Win32_OperatingSystem"

Global $GetInstallDate


$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$ComputerName = "localhost"

$Output=""
$objWMIService = ObjGet("winmgmts:\\" & $ComputerName & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
                                        $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
        $GetInstallDate = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
        $Output=""
   Next
Else
;~    Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystemProduct" )
Endif


Func WMIDateStringToDate($dtmDate)
    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" &  StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc


MsgBox(0, '', $GetInstallDate)

 

Share this post


Link to post
Share on other sites
iamtheky

same thing on the cli. wmic seems to retrieve faster.  quicker to write as well if you only need one or two things and you can reuse the date formatter because its the same stuff.

$iPid = Run("WMIC OS GET InstallDate" , @ScriptDir , @SW_HIDE , 0x2)

$sOut = ""

Do
    $sOut &= StdoutRead($iPID)
Until @error

msgbox(0, '' , WMIDateStringToDate(stringtrimleft($sOut , 30)))



Func WMIDateStringToDate($dtmDate)
    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" &  StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc

 

 

 


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.