다음을 통해 공유


Remove-PSDrive

Deletes temporary PowerShell drives and disconnects mapped network drives.

구문

Name (기본값)

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

LiteralName

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

Description

The Remove-PSDrive cmdlet deletes temporary PowerShell drives that were created by using the New-PSDrive cmdlet.

Beginning in Windows PowerShell 3.0, Remove-PSDrive also disconnects mapped network drives, including, but not limited to, drives created by using the Persist parameter of New-PSDrive.

Remove-PSDrive cannot delete Windows physical or logical drives.

Beginning in Windows PowerShell 3.0, when an external drive is connected to the computer, PowerShell automatically adds a PSDrive to the file system that represents the new drive. You do not need to restart PowerShell. Similarly, when an external drive is disconnected from the computer, PowerShell automatically deletes the PSDrive that represents the removed drive.

예제

Example 1: Remove a file system drive

This command removes a temporary file system drive named smp.

Remove-PSDrive -Name smp

Example 2: Remove mapped network drives

This command uses Remove-PSDrive to disconnect the X: and S: mapped network drives.

Get-PSDrive X, S | Remove-PSDrive

매개 변수

-Confirm

Prompts you for confirmation before running the cmdlet.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False
별칭:cf

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-Force

Removes the current PowerShell drive.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-LiteralName

Specifies the name of the 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 PowerShell not to interpret any characters as escape sequences.

매개 변수 속성

형식:

String[]

Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

LiteralName
Position:0
필수:True
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-Name

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

매개 변수 속성

형식:

String[]

Default value:None
와일드카드 지원:True
DontShow:False

매개 변수 집합

Name
Position:0
필수:True
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-PSProvider

Specifies an array of PSProvider objects. This cmdlet removes and disconnects all of the drives associated with the specified PowerShell provider.

매개 변수 속성

형식:

String[]

Default value:None
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값:False

-Scope

Specifies a scope for the drive. The acceptable values for this parameter are: Global, Local, and Script, or a number relative to the current scope. Scopes number 0 through the number of scopes. The current scope number is 0 and its parent is 1. For more information, see about_Scopes.

매개 변수 속성

형식:String
Default value:Local
와일드카드 지원:False
DontShow:False

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:True
나머지 인수의 값: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.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False
별칭:usetx

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

매개 변수 속성

형식:SwitchParameter
Default value:False
와일드카드 지원:False
DontShow:False
별칭:wi

매개 변수 집합

(All)
Position:Named
필수:False
파이프라인의 값:False
속성 이름별 파이프라인의 값:False
나머지 인수의 값:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

입력

PSDriveInfo

You can pipe a drive object, such as from the Get-PSDrive cmdlet, to this cmdlet.

출력

None

This cmdlet returns no output.

참고

Windows PowerShell includes the following aliases for Remove-PSDrive:

  • rdr

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