Find Sitecore Items Without A Language Version

Using Powershell

Use Case

Recently, I ran across a problem where I was missing items in a web database. They were not getting published to the master database because there were no language versions for those items. This causes a lot of confusion because what you see in Sitecore Experience Editor ends up not matching what you see on the front-end site.

Most Powershell commands that retrieve items require a - Language parameter to retrieve specific versions. If you leave the language param off, it will use “en” as the default choice. If you pass an empty string for this param, it will return all versions of items that have language versions. But still my scenario was uncovered i.e the items without a language version.

I created the below powershell script to resolve the issue. It gives you a list with a full path of all items with no language version.

Powershell Script

You can change $folder value depending upon the node on which you want to run this script. Also combine the Where-Object clause with other parameters like Name or Template if you are looking for something specific

$folder = "/sitecore"
$items = Get-ChildItem -Path $folder -recurse | Where-Object { $_.Versions.GetVersions($true).Count -eq 0 } 

ForEach ($item in $items) 
    $path = $item.Paths.FullPath 
    Write-Host $path

If you want to reproduce it, just create a new item, then go to the “Versions” tab and delete the current version.

Happy Coding!

👋 Hey Sitecore Enthusiasts!

Sign up to our bi-weekly newsletter for a bite-sized curation of valuable insight from the Sitecore community.

What’s in it for you?

  • Stay up-to-date with the latest Sitecore news
  • New to Sitecore? Learn tips and tricks to help you navigate this powerful tool
  • Sitecore pro? Expand your skill set and discover troubleshooting tips
  • Browse open careers and opportunities
  • Get a chance to be featured in upcoming editions
  • Learn our secret handshake
  • And more!
Sitecore Snack a newsletter by Fishtank Consulting