ExternalModuleDependencies / RequiredModules??

Welcome Forums General PowerShell Q&A ExternalModuleDependencies / RequiredModules??

This topic contains 2 replies, has 2 voices, and was last updated by

10 months, 1 week ago.

  • Author
  • #104033

    Topics: 1
    Replies: 1
    Points: 1
    Rank: Member

    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.


  • #104036

    Topics: 13
    Replies: 4872
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    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

    Topics: 1
    Replies: 1
    Points: 1
    Rank: Member

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

    RequiredModules = @(
        @{ModuleName="AzureADpreview"; ModuleVersion="";Guid="b433e830-b479-4f7f-9c80-9cc6c28e1b51"}


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

The topic ‘ExternalModuleDependencies / RequiredModules??’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort