Mapped network drives are not showing in My Computer

六月ゝ 毕业季﹏ 提交于 2020-08-07 05:38:22

问题


I am trying to create a external network drive using PowerShell 5.0. I Need those drive to display in My Computer. For that purpose I am using this follow command.

New-PSDrive -Name "X" -PSProvider FileSystem -Root "\\192.168.0.1\hde_path" -Persist

Is there anything wrong with this command? Because as per my understanding if I use -Persist it is should be displayed in the My Computer window.

After using this, the mapped drive X: is not being displayed in My Computer.

Thanks in Advance!


回答1:


Welcome to Windows 10 and the endless problems of forced User Account Control.

You will note if you map network drives in Computer then run PowerShell as admin, you cannot access the drives. I assume the reverse is also true.

Unfortunately there isn't a way to turn off this "feature", at least not without breaking half of everything else. You just have to manage the access level you run PowerShell as, mapping network drives has to be done at the user level.




回答2:


I had the same problem. My solution was to start the powershell ISE in "Normal-Mode" instead of the "Administrator-Mode" (PS run as Admin). I don't know why this phenomen appears, but the drives were displayed in explorer after I run the powershell ISE in Normal-Mode. Greets




回答3:


When I run this from a script, it does not work, because the session expires on script completion.

It works when I paste into the PowerShell window, and then I can see the share appear in This PC



来源:https://stackoverflow.com/questions/42435699/mapped-network-drives-are-not-showing-in-my-computer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!