Skip to main content
Fixed grammar, improved formatting and added relevant tag.
Source Link
Sumit Helaiya
  • 3.2k
  • 2
  • 12
  • 23

I've created multiple custom reportsmultiple custom reports for content managers. They all run as expected in the Sitecore Powershell ISESitecore Powershell ISE.
When

When I save them in Reporting ToolsReporting Tools and attempt to run, I am gettingget errors.
The

The first error was due to the relative -Path-Path so I added the master:master: prefix and that fixed it.

The

The error I'm stuck on is "Get-ItemTemplate : Current Sitecore database cannot be established, current location is not within a Sitecore content tree"

Get-ItemTemplate : Current Sitecore database cannot be established, current location is not within a Sitecore content tree

Here is the relevant part of the report script. It fails on the last line:

$path = $root.Paths.FullPath
$pathtouse = "master:" + $path
#Get Items
$items = Get-ChildItem -Path $pathtouse -Recurse
#For each item check templates
foreach($item in $items){
    $template = Get-ItemTemplate -ID $item.ID
}

I've created multiple custom reports for content managers. They all run as expected in the Sitecore Powershell ISE.
When I save them in Reporting Tools and attempt to run I am getting errors.
The first error was due to the relative -Path so I added the master: prefix and that fixed it.

The error I'm stuck on is "Get-ItemTemplate : Current Sitecore database cannot be established, current location is not within a Sitecore content tree"

Here is the relevant part of the report script. It fails on the last line:

$path = $root.Paths.FullPath
$pathtouse = "master:" + $path
#Get Items
$items = Get-ChildItem -Path $pathtouse -Recurse
#For each item check templates
foreach($item in $items){
    $template = Get-ItemTemplate -ID $item.ID
}

I've created multiple custom reports for content managers. They all run as expected in the Sitecore Powershell ISE.

When I save them in Reporting Tools and attempt to run, I get errors.

The first error was due to the relative -Path so I added the master: prefix and that fixed it.

The error I'm stuck on is

Get-ItemTemplate : Current Sitecore database cannot be established, current location is not within a Sitecore content tree

Here is the relevant part of the report script. It fails on the last line:

$path = $root.Paths.FullPath
$pathtouse = "master:" + $path
#Get Items
$items = Get-ChildItem -Path $pathtouse -Recurse
#For each item check templates
foreach($item in $items){
    $template = Get-ItemTemplate -ID $item.ID
}
formatting. tags.
Source Link
Mark Cassidy
  • 25.4k
  • 7
  • 59
  • 117

I've created multiple custom reports for content managers. They all run as expected in the Sitecore Powershell ISE.
When I save them in Reporting Tools and attempt to run I am getting errors.
The first error was due to the relative -Path so I added the master: prefix and that fixed it.

The error I'm stuck on is "Get-ItemTemplate : Current Sitecore database cannot be established, current location is not within a Sitecore content tree"

Here is the relevant part of the report script. It fails on the last line:

$path = $root.Paths.FullPath
$pathtouse = "master:" + $path
#Get Items
$items = Get-ChildItem -Path $pathtouse -Recurse
#For each item check templates
foreach($item in $items){
$template = Get-ItemTemplate -ID $item.ID

$path = $root.Paths.FullPath
$pathtouse = "master:" + $path
#Get Items
$items = Get-ChildItem -Path $pathtouse -Recurse
#For each item check templates
foreach($item in $items){
    $template = Get-ItemTemplate -ID $item.ID
}

I've created multiple custom reports for content managers. They all run as expected in the Sitecore Powershell ISE.
When I save them in Reporting Tools and attempt to run I am getting errors.
The first error was due to the relative -Path so I added the master: prefix and that fixed it.

The error I'm stuck on is "Get-ItemTemplate : Current Sitecore database cannot be established, current location is not within a Sitecore content tree"

Here is the relevant part of the report script. It fails on the last line:

$path = $root.Paths.FullPath
$pathtouse = "master:" + $path
#Get Items
$items = Get-ChildItem -Path $pathtouse -Recurse
#For each item check templates
foreach($item in $items){
$template = Get-ItemTemplate -ID $item.ID

I've created multiple custom reports for content managers. They all run as expected in the Sitecore Powershell ISE.
When I save them in Reporting Tools and attempt to run I am getting errors.
The first error was due to the relative -Path so I added the master: prefix and that fixed it.

The error I'm stuck on is "Get-ItemTemplate : Current Sitecore database cannot be established, current location is not within a Sitecore content tree"

Here is the relevant part of the report script. It fails on the last line:

$path = $root.Paths.FullPath
$pathtouse = "master:" + $path
#Get Items
$items = Get-ChildItem -Path $pathtouse -Recurse
#For each item check templates
foreach($item in $items){
    $template = Get-ItemTemplate -ID $item.ID
}
Source Link

SPE report fails to run in Reporting Tools; runs successfully in the ISE

I've created multiple custom reports for content managers. They all run as expected in the Sitecore Powershell ISE.
When I save them in Reporting Tools and attempt to run I am getting errors.
The first error was due to the relative -Path so I added the master: prefix and that fixed it.

The error I'm stuck on is "Get-ItemTemplate : Current Sitecore database cannot be established, current location is not within a Sitecore content tree"

Here is the relevant part of the report script. It fails on the last line:

$path = $root.Paths.FullPath
$pathtouse = "master:" + $path
#Get Items
$items = Get-ChildItem -Path $pathtouse -Recurse
#For each item check templates
foreach($item in $items){
$template = Get-ItemTemplate -ID $item.ID