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