Complete List of MS-DOS Commands
2609
30/11/2021
After we released the method of using the cmd command to map a network drive, we will introduce the method of using the net use command to unmap a network drive.
unmap network drive using net use command
. Certainly, you need some time to disconnect some of the mapped drives. This is a different method from the standard and easy one using the explore the interface. Mostly used to automate processes on your network environment.
Read here:
how to map network drive using cmd commands
Unmap Network Drive Command Line
How to unmap network drive using cmd commands “net use delete”
The following method
uses a command prompt (cmd) to remove network drive
from the computer.
Open the command prompt by searching for cmd on windows search. Open with “run as admin” by right click it.
Copy and paste the below commands
net use T:/delete
Note! Edit the T: on the example above with your network drive
You will receive a confirmation that the mapped network drive has been deleted successfully.Go to the file explorer to check and the mapped drive will be removed. Keep in mind that this command will delete only map drive that uses a letter and not for mappings as an FTP server or web server.
unmap network drive using cmd
How to remove all mapped network drive on certain computer
What if you will need to delete all the mapped network drive from a certain computer? For this case come in help the “*” string.
So use the below command:
net use */delete.
This command will ask you for confirmation before removing all the mapped drive and you will need to type “Y” to confirm ore “N” to decline.
You want to include the above task on the command? Yes sure use the below command in order to not prompt for confirmation:
net use */delete /y
unmap all network drive using cmd
How to delete mapped network drive using Regedit
READ ALSO -
How to rename folder in CMD (Command Line)
Another method te delete mapped network drive is the regedit. To do this:
Open Regedit by searching it on windows search.
Navigate to the following path –
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2
On the mapped network drive that you want to delete, right-click, and delete.
Browser to the next path –
Computer\HKEY_CURRENT_USER\Network
Right-click on the network share that you want to delete and select delete
Restart the computer
After the restart, the mapped network drive will be removed from the File Explorer.
remove network drive using Regedit
Batch file to unmap network drive
If you are on-network environment and you will need to remove the mapped network drive to all computers, the following method will come in help. You can schedule this bat file to run on GPO or any other platform used to manage computers.Open notepad and save the below command as remove_map.bat
@echo remove network drive T:/net use T:/delete.:exit
The following script will delete all mapped network drive without prompt
@echo remove all network drivenet use */delete /y:exit
How to Unmap network drive using Powershell
Instead of Command prompt, you can use also PowerShell. Powershell uses different commands like below:
Remove-PSDrive -Name T
Bonus tip:
Before you execute the delete command you can show the current mapped drive using the below command:
Get-SmbMapping
delete network drive using PowerShell
Conclusion
We try to include all the methods using
commands to unmap network drive
. I hope it helps you.