PowerShell Logo Small

Remove-PSDrive



This is the built-in help made by Microsoft for the command 'Remove-PSDrive', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Deletes temporary Windows PowerShell drives and disconnects mapped network drives.

SYNTAX


Remove-PSDrive [-Name] <String[]> [-Force] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]]
[-PSProvider [<String[]>]] [-Scope [<String>]] [-Confirm] [-WhatIf] [-UseTransaction [<SwitchParameter>]] [<CommonParameters>]
Remove-PSDrive [-LiteralName] <String[]> [-Force] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable
[<System.String>]] [-PSProvider [<String[]>]] [-Scope [<String>]] [-Confirm] [-WhatIf] [-UseTransaction [<SwitchParameter>]] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Remove-PSDrive cmdlet deletes temporary Windows 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, Windows PowerShell automatically adds a PSDrive to the file system that represents
the new drive. You do not need to restart Windows PowerShell. Similarly, when an external drive is disconnected from the computer, Windows PowerShell automatically deletes
the PSDrive that represents the removed drive.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=293898
Get-PSDrive
New-PSDrive
about_Providers

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>Remove-PSDrive -Name smp



This command removes a temporary file system drive named "smp".






-------------------------- EXAMPLE 2 --------------------------

PS C:\>Get-PSDrive X, S | Remove-PSDrive



This command disconnects the X: mapped network drive that was created in File Explorer and the S: mapped network drive that was created by using the Persist parameter of the
New-PSDrive cmdlet.

The command uses the Get-PSDrive cmdlet to get the drives and the Remove-PSDrive cmdlet to disconnect them.