Not all powershell modules are available in a windows server core container (i.e. active directory) (but are on the host.) RRS feed

  • Question

  • Windows server 2016 server with RSAT tools installed for Active Directory.

    If I run get-module -listavailble I get a list of the powershell modules. Th eone I'm interested in is Active directory which IS listed.

    Created a container based upon windows server core.

    From within that container , if I run get-module -listavailble , I get a slightly smaller list of modules available. Active directory however is not listed. Other examples that are not listed but are deisplayed on the host are appbackgroundtask,appvclient,assignedaccess to name a few.

    I'd like my container to be able to run some scripts that query Active directory but without this module being available, that simply won't work.

    Am I missing something here?

    Thursday, November 17, 2016 1:39 PM

All replies

  • You need to install RSAT inside the container and then you'll be able to import the ActiveDirectory module.

    Install-WindowsFeature RSAT-AD-PowerShell
    Import-Module ActiveDirectory

    I guess you should run the container with gMSA account ServiceAccounts for containers. And after that probably use another (additional) gMSA account to call the desired AD powershell commands (see the Scheduled Tasks section from the link above).


    Thursday, November 17, 2016 6:36 PM
  • Thanks I will give that a go.

    That's changed my appreciation of how containers worked, in that i was under the assumption that the features on the host would be available within the container , but i guess not!

    Friday, November 18, 2016 9:32 AM