Partager via


PSDriveInfo Constructors

Definition

Overloads

PSDriveInfo(PSDriveInfo)

Constructs a new instance of the PSDriveInfo using another PSDriveInfo as a template.

PSDriveInfo(String, ProviderInfo, String, String, PSCredential)

Constructs a drive that maps a PowerShell Path in the shell to a Cmdlet Provider.

PSDriveInfo(String, ProviderInfo, String, String, PSCredential, Boolean)

Constructs a drive that maps a PowerShell Path in the shell to a Cmdlet Provider.

PSDriveInfo(String, ProviderInfo, String, String, PSCredential, String)

Constructs a drive that maps a PowerShell Path in the shell to a Cmdlet Provider.

PSDriveInfo(PSDriveInfo)

Constructs a new instance of the PSDriveInfo using another PSDriveInfo as a template.

protected:
 PSDriveInfo(System::Management::Automation::PSDriveInfo ^ driveInfo);
protected PSDriveInfo (System.Management.Automation.PSDriveInfo driveInfo);
new System.Management.Automation.PSDriveInfo : System.Management.Automation.PSDriveInfo -> System.Management.Automation.PSDriveInfo
Protected Sub New (driveInfo As PSDriveInfo)

Parameters

driveInfo
PSDriveInfo

An existing PSDriveInfo object that should be copied to this instance.

Exceptions

If PSDriveInfo is null.

Remarks

A protected constructor that derived classes can call with an instance of this class. This allows for easy creation of derived PSDriveInfo objects which can be created in CmdletProvider's NewDrive method using the PSDriveInfo that is passed in.

Applies to

PSDriveInfo(String, ProviderInfo, String, String, PSCredential)

Constructs a drive that maps a PowerShell Path in the shell to a Cmdlet Provider.

public:
 PSDriveInfo(System::String ^ name, System::Management::Automation::ProviderInfo ^ provider, System::String ^ root, System::String ^ description, System::Management::Automation::PSCredential ^ credential);
public PSDriveInfo (string name, System.Management.Automation.ProviderInfo provider, string root, string description, System.Management.Automation.PSCredential credential);
new System.Management.Automation.PSDriveInfo : string * System.Management.Automation.ProviderInfo * string * string * System.Management.Automation.PSCredential -> System.Management.Automation.PSDriveInfo
Public Sub New (name As String, provider As ProviderInfo, root As String, description As String, credential As PSCredential)

Parameters

name
String

The name of the drive.

provider
ProviderInfo

The name of the provider which implements the functionality for the root path of the drive.

root
String

The root path of the drive. For example, the root of a drive in the file system can be c:\windows\system32

description
String

The description for the drive.

credential
PSCredential

The credentials under which all operations on the drive should occur. If null, the current user credential is used.

Applies to

PSDriveInfo(String, ProviderInfo, String, String, PSCredential, Boolean)

Constructs a drive that maps a PowerShell Path in the shell to a Cmdlet Provider.

public:
 PSDriveInfo(System::String ^ name, System::Management::Automation::ProviderInfo ^ provider, System::String ^ root, System::String ^ description, System::Management::Automation::PSCredential ^ credential, bool persist);
public PSDriveInfo (string name, System.Management.Automation.ProviderInfo provider, string root, string description, System.Management.Automation.PSCredential credential, bool persist);
new System.Management.Automation.PSDriveInfo : string * System.Management.Automation.ProviderInfo * string * string * System.Management.Automation.PSCredential * bool -> System.Management.Automation.PSDriveInfo
Public Sub New (name As String, provider As ProviderInfo, root As String, description As String, credential As PSCredential, persist As Boolean)

Parameters

name
String

The name of the drive.

provider
ProviderInfo

The name of the provider which implements the functionality for the root path of the drive.

root
String

The root path of the drive. For example, the root of a drive in the file system can be c:\windows\system32

description
String

The description for the drive.

credential
PSCredential

The credentials under which all operations on the drive should occur. If null, the current user credential is used.

persist
Boolean

It indicates if the created PSDrive would be persisted across PowerShell sessions.

Applies to

PSDriveInfo(String, ProviderInfo, String, String, PSCredential, String)

Constructs a drive that maps a PowerShell Path in the shell to a Cmdlet Provider.

public:
 PSDriveInfo(System::String ^ name, System::Management::Automation::ProviderInfo ^ provider, System::String ^ root, System::String ^ description, System::Management::Automation::PSCredential ^ credential, System::String ^ displayRoot);
public PSDriveInfo (string name, System.Management.Automation.ProviderInfo provider, string root, string description, System.Management.Automation.PSCredential credential, string displayRoot);
new System.Management.Automation.PSDriveInfo : string * System.Management.Automation.ProviderInfo * string * string * System.Management.Automation.PSCredential * string -> System.Management.Automation.PSDriveInfo
Public Sub New (name As String, provider As ProviderInfo, root As String, description As String, credential As PSCredential, displayRoot As String)

Parameters

name
String

The name of the drive.

provider
ProviderInfo

The name of the provider which implements the functionality for the root path of the drive.

root
String

The root path of the drive. For example, the root of a drive in the file system can be c:\windows\system32

description
String

The description for the drive.

credential
PSCredential

The credentials under which all operations on the drive should occur. If null, the current user credential is used.

displayRoot
String

The network path of the drive. This field would be populated only if PSDriveInfo is targeting the network drive or else this filed is null for local drives.

Applies to