Is it possible to get a windows-version from a powershell command on Windows Server 2016 Nano?

I'm using the latest preview of Windows Server 2016 nano.

Using a remote powershell session, I connect to the remote system via Enter-PSSession, and then I tried to use the most common techniques to check Windows versions, because the full .Net framework is not available. Also, Get-WmiObject cmdlet is not available.

The only way I can see SOME information is with this non-powershell-command DISM:

Dism /Online /Get-Feature

That gives me this output plus a list of installed features:

Deployment Image Servicing and Management tool
Version: 10.0.10514.0

Image Version: 10.0.10514.0

Features listing for package : Microsoft-Windows-Foundation-Package~31bf3856ad364e35~amd64~~10.0.10514.0

From the 10514 value, which is higher than my Windows 10 desktop, I can get some idea of the Kernel Build, and it is interesting that Windows 10 desktop has the same "Microsoft-Windows-Foundation-Package", but a lower kernel build number.

Has anyone found a cmdlet or some powershell function or alias that could be written, that will either detect for me the fact that my powershell script is running on a nano-server, in some way which is unlikely to break, or any command which will actually print out "Windows Server 2016 Nano Server"?

Update: This is closer to what I want, but is a bit of a hack:

  Get-Item -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion'

Update 2: Get-WmiObject is not present, and while the following works, it only reports kernel version:

[System.Environment]::OSVersion.Version

Above will report build 10514, whereas Windows 10 client operating systems RTM reports 10240 at the moment, but the above is really a "kernel build" not an operating system product/edition/service-pack-level.


You could try the following, I've not got a nano server to try it out on. Drop the select if it gets you something else and see if what you want is stored under a different property in Server 2016 Nano

Get-CIMInstance -ClassName Win32_OperatingSystem -Property * | select caption

When tested on a real Nano instance the -session parameter was not needed, but if you need it at some future date, here's the variant with -session:

$cuser = "Your username"
$cservername = "Your Servername"
$csession = New-CimSession –Credential $cuser –ComputerName $cservername
Get-CIMInstance –session $csession -ClassName Win32_OperatingSystem -Property * | select caption

This is just an extension on your edit, but cleans up the output, by getting only ProductName

$(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion' ProductName).ProductName

The Microsoft way aka the Cert way is to use the Get-WindowsEdition -Online

additional information on the command and all its options can be found at Here!