This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Applies to: Windows Server 2016
Important
On October 9, 2018, support for theNano Server installation option ended. Starting in Windows Server, version 1709, Nano Server is available only as acontainer base OS image. Check outChanges to Nano Server to learn what this means.
Starting with version 5.1, PowerShell is available in different editions which denote varying feature sets and platform compatibility.
The running edition of PowerShell is shown in the PSEdition property of $PSVersionTable.
$PSVersionTableName Value---- -----PSVersion 5.1.14300.1000PSEdition DesktopPSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}CLRVersion 4.0.30319.42000BuildVersion 10.0.14300.1000WSManStackVersion 3.0PSRemotingProtocolVersion 2.3SerializationVersion 1.1.0.1
Module authors can declare their modules to be compatible with one or more PowerShell editions using the CompatiblePSEditions module manifest key. This key is only supported on PowerShell 5.1 or later.
New-ModuleManifest -Path .\TestModuleWithEdition.psd1 -CompatiblePSEditions Desktop,Core -PowerShellVersion 5.1$moduleInfo = Test-ModuleManifest -Path \TestModuleWithEdition.psd1$moduleInfo.CompatiblePSEditionsDesktopCore$moduleInfo | Get-Member CompatiblePSEditions TypeName: System.Management.Automation.PSModuleInfoName MemberType Definition---- ---------- ----------CompatiblePSEditions Property System.Collections.Generic.IEnumerable[string] CompatiblePSEditions {get;}
When getting a list of available modules, you can filter the list by PowerShell edition.
Get-Module -ListAvailable | ? CompatiblePSEditions -Contains Desktop Directory: C:\Program Files\WindowsPowerShell\ModulesModuleType Version Name ExportedCommands---------- ------- ---- ----------------Manifest 1.0 ModuleWithPSEditionsGet-Module -ListAvailable | ? CompatiblePSEditions -Contains Core | % CompatiblePSEditionsDesktopCore
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.
Set-Content C:\script.ps1 -Value #requires -PSEdition CoreGet-Process -Name PowerShellGet-Content C:\script.ps1#requires -PSEdition CoreGet-Process -Name PowerShellC:\script.ps1C:\script.ps1 : The script 'script.ps1' cannot be run because it contained a #requires statement for PowerShell editions 'Core'. The edition of PowerShell that is required by the script does not match the currently running PowerShell Desktop edition.At line:1 char:1+ C:\script.ps1+ ~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (script.ps1:String) [], RuntimeException + FullyQualifiedErrorId : ScriptRequiresUnmatchedPSEdition
Nano Server includes PowerShell Core by default in all Nano Server installations. PowerShell Core is a reduced footprint edition of PowerShell that is built on .NET Core and runs on reduced footprint editions of Windows, such as Nano Server and Windows IoT Core. PowerShell Core functions in the same way as other editions of PowerShell, such as Windows PowerShell running on Windows Server 2016. However, the reduced footprint of Nano Server means that not all PowerShell features from Windows Server 2016 are available in PowerShell Core on Nano Server.
Windows PowerShell features not available in Nano Server
Set-PSSessionConfiguration
)You can manage Nano Server as target nodes with Windows PowerShell Desired State Configuration (DSC). Currently, you can manage nodes running Nano Server with DSC in push mode only. Not all DSC features function with Nano Server.
For full details, seeUsing DSC on Nano Server.
Was this page helpful?
Was this page helpful?