It's quite simple to find the name of the operating system with PowerShell. The WMI cmdlet GetWmiObject contains a lot of useful information about the environment, there's numerous ways to use the object but here's one method:
(Get-WmiObject Win32_OperatingSystem).name
This should work straight away but for me I encounted some "weird" issues which suggested there were some problems with my Windows installation and specifically the WMI repository. Intially I received the following error: running the above command:
InvalidOperation: (:) [Get-WmiObject], COMException
Here's what I did to fix the problem:
6ff89a00-d8b2-4956-b052-7ba41b2538bc|0|.0