Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

unpersistent drive mapping question

$
0
0

We have a large (200+) set of shares to map to various users based on group membership via PowerShell login script.  I am very familiar with the arguments for using GPP with item level targeting as a modern method of mapping shares, and we do that for some other shares, but that just isn't a viable option in this case (for reasons I won't go into). 

The script works fine with the

(new-Object-ComWScript.Network).MapNetworkDrive($drive,$path, $true)

method of mapping, but I would like to remove the persistent flag (as it is best practice to not script persistent drives).  If I manually run that command without the $true on the end (non-persistent), the drive appears and works in the Windows GUI and is not persistent across log off/on.  However, in the login script, while the command is successful (based on error checking), the drive is not available in the GUI. 

Does anyone have any suggestions why that would be?

We have a number of XP system still, so we are limited to PowerShell v2 although I am curious if it is possible using the improved "New-PSDrive" in PoSh v3 to thread that middle-ground between mapping the share so that it is available outside the PoSh session and also doesn't remain persistent after log off. 

Thanks.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>