If you are also encountering a parse exception with the fast query in Get-Item command in Sitecore. Following below:

Get-Item : End of string expected at position 50. At line:2 char:13 + $oldItems = Get-Item master: -Query “fast:$rootPath//*[@@templatename … + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Get-Item], ParseException + FullyQualifiedErrorId : Sitecore.Data.Query.ParseException,Microsoft.PowerShell.Commands.GetItemCommand

In order to resolve this issue, use following:

$rootPath.Replace("-", "#-#")

If there are other special characters too that are causing problem, you can use regex expression.

Hope this helps, Good luck!

Leave a comment

Quote of the week

“The only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle.”