I have my custom Powershell script module, let’s call it
PsHandyCmdlets. In its manifest the following line is found:
RequiredModules = @('<Another module not necessarily installed yet>')
RequiredModules property is supposed to guarantee that any module listed here is imported into global scope before importing the current module. This would fail if that module can’t be located on the machine.
Does Powershell provide a mechanism for ensuring that these modules are installed when
PsHandyCmdlets is installed? If there isn’t, is there a best practice in place for handling this scenario?
This is a good write up by Rene Hernandez on his blog talking about this topic and offers up some solutions. He also provides links to a PowerShell module (PSDepend) that could be leveraged to address this challenge. (link gone, but provided link to example)
The module PSDepend was authored by RamblingCookieMonster which I have admired their work as being innovative and solid.