Powershell scripting : GET-WMIOBJECT

Dear All,

From my windows 7 entreprise, I launched this powershell script.

$computer= read-host 'computer name?'
write $computer
(GET-WMIOBJECT win32_operatingsystem -computername $computer).Name;
(GET-WMIOBJECT win32_operatingsystem -computername $computer).OSArchitecture;
(GET-WMIOBJECT win32_bios -computername $computer).SerialNumber;

The result I got is :
Microsoft Windows 7 Entreprise |C:windows|DeviceHarddisk0Partition1
64 bits

How can I get the result like this

ComputerName OS version OS architecture Serial number
modtestjj Microsoft Windows 7 64 bits PB58LNG


does this help?


does this help?

Thks Guy,

But I would like to use the read-host value.
When I add it, it give me nothing



A couple of things, what are you doing with the credential? You are asking for it but not doing anything with it.

Secondly, are you running this as a .ps1 script?

Here is the script using the provided credentials... save it as a .ps1 and just run it.

I am running this as a ps1
If I am working from a computer that does not have admin rights I have to log off then log back in with admin credentials to run the script, correct?.
So, that the reason why I input a log in windows


Share this

Related Posts