Created
August 8, 2015 01:37
-
-
Save michaellwest/f86ef34bf816d9226856 to your computer and use it in GitHub Desktop.
Measure PowerShell command performance in SPE.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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