Why "net use * /delete" does not work but waits for confirmation in my PowerShell script? Why "net use * /delete" does not work but waits for confirmation in my PowerShell script? powershell powershell

Why "net use * /delete" does not work but waits for confirmation in my PowerShell script?


Try this:

net use * /delete /y

The /y key makes it select Yes in prompt silently


With PowerShell 5.1 in Windows 10 you can use:

Get-SmbMapping | Remove-SmbMapping -Confirm:$false