admin管理员组

文章数量:1355758

In the script module, with 98 ps1 filles. Each file had access to each cmdlet from each file without needing to explicitly export them.

But in the manifest module, only the cmdlets that have been explicitly exported in psd1 file can be accessed by each file. I renamed the files to psm1 and declared them in NestedModules

There are way too many cmdlets to export them all, especially if there is no external need.

How to get the same behavior in a manifested module?

In the script module, with 98 ps1 filles. Each file had access to each cmdlet from each file without needing to explicitly export them.

But in the manifest module, only the cmdlets that have been explicitly exported in psd1 file can be accessed by each file. I renamed the files to psm1 and declared them in NestedModules

There are way too many cmdlets to export them all, especially if there is no external need.

How to get the same behavior in a manifested module?

Share Improve this question asked Mar 28 at 19:34 deetledeetle 4312 silver badges13 bronze badges 2
  • ... not completely sure if I got what meant ... but you may use Get-ChildItem $psscriptroot\*.ps1 | ForEach-Object { . $_.FullName }; Export-ModuleMember -Function * -Alias * inside your *psm1 file and FunctionsToExport = '*' inside your *psd1 file. This way you include all single *.ps1 script files in you module and export all functions included in these script files.

    本文标签: