Search code examples
powershellpowershell-provider

Set-Location Powershell provider


I'm having some trouble browsing a powershell I have created.

I have implemented the methods listed here

The documentation also says

Set-Location: This cmdlet sets the current working location to a specified location. You do >not need to overwrite any methods to support this cmdlet.

But I'm getting the error

cd : Provider operation stopped because the provider does not support this operation. At line:1 char:1 + cd banksia:\ + ~~~~~~~~~~~~ + CategoryInfo : NotImplemented: (:) [Set-Location], PSNotSupportedException + FullyQualifiedErrorId : NotSupported,Microsoft.PowerShell.Commands.SetLocationCommand

What do I have to implement to make Set-Location work?


Solution

  • Did you derive from NavigationCmdletProvider? That is required to support Set-Location IIRC. It relies on the provided implementation of bool IsItemContainer(string path).