Get OS Name with PowerShell

16. April 2015

If you need the name of the operation system for any kind of filter use this:

(Get-WMIObject Win32_OperatingSystem).name


Result:
Microsoft Windows 7 Enterprise |C:\Windows|\Device\Harddisk0\Partition1

Possible filter for any kind of script:

$os = (Get-WMIObject Win32_OperatingSystem).name

if ($os -like "*Windows 7*")
    {
    }

PowerShell Version: 4
Modules: none

#PowerShell

Leave a Reply

Your email address will not be published. Required fields are marked *


*