I have a script where I want to disconnect from the mapped drives before I create a new PSDrive.
Otherwise I get this error:
New-PSDrive : Mul
With PowerShell 5.1 in Windows 10 you can use:
Get-SmbMapping | Remove-SmbMapping -Confirm:$false
Try this:
net use * /delete /y
The /y key makes it select Yes in prompt silently
/y