Help with Get OS version

This topic contains 4 replies, has 4 voices, and was last updated by Profile photo of Rajneesh Rajneesh 2 weeks, 5 days ago.

  • Author
    Posts
  • #57685
    Profile photo of ohlssrog
    ohlssrog
    Participant

    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

  • #57686
    Profile photo of Olaf Soyk
    Olaf Soyk
    Participant
    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

  • #57689
    Profile photo of ohlssrog
    ohlssrog
    Participant

    Thanks Olaf

    This works great!

    🙂

  • #57701
    Profile photo of Richard Siddaway
    Richard Siddaway
    Moderator

    Use Get-CimInstance rather than Get-WmiObject

  • #57710
    Profile photo of Rajneesh
    Rajneesh
    Participant

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

You must be logged in to reply to this topic.