8

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.

4

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
  • The session stuff is not necessary if you're already in a remote session you entered via Enter-PSSession so I suggested an edit. – Warren P Oct 8 '15 at 13:28
3

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
  • That's a nice improvement. – Warren P Oct 7 '15 at 17:48
2

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!

  • Very tiny amount of information in Get-WindowsEdition -Online reports only back Professional - does it report back Nano for nano server? – Warren P Aug 16 '18 at 3:03
-1

PowerShell Administrative command prompt and typing:

 Get-WmiObject -Class Win32_Operatingsystem

Returns:

Build Number and Version
  • No way to see if that's nano or not – Warren P Aug 16 '18 at 3:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.