Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, January 18, 2016 11:04 AM
Hi. I developed a module, that is helps me to automate some routine tasks in Configuration Manager 2012, and of course my module uses cmdlets from Configuration Manager module. The cmdlets of my module has verbose output, but after installing SP2 for SCCM, its cmdlets gets his own verbose output. So, when i run my cmdlet with -verbose argument, SCCM cmdlet starts to output his data too, which i don't want to see. So the question is - "How to prevent verbose output from SCCM cmdlets, and see only data from my cmdlets?"
P.S. Sorry for my English
All replies (5)
Monday, January 18, 2016 1:15 PM ✅Answered
If you call a command with -verbosr the verbose will be set for all command called inside that command. Add "-verbose:$false" to all SCCM CmdLets that you are inside your CmdLets.
\(ツ)_/
Monday, January 18, 2016 1:18 PM ✅Answered
Hi Oleg,
there are several ways you can do this:
- Use an output method other than Write-Verbose (that is: Circumvent the entire verbosity system)
- Call SCCM cmdlets with -Verbose:$false to override the verbosity inheritance
- Do the same as in the previous point, but add it as an additional switch, so suppressing SCCM verbosity is not mandatory
Each of those methods has its advantages and disadvantages, from complexity to implementation effort and script maintenance cost.
The choice is yours.
Cheers,
Fred
There's no place like 127.0.0.1
Monday, January 18, 2016 5:00 PM ✅Answered
Hi Oleg,
you can either edit the module directly, or hope that piping to null will suppress output.
Other than that, there's not much you can do.
Cheers,
Fred
There's no place like 127.0.0.1
Tuesday, January 19, 2016 8:12 AM ✅Answered
There was another thing. Verbose output was not from SCCM module, but is was from Set-Location cmdlet. When i run this cmdlet to set location to SCCM PSDrive it starts to output its verbose data to host. So Set-Location [CMSite:] -Verbose:$false is the cure)
Monday, January 18, 2016 2:37 PM
Thanks for replies. There is another moment. I understand how to override verbose parameter when calling SCCM cmdlets, but how to hide verbose output while SCCM module import. When i first time run my cmdlet, it automatically loads dependent module, which write verbose data to PS host. But i don`t want it.