Summary: Use the warning redirection operator to redirect Windows PowerShell warning messages to a text file.
How can you prevent warning messages from displaying to the Windows PowerShell host, but instead capture them in a text file?
Use the warning message redirection operator:
$WarningPreference = “continue”
Write-Warning “this is warning” 3> c:\fso\warning.txt
0 comments