# Help with Get OS version

**URL:** <https://forums.powershell.org/t/help-with-get-os-version/7531>\
**Category:** PowerShell Help\
**Created:** [November 15, 2016, 3:07am UTC](https://forums.powershell.org/t/help-with-get-os-version/7531 "2016-11-15T03:07:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![windows-liveuser63](https://avatars.discourse-cdn.com/v4/letter/w/9dc877/32.png) [@windows-liveuser63](https://forums.powershell.org/u/windows-liveuser63)\
**Post date:** [November 15, 2016, 3:07am UTC](https://forums.powershell.org/t/help-with-get-os-version/7531/1 "2016-11-15T03:07:17Z")

</div>

Hi

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

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [November 15, 2016, 3:31am UTC](https://forums.powershell.org/t/help-with-get-os-version/7531/2 "2016-11-15T03:31:17Z")

</div>

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

with

```
Get-WmiObject -Class Win32_OperatingSystem | Select-Object -Property *
```
 you can see which properties this cmdlet delivers and then you just pick what you need

---

<div class="post-metadata">

**Author:** ![windows-liveuser63](https://avatars.discourse-cdn.com/v4/letter/w/9dc877/32.png) [@windows-liveuser63](https://forums.powershell.org/u/windows-liveuser63)\
**Post date:** [November 15, 2016, 3:47am UTC](https://forums.powershell.org/t/help-with-get-os-version/7531/3 "2016-11-15T03:47:07Z")

</div>

Thanks Olaf

This works great!

🙂

---

<div class="post-metadata">

**Author:** ![richard-siddaway](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@richard-siddaway](https://forums.powershell.org/u/richard-siddaway)\
**Post date:** [November 15, 2016, 5:58am UTC](https://forums.powershell.org/t/help-with-get-os-version/7531/4 "2016-11-15T05:58:27Z")

</div>

Use Get-CimInstance rather than Get-WmiObject

---

<div class="post-metadata">

**Author:** ![rajneeshkumaryadav](https://avatars.discourse-cdn.com/v4/letter/r/71c47a/32.png) [@rajneeshkumaryadav](https://forums.powershell.org/u/rajneeshkumaryadav)\
**Post date:** [November 15, 2016, 6:11am UTC](https://forums.powershell.org/t/help-with-get-os-version/7531/5 "2016-11-15T06:11:18Z")

</div>

Get-CimInstance -ClassName Win32\_OperatingSystem -ComputerName $servers | select -Property PScomputername,caption

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:40pm UTC](https://forums.powershell.org/t/help-with-get-os-version/7531/6 "2024-05-16T20:40:01Z")

</div>

Closed on May 16, 2024, 8:40pm UTC


