Aracılığıyla paylaş


Remove-PSDrive

Applies To: Windows PowerShell 2.0

Removes a Windows PowerShell drive from its location.

Syntax

Remove-PSDrive [-LiteralName] <string[]> [-Force] [-PSProvider <string[]>] [-Scope <string>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

Remove-PSDrive [-Name] <string[]> [-Force] [-PSProvider <string[]>] [-Scope <string>] [-Confirm] [-WhatIf] [-UseTransaction] [<CommonParameters>]

Description

The Remove-PSDrive cmdlet deletes Windows PowerShell drives that you created by using New-PSDrive.

Remove-PSDrive cannot delete Windows drives or mapped network drives created by using other methods and it cannot delete the current working drive.

Parameters

-Force

Allows the cmdlet to remove the current Windows PowerShell drive.

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LiteralName <string[]>

Specifies the name of the Windows PowerShell drive.

The value of LiteralName is used exactly as typed. No characters are interpreted as wildcards. If the name includes escape characters, enclose it in single quotation marks ('). Single quotation marks instruct Windows PowerShell not to interpret any characters as escape sequences.

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Name <string[]>

Specifies the names of the Windows PowerShell drives to remove. Do not type a colon (:) after the drive name.

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-PSProvider <string[]>

Removes all of the Windows PowerShell drives associated with the specified Windows PowerShell provider.

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Scope <string>

Accepts an index that identifies the scope from which the drive is being removed.

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before executing the command.

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

Describes what would happen if you executed the command without actually executing the command.

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UseTransaction

Includes the command in the active transaction. This parameter is valid only when a transaction is in progress. For more information, see about_Transactions.

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This command supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, OutBuffer, OutVariable, WarningAction, and WarningVariable. For more information, see about_CommonParameters.

Inputs and Outputs

The input type is the type of the objects that you can pipe to the cmdlet. The return type is the type of the objects that the cmdlet returns.

Inputs

System.Management.Automation.PSDriveInfo

You can pipe a drive object to Remove-PSDrive.

Outputs

None

This cmdlet does not return any output.

Notes

The Remove-PSDrive cmdlet is designed to work with the data exposed by any provider. To list the providers available in your session, type "Get-PSProvider". For more information, see about_Providers.

Example 1

C:\PS>remove-psdrive -name smp

Description

-----------

This command removes a Windows PowerShell drive named "smp".

See Also

Concepts

about_Providers
Get-PSDrive
New-PSDrive