Skip to content

Instantly share code, notes, and snippets.

@michaellwest
Created August 8, 2015 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaellwest/f86ef34bf816d9226856 to your computer and use it in GitHub Desktop.
Save michaellwest/f86ef34bf816d9226856 to your computer and use it in GitHub Desktop.
Measure PowerShell command performance in SPE.
$path = "master:\"
$identity = "admin"
$time1 = Measure-Command -Expression {
Get-ChildItem -Path $path -Recurse | Where-Object { $_.__lock -eq $identity }
}
$time2 = Measure-Command -Expression {
$query = "fast://*[@__lock='%$($identity)%']"
Get-Item -Path $Path -Query $query
}
Write-Verbose "Get-ChildItem time: $($time1.TotalSeconds) seconds" -Verbose
Write-Verbose "Get-Item with fast query time: $($time2.TotalSeconds) seconds" -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment