Get the remote machine OS version with PowerShell

Objective : To find OS version of the remote computer from local machine PowerShell .

Solution1 Get-wmiobject cmdlet is available in PowerShell to get the info from remote computer .

Get-WmiObject -Class Win32_OperatingSystem -Namespace root/cimv2 -ComputerName ‘remoteip_or_hostname’

Example

Get-WmiObject -Class Win32_OperatingSystem -Namespace root/cimv2 -ComputerName '192.185.62.70' |fl -Property caption,version,buildnumber

Get-WmiObject -Class Win32_OperatingSystem -Namespace root/cimv2 -ComputerName 'john-pc' |fl -Property caption,version,buildnumber

Solution2 – Another one-line cmdlet solution is based on wmic to get the info. This cmdlet also works on command prompt (cmd).

wmic /node: <ipaddress> os get caption

Example
wmic /node: 192.168.2.70 os get caption

Get the remote machine OS detail with PowerShell

  • Both the commands support only if OS of the remote computer is windows and RPC service is running on the remote computer.
  • BONUS: To get the the OS info copied to your clipboard, use |clip’  at end of the command. “wmic /node: 192.168.2.70 os get caption |clip”. Also read : Copy the PowerShell output to clipboard

By AMARNATH K

AM@RNATH is a Technology specialist primarily focus on Microsoft Technologies & Cloud Security. His certification includes M365 Certified: Enterprise Admin Expert. He loves to explore things from the latest technologies to cooking new recipes. Basically from Chennai, the southern part of India. Lucky son, friendly husband, and a proud father who loves to spend time with his family & friends while the laptop is not in his table.

One thought on “How to find OS detail of remote machine from PowerShell?”

Leave a Reply

Your email address will not be published.