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

Logon Script Map network drive based on username

$
0
0

I want to map a specific network drive based on the username used to log in for example; this is what I have so far:

$net = $(New-Object -ComObject WScript.Network)
$net.MapNetworkDrive("y:", "\\wstation\c$\y",,"username","password")

But I would prefer not to pass the password in clear text or for it to be visible to users.  

Logic:

If current user = bloggs

then "run the script"

else

do nothing

Any help with this would be great


Chris Golden


Viewing all articles
Browse latest Browse all 21975

Trending Articles



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