PowerShell version 5.1 will be available in different editions which provide different feature sets and platform compatibility:
- Desktop edition (Full Server & Server Core)
Built on (full) .NET Framework and provides compatibility with scripts and modules targeting versions of PowerShell running on full footprint editions of Windows such as Server Core and Windows Desktop.
- Core edition (Nano Server)
Built on .NET Core (CoreCLR) and provides compatibility with scripts and modules targeting versions of PowerShell running on reduced footprint editions of Windows such as Nano Server and Windows IoT.
You can verify the edition of PowerShell in the PSEdition property of the automatic variable $PSVersionTable.
What will work?
The idea is to provide all the essentials cmdlets and features that you are using on the Full PowerShell.
PowerShell Core will offer full PowerShell language compatibility, pipeline support, redirection support, PS remoting capabilities, remote debugging, etc…
Functions based on .NET and compatible with .NET Core will work.
Cmdlets of type C#, Script and CIM are also supported.
What will not work?
Since Nano Server targets Cloud Infrastructure roles (compute, storage, network) and “born in the cloud” applications, all other unnecessary or irrelevant components are removed from the OS.
The reduced footprint of Nano Server means that not all PowerShell features from Windows Server 2016 (Full and Server Core) are available in PowerShell Core on Nano Server.
That has its impact on application compatibility and features (like PowerShell) but also its capabilities (like PS Workflows, WMI).
For this reason PowerShell needed to be refactored for Nano Server.
Here are some examples of unavailable functionality:
- Get-WMIObject is not supported and should be replaced by the Get-CIMInstance cmdlet.
- PS Workflows are not available due to the dependency on Windows Workflow Foundation (WF).
- Not all Desired Stare Configuration (DSC) features will function on Nano Server. Currently, you can manage nodes running Nano Server with DSC in push mode only.
- Some modules will still be missing. – However, most (refactored) modules should be available, including PackageManagment which is crucial for installing additional components.
You can find a list of what is not working in Windows Server 2016 TP5 here.
As Nano Server is still evolving on a weekly basis, we will have to sit this one out and see what RTM will bring for unavailable PowerShell features.
Module authors can declare their modules to be compatible with one or more PowerShell editions using the CompatiblePSEditions module manifest key (inside a .psd1 module manifest).
NOTE: This key is only supported on PowerShell 5.1 or later.
New-ModuleManifest -Path .\TestModuleWithEdition.psd1 -CompatiblePSEditions Desktop,Core -PowerShellVersion 5.1
Script authors can prevent a script from executing unless it is run on a compatible edition of PowerShell using the PSEdition parameter on a #requires statement.
#requires -PSEdition Core
Desired State Configuration (DSC)
Nano Server can be managed as target node with Windows PowerShell Desired State Configuration (DSC).
Currently, you can manage nodes running Nano Server with DSC in push mode only.
Also not all DSC features will function with Nano Server.
Desired State Configuration (DSC) on Nano Server is an optional package in the
NanoServer\Packages folder of the Windows Server 2016 media and can be installed post-installation using DISM or PowerShellGet.
For more information:
- PowerShell on Nano Server
- PowerShell Desired State Configuration (DSC) on Nano Server
- Developing PowerShell Cmdlets for Nano Server using the PowerShell Core SDK