ItemCmdletProvider.ItemExists Method


Determines if an item exists at the specified path.

protected virtual bool ItemExists (string path);

The path to the item to see if it exists.


True if the item exists, false otherwise.


Providers override this method to give the user the ability to check for the existence of provider objects using the set-item cmdlet.

        Providers that declare <xref href="System.Management.Automation.Provider.ProviderCapabilities"></xref>
        of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those
        requirements by accessing the appropriate property from the base class.

        The implemenation of this method should take into account any form of access to the object that may
        make it visible to the user.  For instance, if a user has write access to a file in the file system 
        provider bug not read access, the file still exists and the method should return true.  Sometimes this
        may require checking the parent to see if the child can be enumerated.

        The default implementation of this method throws an <xref href="System.Management.Automation.PSNotSupportedException"></xref>.