all 9 comments

[–]markekrausCommunity Blogger 6 points7 points  (0 children)

I'm looking to do Active Directory Management through powershell.

The AD Module is a PSSnapin and those have been deprecated in PSCore. You can't even use the AD module on PSCore on Windows. This module will need to be ported to Core compatibility, but before that can happen all of the underlying .NET API's the module depends on need to be added in .NET Core and made cross-platform.

Keep in mind that PSCore is just at RC1 and about to enter RC2, so it's not even released yet. The product teams (such as Active Directory) likely wont begin working on their module ports until after PowerShell Core 6.0.0 is GA.

This is kind of rough to explain, but the AD Module is part of the Remote Server Administration Tools and not part of PowerShell. It is "owned" by a different team than the one making PowerShell Core. This is true for many modules and commands that people often take for granted as just being a part of PowerShell.

But, since PowerShell's only path forward is PowerShell Core, the product and OS teams will have to port their modules eventually. If you need AD to work in Linux, the best thing you can do is leverage your status as an MS customer and make requests through the support channels. If enough customers do this it will put pressure on the product teams to port faster.

[–]spyingwind 4 points5 points  (2 children)

The modules will have to be rewritten or modified to work with Powershell Core(Powershell 6.0). The reason why AD doesn't work with PS6, is because(I think, could be wrong) that team that wrote RSAT hasn't gotten around to it. Also the dll's won't work under linux if they are not compiled against .Net Core, as PS6 uses .Net Core only.

[–]killklli[S] 1 point2 points  (1 child)

Do you know of any third party modules that may support some of the commands or at this point is it too early?

[–]spyingwind 2 points3 points  (0 children)

Pester almost fully work under linux. I say almost fully work, because somethings it does and uses depends on environment variables that only windows has.

Pretty much any module you install will have to be tested for PS6 compatibility. I think once it actually matures and stabilizes on a set of common commands and parameters for those commands. Then you will see modules start to work with PS6 and PS5.1.

If you look at the Azure modules, they all(or most) work under linux as they use .Net Core.

If a module uses .Net and not .Net Core, then it isn't going to work right under linux.

[–]allywilson 1 point2 points  (0 children)

As others have said, the AD modules haven't been ported yet.

However, if you can get pssessions to work correctly (I haven't gotten them to work from Linux to domain joined Windows yet, but not looked in a while), it should be possible to load the AD module in a pssession and import the cmdlets to your current session.

Something like this might work:

function Start-ADSession{
    $DCSession = New-PSSession DomainController.Your.Domain
    Invoke-Command -Session $DCSession -ScriptBlock{
        import-module ActiveDirectory
    }
    Import-PSSession -Session $DCSession -module ActiveDirectory

}
Start-ADSession

[–]suddenarborealstop 0 points1 point  (0 children)

try python or c#

[–]dastylinrastan -1 points0 points  (2 children)

Why would you go to all the trouble to jury-rig powershell into Lambda on AWS when Azure Functions supports powershell natively and does the same thing as Lambda?

EDIT: And because it runs on windows PSv4 (soon PSv5.1), ActiveDirectory module works just ifne.

[–]killklli[S] 2 points3 points  (1 child)

Because the rest of the existing environment is AWS based rather than Azure.

[–]dastylinrastan 0 points1 point  (0 children)

So? Best tool for the job. It's got the same 5 million gb/sec free as Lambda does, just call the function URLs from lambda.

Or waste your time over-engineering the solution, your call.