PrateekKumarSingh / AzViz

⚡ ☁ Azure Visualizer aka 'AzViz' : A #powershell module to automatically generate Azure resource topology diagrams by just typing a PowerShell cmdlet and passing the name of one or more Azure Resource groups
MIT License
587 stars 146 forks source link

Feature Request: Parameter to supress output #48

Closed moiaune closed 3 years ago

moiaune commented 3 years ago

Hi,

First of all, thanks so much for this module. Its golden!

I'm automating visualization of Azure environment using AzViz in a script which generates a visualization for each subscription which in turn means that I must call Export-AzViz multiple times, since I have multiple subscriptions.

The current version of AzViz generates a lot of output in the terminal, so it would be nice if we could have a parameter that would supress this information. I've tried to pipe the command to Out-Null but since it's using Write-Host this does not work.

PrateekKumarSingh commented 3 years ago

Hi @madsaune,

I think output suppression logic shouldn't be in Export-AzViz and if you need to suppress Write-Host output simply use stream redirection as shown in the following example:

Export-AzViz -ResourceGroup myresourcegroupname -Theme neon -Show 6>&1 | Out-Null

Since PowerShell v5.1, Write-Host cmdlet now sends the output to Information stream (6) instead of directly sending it to the console, and hence it can be redirected and suppressed using 6>&1 | Out-Null

moiaune commented 3 years ago

Thanks, I didn't know that! 🙂