Information
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.

PSDriveInfo Class

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Provides information about a Windows PowerShell drive that is used to access stored data through a provider.

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

System.Object
  System.Management.Automation.PSDriveInfo

public class PSDriveInfo : IComparable

NameDescription
System_CAPS_protmethodPSDriveInfo(PSDriveInfo)

Initializes a new instance of the PSDriveInfo class that contains an existing PSDriveInfo object.

System_CAPS_pubmethodPSDriveInfo(String, ProviderInfo, String, String, PSCredential)

Initializes a new instance of the PSDriveInfo class that contains new drive information.

System_CAPS_pubmethodPSDriveInfo(String, ProviderInfo, String, String, PSCredential, Boolean)

Initializes a new instance of the PSDriveInfo class that contains new drive information and allows for persistence across Windows PowerShell sessions. Introduced in Windows PowerShell 3.0.

System_CAPS_pubmethodPSDriveInfo(String, ProviderInfo, String, String, PSCredential, String)

Initializes a new instance of the PSDriveInfo class that contains new drive information and can target network drives. Introduced in Windows PowerShell 3.0.

NameDescription
System_CAPS_pubpropertyCredential

Gets the security credentials for the Windows PowerShell drive.

System_CAPS_pubpropertyCurrentLocation

Gets or sets the current location within the drive.

System_CAPS_pubpropertyDescription

Gets or sets the description of the Windows PowerShell drive.

System_CAPS_pubpropertyDisplayRoot

Gets the Universal Naming Convention (UNC) path of the drive. This property is populated only if the created drive object is targeting a network drive; otherwise, this property is null. Introduced in Windows PowerShell 3.0.

System_CAPS_pubpropertyMaximumSize

When supported by provider this specifies a maximum drive size.

System_CAPS_pubpropertyName

Gets the name of the Windows PowerShell drive.

System_CAPS_pubpropertyProvider

Gets the provider associated with the Windows PowerShell drive.

System_CAPS_pubpropertyRoot

Gets the root of the Windows PowerShell drive.

NameDescription
System_CAPS_pubmethodCompareTo(Object)

Retrieves an integer that indicates whether the current drive object is less than, equal to, or greater than a specified Object object.

System_CAPS_pubmethodCompareTo(PSDriveInfo)

Retrieves an integer that indicates whether the current drive is less than, equal to, or greater than a specified PSDriveInfo object.

System_CAPS_pubmethodEquals(Object)

Determines whether the current PSDriveInfo type is equal to a supplied Object type.(Overrides Object.Equals(Object).)

System_CAPS_pubmethodEquals(PSDriveInfo)

Determines whether the name of the current PSDriveInfo object is equal to the name of a specified PSDriveInfo object.

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Generates an Int32 value that represents the current drive.(Overrides Object.GetHashCode().)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

Converts the PSDriveInfo object to a string.(Overrides Object.ToString().)

NameDescription
System_CAPS_puboperatorSystem_CAPS_staticEquality(PSDriveInfo, PSDriveInfo)

Compares two drive names, and returns true if the two names are lexically equal.

System_CAPS_puboperatorSystem_CAPS_staticGreaterThan(PSDriveInfo, PSDriveInfo)

Compares two drive names, and returns true if one name is lexically greater than the other name.

System_CAPS_puboperatorSystem_CAPS_staticInequality(PSDriveInfo, PSDriveInfo)

Compares two drive names, and returns true if the two names are not lexically equal.

System_CAPS_puboperatorSystem_CAPS_staticLessThan(PSDriveInfo, PSDriveInfo)

Compares two drive names, and returns true if one name is lexically less than the other name.

A provider can derive from this class to provide its own public members or to cache information that is related to a drive. For instance, if a drive is a connection to a remote machine and making that connection is expensive, the provider might want to keep a handle to the connection as a member of a derived PSDriveInfo class when the provider is invoked.

A Windows PowerShell drive extends the concept of a typical drive in the following ways:

  • A Windows PowerShell drive name can be any alphanumeric sequence.

  • A Windows PowerShell drive can be defined at any valid root or point on a path.

  • A Windows PowerShell drive can be implemented by any Windows PowerShell provider, not just the file system. For example, a drive could be defined on the Active Directory or the Registry.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: