I'm just wondering what I would need to do to import the Active Directory module into Powershell Core. I tried Import-Module ActiveDirectory but I'm sure there is more needed.
> $PSVersionTable
$PSVersionTable
Name Value
---- -----
PSVersion 6.0.0
PSEdition Core
GitCommitId v6.0.0
OS Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jan 11 22:59:40 PST 2018; root:xnu-3789.73.8~1/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
The AD module doesn't work in Core. I believe teams responsible for existing modules that work on Windows PowerShell are working on new versions but they are not yet available.
You should be able to work around this though if you are able to create a session to a remove Windows machine that has the module installed. A Windows 7 machine with RSAT installed for example.
powershell
Import-PSSession -Session (New-PSSession -ComputerName WindowsServer01) -Module Import-Module ActiveDirectory
From this point you can run the AD cmdlets from Core but they are actually being executed on the remote computer.
I can confirm that ActiveDirectory module is not compatible with PowerShell Core at all and we have to wait new ActiveDirectory module version.
Just wondering if a new ActiveDirectory module version has been created? Would love to be able to use PsLoggedon on a Mac.
@davidmthomsen The PowerShell team have been working with the AD team on it. @SteveL-MSFT demoed a PowerShell Core native version of the ActiveDirectory module in the May PowerShell Community Call. As far as I know, it has not been released yet. Also, it may only be available on Windows as the APIs for DirectoryServices in .NET Core are only available in the Windows Compatibility Pack. It might be that way until .NET Core includes a x-plat implementation. Steve might have more info on that.
@SteveL-MSFT has there been any headway on this in the last month? When I try to import the active directory module I have no luck, just errors
@jdogg89 what build of Win10 are you using and what build of PSCore6.1?
@SteveL-MSFT i can't import ActiveDirectory in Windows 7 Build 7601. I got the same error
@luizhap that's correct. Windows 7 won't get this feature with PowerShell Core.
New Windows 10 Client and Servers supported moving forward.
FYI - Windows 7 EOL (End-Of-Life), support ends on January 14th 2020
:)
For those that want to use ActiveDirectory module on Windows older than the Oct 2018 update with PSCore6, you can use https://www.powershellgallery.com/packages/WindowsCompatibility
Is this still not available in PS Core? I see the GA of the Windows Compatibility Module, but wondering if this is available straight up in PS Core yet. Also, is there a place where we can check compatibility of modules with PS Core? I see lots MS blog posts touting compatibility numbers, but no links to something that shows what’s been converted, when, and what remains.
I was trying to run the ps core docker image based on Ubuntu to run this in kubernetes. It was impossible to import the AD modules and make what I wanted to work so I just shelfed my work on this... Maybe you can import the AD module now...
@jdogg89 I have this working now on PS Core on Ubuntu 16.04 but it’s kludgy as hell. :) WinRM/SSH into a DC, run “PowerShell” to get a full PowerShell .NET, then run the AD cmdlets (this is part of our Terraform process with a custom AD provider).
To port a module it is necessarily to port underlying APIs. Currently .Net Core haven't ported APIs for LDAP and it is impossible to port AD module.
If an API already ported each product group makes a decision about porting their module - there is no general plan.
For me it’s less about timeline as far as forecasting future than when something was ported over historically and at what version number, so we can make sure we haven’t missed anything and upgrade. Also would be super helpful to see what has been ported and what hasn’t so we can keep track of that as things are ported over.
@rayterrill if you want to use the AD Module from Linux, you can install SSH on Windows, then establish the PSSession, and use Import-PSSession to have proxy cmdlets you run locally on your Linux machine. With PSCore6.1 as the SSH endpoint (rather than Windows PowerShell).
@joeyaiello perhaps you can author a blog post on the specific modules that work on what build of Windows
@SteveL-MSFT I'll look into. We're currently doing something similar - WinRM'ing into a Windows machine with PSCore6.1 as the SSH endpoint, then running powershell 'WHATEVER WE WANT TO RUN' in the context of that PSCore6.1/SSH session so it runs under full .NET powershell vs PSCore. Kludgy, but it works currently.
Would love a blog post from @joeyaiello or anyone else on the specific modules that work and on what build of windows - even0 just the BIG ones that DON'T currently work and the workarounds you need to do to make them work would be ideal for our use case (thinking AD, DNS, etc).
@SteveL-MSFT Has there been any news to AD on powershell core? Or PS7? We tried with PS7rc2 on centos8 but couldn't get it to work. We have added windows compatibility, see the AD module but it won't install. Any tips to that? Thanks! (we would like standalone AD access from a linux VM, no windows available there, except the AD box, which is managed and we don't have access to it).
The Active Directory module works fine natively in PowerShell 7 RC in Windows. The AD Deployment module does NOT work natively, but works fine using the Win32 Compat solution. I have tested both extensively for a book I am working on. To use the module on Linux tou need to remote in to a DC.
thanks @doctordns Won't work for us, we can't remote into the DC. We won't get access to PS on that managed AD. So we need a native AD solution that runs on Linux. Our use-case is very simple. We want to create a new user in AD from a linux VM.
This is where you need JEA. With JEA, you:
Once set up, you can use Invoke-Command or Enter-PSSession and have a session restricted to the commands you are allowed.
Or why not just use Linux virtualisation, and create/run a Windows Server and run the tools from there.
@doctordns
JEA is a good tool!
But, unless I'm mistaken, I understand that JEA it's only for Windows PowerShell.
I haven't heard anything about the efforts to convert/migrate to PowerShell Core.
:)
I keep forgetting JEA is WIndows only.!
So to summarise, the OP has two options I can see:
Most helpful comment
I can confirm that ActiveDirectory module is not compatible with PowerShell Core at all and we have to wait new ActiveDirectory module version.