Avatar of Kelly Garcia
Kelly Garcia
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Powershell warning when running script


When I run my powershell script and getting those warning, how do i stop them from appearing?

WARNING: 16:10:30 - *** The namespace for all the model classes will change from
Microsoft.Azure.Management.Monitor.Management.Models to Microsoft.Azure.Management.Monitor.Models in future releases.
WARNING: 16:10:30 - *** The namespace for output classes will be uniform for all classes in future releases to make it
independent of modifications in the model classes.
WARNING: 16:10:30 - The arguments Categories and Timegrains now have aliases Category and Timegrain respectively. The
plural names will be removed in future releases.

Open in new window

Thank you for your help.


Avatar of undefined
Last Comment

8/22/2022 - Mon
Michael B. Smith

The "warning stream" is number 3.  So re-direct that output to $null.

For example:

write-warning "this is warning text" 3>$null

Open in new window

If you are working with a pipeline, that redirection goes BEFORE the pipe symbol, immediately to the right of the cmdlet generating the warning.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy