Skip to content

PowerShell Core 6 compatibility with existing Windows PowerShell

If you use PowerShell Core, you might miss the power of some native Windows PowerShell Modules! Microsoft released a Module to fill this gap: WindowsCompatibility

You can install theWindowsCompatibility module directly from the PowerShell Gallery:

Install-Module -Name WindowsCompatibility -AllowPrerelease

Now you will have a few options:

Get-Command -module WindowsCompatibility

Here is a quick example of the ActiveDirectory Module (part of the Remote Server Administration Tools):

Import-WinModule ActiveDirectory
Get-Command -module ActiveDirectory

The example will open a PowerShell Session from you Core to the installed Windows Powershell and you will have access to all installed Modules on the local system!

PowerShell Core to Windows PowerShell
PowerShell Core to Windows PowerShell

If you would like to access a remote Windows PowerShell, here is how to do that:

$PWSHCred = (Get-Credential)
Initialize-WinSession -ComputerName DC01 -Credential $PWSHCred
Import-WinModule ActiveDirectory
Get-Command -module ActiveDirectory

This will do the same as the first example, but it will use Remote PowerShell on the Computer DC01 to load the Windows PowerShell Module. The WindowsCompatibility Module will do all the PowerShell Session Handling for you.

This is perfect for Modules that you will not get for PowerShell Core (e.g. Some of the Office 365 related Module like Skype for Business Online Shell, and a few more)!

You will find the Project page on GitHub.

Published inHowTo

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *