Programmatically Find all operating systems installed on a computer using Powershell or Command Prompt

1.8k views Asked by At

I need to programmatically verify that only Windows 10 is installed on a computer.

This information is manually available in Windows 10 by navigating to Advanced System Settings >> Advanced Tab >> Settings in Startup and Recovery Section >> Opening the drop down menu "Default operating system

Perhaps there is a way using the BCDedit command line tool.

1

There are 1 answers

1
cet51 On

I don't know much concerning having multiple operating systems, but if you want a PowerShell answer to view the current windows OS...

Get-WmiObject -Class Win32_OperatingSystem

^ This will return some general info about the OS

Get-WmiObject -Class Win32_OperatingSystem | select *

^ This will select all the properties available from the Win32_OperatingSystem class that has a fair amount of information to look through

(Get-WmiObject -Class Win32_OperatingSystem).Caption

^ This will get the name of the specific OS installed