How can I access a mapped network drive with System.IO.DirectoryInfo?
Mapped network drives are user specific, so if the app is running under a different identity than the user that created the mapped drive letter (z:) it won’t work.
Mapped network drives are user specific, so if the app is running under a different identity than the user that created the mapped drive letter (z:) it won’t work.
Try this: net use * /delete /y The /y key makes it select Yes in prompt silently
WMI is your friend: > wmic netuse where LocalName=”Z:” get UserName /value UserName=rd-pc2037\Administrator [anonymous suggestion 2022-08-07]: Since Microsoft is gradually moving away from WMI, Powershell/CIM is your future friend: Get-CimInstance -classname Win32_NetworkConnection | select-object Remotename,Username
In our network I have found that restarting the Workstation service on the client computer is able to resolve this problem. This has worked in cases where a reboot of the client would also fix the problem. But restarting the service is much quicker & easier [and may work when a reboot does not]. My … Read more
In Windows, if you have mapped network drives and you don’t know the UNC path for them, you can start a command prompt (Start → Run → cmd.exe) and use the net use command to list your mapped drives and their UNC paths: C:\>net use New connections will be remembered. Status Local Remote Network ——————————————————————————- … Read more
Use this at your own risk. (I have tested it on XP and Server 2008 x64 R2) For this hack you will need SysinternalsSuite by Mark Russinovich: Step one: Open an elevated cmd.exe prompt (Run as administrator) Step two: Elevate again to root using PSExec.exe: Navigate to the folder containing SysinternalsSuite and execute the following … Read more