I'm trying to get my feet wet in Sitecore Powershell.
I need to list renderings on a list of items. Some of the script works, like getting the items and outputting the name, but when calling Get-Rendering
or Get-LayoutDevice
i always get the error:
Current Sitecore database cannot be established, current location is not within a Sitecore content tree.
Google offers no help. What am I doing wrong? The script I am buildling on currently looks like this:
$pages = get-item master:/content/MySite/articles | get-childitem -Recurse | where-object { $_.TemplateName -match "Article" }
$device = Get-LayoutDevice -Default
foreach($page in $pages){
write-host $page.name
Get-Rendering -Item $page -Device $device
}