function Get-FunctionWriteProgressHelperCalls { param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] [string]$FunctionName ) $commandDefinition = (Show-CommandDefinition $FunctionName) return ([System.Management.Automation.PsParser]::Tokenize($commandDefinition, [ref]$null) | where { $_.Type -eq 'Command' -and $_.Content -eq 'Write-ProgressHelper' }).Count }