I disconnect from ALL device in Powershell like this:
Invoke-Expression -Command "net use * /delete /y"
And I need to do it for particular devices instead of disconnecting from ALL.
Question: How can I TEST if there is already a connection to a particular network location and DISCONNECT (delete connection) if there is?
What I am trying to achieve in general is something like this:
IF (there is already a connection to a network drive with below details)
"\\poooh.fooo.boo.com\MyFolder" user="FOO\winnie" password="12345678"
THEN
{
Disconnect from this network drive #via NET USE I guess
And CREATE a PS-DRIVE to the same network location
}