共用方式為


DriveManagementIntrinsics.New(PSDriveInfo, String) Method

Definition

Creates a new PSDrive in session state.

public:
 System::Management::Automation::PSDriveInfo ^ New(System::Management::Automation::PSDriveInfo ^ drive, System::String ^ scope);
public System.Management.Automation.PSDriveInfo New (System.Management.Automation.PSDriveInfo drive, string scope);
member this.New : System.Management.Automation.PSDriveInfo * string -> System.Management.Automation.PSDriveInfo
Public Function New (drive As PSDriveInfo, scope As String) As PSDriveInfo

Parameters

drive
PSDriveInfo

The drive to be created.

scope
String

The ID of the scope to create the drive in. This may be one of the scope keywords like global or local, or it may be an numeric offset of the scope generation relative to the current scope. If the scopeID is null or empty the local scope is used.

Returns

The drive that was created.

Exceptions

If creating the drive will overflow the MaximumDriveCount limit.

If drive is null.

If the drive already exists, or If drive.Name contains one or more invalid characters; ~ / \ . :

If the provider is not a DriveCmdletProvider.

The provider for the drive could not be found.

If the provider threw an exception or returned null.

Applies to