PowerTip: Load PowerShell Modules and See What’s Imported

Doctor Scripto

Summary: Learn to parse load information about modules to see what’s imported.

Hey, Scripting Guy! Question How can I analyze what is imported when a Windows PowerShell module loads?

Hey, Scripting Guy! Answer Use the –Verbose switch when importing the module, and redirect the verbose stream to a
          text file so you can use Windows PowerShell cmdlets to parse the file. In the following example,
          all modules are loaded, verbose output is redirected to a file, and Select-String is used to parse
          the file (gmo is an alias for Get-Module and ipmo is an alias for Import-Module):

gmo -l | ipmo -Verbose | 4>>c:fsomodload.txt

$a = Get-Content C:fsomodload.txt

$a | Select-String “importing”

$a | Select-String “alias”


Discussion is closed.

Feedback usabilla icon