ExternalModuleDependencies / RequiredModules??

This topic contains 2 replies, has 2 voices, and was last updated by  Laurence 1 week, 2 days ago.

  • Author
    Posts
  • #104033

    Laurence
    Participant

    Hello,
    I'm trying to set up a module that's used as a toolbox for our Office365 deployment. I've managed to setup a Nexus (nuget) repository locally to store the module, but I'm a bit stuck on configuring the ExternalModuleDependencies ore is it RequiredModules in the Manifest for the module. As I understood it the dependant modules should be checked when the module is install or imported, or even run! However the custom cmdlets just error, after I import the required modules, everything works okay.
    I've added this to the PSData hashtable.

    ExternalModuleDependencies = @('ActiveDirectory','AzureAD','SkypeOnlineConnector','SkypeForBusiness')

    Is this correct, I'm guessing I'm missing something here. Do I have to add the import-module commands to the psm1? I thought this was automatic on PS 5.

    Thanks
    Laurence

  • #104036

    Don Jones
    Keymaster

    ExternalModuleDependencies doesn't auto-import, no. See https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/new-modulemanifest?view=powershell-6; use RequiredModules to auto-import.

  • #104159

    Laurence
    Participant

    Thanks for the reply.
    I ended up using the RequiredModules and ExternalModuleDependencies. It's now doing what I want it to.
    RequiredModules

    RequiredModules = @(
        @{ModuleName="ActiveDirectory";ModuleVersion="1.0.0.0";Guid="43c15630-959c-49e4-a977-758c5cc93408"}
        @{ModuleName="AzureADpreview"; ModuleVersion="2.0.1.2";Guid="b433e830-b479-4f7f-9c80-9cc6c28e1b51"}
        @{ModuleName="SkypeOnlineConnector";ModuleVersion="7.0.0.0";Guid="6dba410d-dbf1-4488-bba2-bef5f79658af"}
        @{ModuleName="SkypeForBusiness";ModuleVersion="6.0.0.0";Guid="b8499a8b-4b90-43b8-a27e-3c4e7b292c44"}
    )

    ExternalModuleDependencies

    ExternalModuleDependencies = @('ActiveDirectory','AzureADpreview','SkypeOnlineConnector','SkypeForBusiness')

You must be logged in to reply to this topic.