I\'m writing a PowerShell Cmdlet and using WriteDebug, but I want to write an object which requires an extra API call, and I\'d rather not make that call when debugging is t
Try this:
$Debug = $psboundparameters.debug.ispresent if ($Debug){ Write-Debug(string.Format("Name : {0}", api.GetName(myobj)) }