PowerTip: Suppress PowerShell Module Import Warning Messages

Doctor Scripto

Summary: Learn how to use the warning redirection operator to suppress Windows PowerShell warning messages when importing a module.

Hey, Scripting Guy! Question How can you hide the warning message from a Windows PowerShell module when you import it if the module contains an unapproved verb?

Hey, Scripting Guy! Answer Use the warning stream redirection operator when importing the module, and redirect the warning message to $null:

Import-Module *sql* 3>$null

0 comments

Discussion is closed.

Feedback usabilla icon