I have written my own Powershell logging function Log
with parameters stream
(on which stream to write the message) and message
(the messa
More generally: since one might specify -Verbose:$false on the command line, the following code handles that case. It also works for any other switch parameter:
$Verbose = $false
if ($PSBoundParameters.ContainsKey('Verbose')) { # Command line specifies -Verbose[:$false]
$Verbose = $PsBoundParameters.Get_Item('Verbose')
}