The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DriveCmdletProvider.InitializeDefaultDrives Method ()


Updated: April 27, 2016

Applies To: Windows PowerShell

Gives the provider the ability to map drives after initialization.

Namespace:   System.Management.Automation.Provider
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

protected virtual Collection<PSDriveInfo> InitializeDefaultDrives()

Return Value

Type: System.Collections.ObjectModel.Collection<PSDriveInfo>

A collection of PSDriveInfo objects for each drive the provider wants to mount. If no drives should be mounted, an empty collection should be returned.

When the provider engine starts 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 computer is part of a domain.

All providers should mount a root drive to increase discoverability. This root drive might contain a listing of a set of locations that would be interesting as roots for other mounted drives. For example, the Active Directory provider might 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.

This method defines provider-specific functionality for the New-Drive cmdlet. If this implementation of the cmdlet requires addition parameters, the provider must also call the NewDriveDynamicParameters method.

For more information about providers, see Windows PowerShell Providers [ps].

Return to top

Community Additions