I am trying to get a list of items which have created version in "en" language in PowerShell script. I am using the following code:

$items = Get-ChildItem -Path $folder -recurse | Where-Object { $_.Language -eq "en" -and $_.Version -eq 1}

My understanding was that if the version will be existing this is the version in "en" language so my query should work, but I see that it returns also items that do not have "en" language version created so I am confused now.

Could someone please explain how can I check if the particular language version exists in an item?

1 Answer 1


You had this almost correct.

Instead of checking if current version of your item is 1 (version index) you should check number of versions (and pick these where it's not equal 0)

? { $_.Versions.Count -ne 0 }

Anyway, there is much easier way to do the same:

Get-ChildItem -Path $folder -Recurse -Language "en"

With this method you get what you want without additional checks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.