My verbose logging does not output for a script that gets called when my module gets imported. The module manifest contains a script to process for when the module is imported. Now when I run the cmdlet to import the module with the verbose parameter set, no verbose logging outputs from the script.
# within Module Manifest # Script files (.ps1) that are run in the caller's environment prior to importing this module. ScriptsToProcess = '.\ScriptToProces.ps1'
# run the following in PowerShell Import-Module MyModule -Verbose
I expect the verbose logging I set up in my “.\ScriptToProcess.ps1” script to output, but it doesn’t. I am sure this has something do with scope, but I have tried a few things and have been unsuccessful.
I thought as a solution to be able to verify if the -Verbose parameter was used with Import-Module, then I can set my $VerboseParameter from within my script. I have not figured it out.