Disconnect mapped drive via GUI object Shell.Application


trying find way call gui disconnect of mapped network drive can remove drives explorer when in disconnected state. net use removes drive not reference drive in explorer when drives disconnected (right click disconnect removes explorer reference well)

i have looked at

$shell = new-object -com "shell.application"
$drive = $shell.namespace("z:")

but cannot find way access context menu , disconnect. have seen scripts pin items taskbar use 'right click' options of file this. not know objects in powershell so  struggling find way. can see $drive.items() , others not have verbs far can see (like taskbar pin script does).

so can advise how can disconnect mapped drive way gui in powershell

thank you.

either refresh or close , open explorer.  there no way thinking about.

\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments