private void OnLogVerbose(object sender, LogVerboseEventArgs args) { //Lazy values will execute in the context of the previous command when retrieved from the next cmdlet //(such as Select-Object) if (CommandRuntime.GetInternalProperty("PipelineProcessor").GetInternalField("_permittedToWrite") == this) { WriteVerbose($"{MyInvocation.MyCommand}: {args.Message}"); } Debug.WriteLine($"{MyInvocation.MyCommand}: {args.Message}"); }