共用方式為


DriveCmdletProvider.InitializeDefaultDrives Method

Definition

Gives the provider the ability to map drives after initialization.

protected:
 virtual System::Collections::ObjectModel::Collection<System::Management::Automation::PSDriveInfo ^> ^ InitializeDefaultDrives();
protected virtual System.Collections.ObjectModel.Collection<System.Management.Automation.PSDriveInfo> InitializeDefaultDrives ();
abstract member InitializeDefaultDrives : unit -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSDriveInfo>
override this.InitializeDefaultDrives : unit -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSDriveInfo>
Protected Overridable Function InitializeDefaultDrives () As Collection(Of PSDriveInfo)

Returns

A collection of the drives the provider wants to be added to the session upon initialization.

The default implementation returns an empty PSDriveInfo collection.

Remarks

After the Start method is called on a provider, the InitializeDefaultDrives method is called. This is an opportunity for the provider to mount drives that are important to it. For instance, the Active Directory provider might mount a drive for the defaultNamingContext if the machine is joined to a domain.

All providers should mount a root drive to help the user with discoverability. This root drive might contain a listing of a set of locations that would be interesting as roots for other mounted drives. For instance, the Active Directory provider my create a drive that lists the naming contexts found in the namingContext attributes on the RootDSE. This will help users discover interesting mount points for other drives.

Applies to