While Remove-PSDrive can remove all kinds of drives including network drives, changes may not take effect until the system reboots. That’s of course ridiculous.

This task is a good example why it is useful that PowerShell made console applications equal citizen. In fact, even in year 2021 the most reliable way to remove a network drive is to use the old but proven net.exe. The example below removes network drive letter Z:

PS> net use z: /delete 
z: was deleted successfully.    

Twitter This Tip! ReTweet this Tip!