Search code examples
powershellsitecoresitecore8

Sitecore PowerShell : Remove-Item not deleting, How to troubleshoot?


I have simple Sitecore8/PowerShell script where I delete image child item and publish parent item:

$child1 = Get-Item $child1Path
Remove-Item $child1 -Force -Permanently 
Publish-Item -Item $parent1 -Recurse -PublishMode SingleItem -Language "en*"

No deletion and no errors while running.

How can I find out why it's not deleting ?


Solution

  • You can use the Remove-Item with the -Path parameter. Or use

    $child1 | Remove-Item

    Apparently you script don't throw an error but the remove is not working that way. See the documentation https://doc.sitecorepowershell.com/working-with-items