How to Get Operating System Details with PowerShell on Windows

In this guide, I will show you how to get details of your operating system using PowerShell on Windows platforms. This works in Windows Desktop and Server environments. The examples show you how to get the operating system name, its architecture (32-bit or 64-bit), and the host machine's name.

Get OS Details using PowerShell

Initiate PowerShell with Administrative Rights

1. Press Win + X and select “Windows PowerShell (Admin)” from the context menu.
2. Click ‘Yes’ in the User Account Control prompt to open PowerShell with elevated privileges.

Get the Operating System Name using PowerShell

Execute the command:

(Get-WMIObject win32_operatingsystem).name

This command fetches and displays the full name of the installed operating system.

Determine the OS Architecture (32-bit or 64-bit)

Run the command:

(Get-WmiObject Win32_OperatingSystem).OSArchitecture

It will return the architecture type of your operating system, indicating whether it’s 32-bit or 64-bit.

Find the Machine Name using PowerShell

Type in the following:

(Get-WmiObject Win32_OperatingSystem).CSName

Result:

Get Operating System Details with PowerShell

This command outputs the name of your computer as recognized on the network.

Frequently Asked Questions

Can these PowerShell commands be used on all versions of Windows?

Yes, these commands are effective on most recent versions of Windows, both for Desktop and Server editions.

Do I need special permissions to run these commands?

You need to run PowerShell with administrative privileges to execute these commands successfully.

Is PowerShell the only way to find these details?

There are multiple ways to find these details, such as through the System Information tool or Control Panel, but PowerShell offers a quick and scriptable approach.

How can I find more detailed system information using PowerShell?

For more detailed information, you can explore additional properties of Win32_OperatingSystem or use other WMI classes like Win32_ComputerSystem.

Can I use these commands in a script for multiple computers?

Yes, these commands can be incorporated into a script to gather information from multiple computers in a network, provided you have the necessary network permissions and access.