New-PSDrive

by JonWhitwham at 2012-09-10 06:43:09

Hi,

I am experimenting with the New-PSdrive cmdlet to create a logon script. Despite using the -Persist switch the created PSDrives are not showing within Windows Explorer. I thought that if the -persist switch was used they would display. I am running the PowerShell session under my admin account but thought the drive would display in Explorer under my day to day account in a similar fashion to mapping a network drive with alternative credentials. I am on Windows 7. Any questions please let me know & thanks in advance for your help.

Jon
by DonJ at 2012-09-10 06:53:20
It’s supposed to, although in a logon script you can run into timing issues, since it’s possible for the script to run before the profile gets fully loaded. When that happens, the drive mapping doesn’t stick.

You can always use NET USE, old-school ;).
by poshoholic at 2012-09-10 12:01:30
Hi Jon,

You should review this post, which contains a link that summarizes why this issue can happen for admin accounts:

http://powershell.org/discuss/viewtopic.php?f=9&t=57#p438