Author Posts

November 15, 2016 at 8:37 am


I need your help with get the client OS version and computername name in output to present it in a excel sheet.
I have come so far with this..
$computername = Get-Content C:\Temp\lab_pc.txt
(Get-WmiObject -ComputerName $computername -Class Win32_OperatingSystem).Caption

This will list the OS version in the output but i wanna get OS version and Computername in same list , like

Windows 7 Enterprise labpc01
Windows 7 Enterprise labpc02
Windows 7 Enterprise labpc03

and so on

November 15, 2016 at 9:01 am

Get-WmiObject -ComputerName $computername -Class Win32_OperatingSystem | Select-Object -Property PSComputerName,Caption


Get-WmiObject -Class Win32_OperatingSystem | Select-Object -Property *

you can see which properties this cmdlet delivers and then you just pick what you need

November 15, 2016 at 9:17 am

Thanks Olaf

This works great!


November 15, 2016 at 11:28 am

Use Get-CimInstance rather than Get-WmiObject

November 15, 2016 at 11:41 am

Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $servers | select -Property PScomputername,caption