2

I've written and compiled a PowerShell module that is essentially a glorified wrapper of the ActiveDirectory module. My module has a proper Module Manifest file as well. I've also created a PSRepository that is hosted on a server and that is where I'd like to host this module of mine.

When I run the following command:

Publish-Module -Name ADWrap -Repository MyRepo -Tags ActiveDirectory -Force -Verbose

I get this error:

Publish-PSArtifactUtility : PowerShellGet cannot resolve the module dependency 'ActiveDirectory' of the module 'ADWrap' on the repository 'MyRepo'. Verify that the dependent module 'ActiveDirectory' is available in the repository 'MyRepo'. If this dependent module 'ActiveDirectory' is managed externally, add it to the ExternalModuleDependencies entry in the PSData section of the module manifest.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1227 char:17
+ Publish-PSArtifactUtility -PSModuleInfo $moduleInfo `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Publish-PSArtifactUtility], InvalidOperationException
+ FullyQualifiedErrorId : UnableToResolveModuleDependency,Publish-PSArtifactUtility

There is not a lot of info on the ExternalModuleDependencies entry. I sought Google out and found these sites that helped a bit here

After generating the Module Manifest I did the following to update the properties of it:

Update-ModuleManifest -Path "\\Server\PowerShell Modules\ADWrap\Version 1.6.1\ADWrap\ADWrap.psd1" -ExternalModuleDependencies 'ActiveDirectory'

That gave me what looks like the proper way to include the ExternalModuleDepencies code but I still get the error. The PrivateData code is the module manifest looks like this:

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

    PSData = @{

        # Tags applied to this module. These help with module discovery in online galleries.
        # Tags = @()

        # A URL to the license for this module.
        # LicenseUri = ''

        # A URL to the main website for this project.
        # ProjectUri = ''

        # A URL to an icon representing this module.
        # IconUri = ''

        # ReleaseNotes of this module
        # ReleaseNotes = ''

        # External dependent modules of this module
        ExternalModuleDependencies = 'ActiveDirectory'

    } # End of PSData hashtable

 } # End of PrivateData hashtable

I'm not sure what I'm missing and I haven't seen a lot about this kind of issue online so any assistance would be appreciated.

1 Answer 1

2

Well I found something interesting. This answer on PowerShell.org indicated that the ExternalModuleDependencies property (that I generated through the Update-ModuleManifest cmdlet) was actually generated incorrectly.

I manually opened the updated module manifest and changed this:

    # External dependent modules of this module
    ExternalModuleDependencies = 'ActiveDirectory'

to this:

    # External dependent modules of this module
    ExternalModuleDependencies = @('ActiveDirectory')

It looks like the dependency needs to be in an array format. Why it doesn't just generate automatically like that is beyond me. I was able to publish my module after this!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .