3

I am trying to write a script to loop through child items using the Get-ChildItem cmdlet but it does not seem to be recognised.

$path = "master:/sitecore/content"
$x = Get-ChildItem $path
Write-Host $x.Name

Gives me the error:

Get-ChildItem : Method not found: 'Void System.Management.Automation.Provider.ContainerCmdletProvider.GetChildItems(System.String, Boolean, UInt32)'.
At line:2 char:6
+ $x = Get-ChildItem $path
+      ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-ChildItem], MissingMethodException
    + FullyQualifiedErrorId : System.MissingMethodException,Microsoft.PowerShell.Commands.GetChildItemCommand

I am using Sitecore 8.2 rev 161115, SXA 1.2 rev 161216, SPE 4.4

1 Answer 1

8

This is related to the following bug in SPE 4.4. There are 2 courses of action you can take:

  1. Upgrade your Windows PowerShell to 5. (Windows Management Framework 5.x)
  2. Upgrade SPE to 4.5

Actually taking the approach #2 is preferable as we've fixed quite a few other issues there and Upgrading Windows PowerShell can have consequences on your whole environment and is not always allowed by the systems administrators.

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.