Private/Write-DebugMessage.ps1
function Write-DebugMessage { [CmdletBinding()] param( [Parameter( ValueFromPipeline )] [String] $Message ) begin { $oldDebugPreference = $DebugPreference if (-not ($DebugPreference -eq "SilentlyContinue")) { $DebugPreference = 'Continue' } } process { Write-Debug $Message } end { $DebugPreference = $oldDebugPreference } } |