FeatureRequest: Have New-PSdrive store credentials in Credential Manager when Persist and Credential options used
Currently there is no built in or easy way to have credentials stored to map persistent Drives via a script.
If you are mapping a drive for the same domain that the system is on then it will pass-through the current user's credentials, and it will save alternate credentials for the mapping in the current user session. However if you are trying to map a persistent drive for a share from a different non-federated domain, a workgroup computer, or for something on the same domain using different credentials, the password is not saved through logouts or reboots. Not only is the password not saved, but unless you manually put the credentials in Credential Manager (currently no native PS commands to do this, if you're scripting need to use the old Cmdkey commands) it will lockout the username specified in the credentials by trying to login with a blank password several times.
See here for a more detailed explanation of the mechanics and issue:
I suggest that the New-PSDrive command be updated so that it adds the credentials to Credential Manager if both the -Persist and -Credential options are specified.
This would result in the expected behaviour of the drives being persistent through logouts and reboots, mirror the current behaviour when the drive is mapped via the GUI, and fix the account lockout issue that this can cause.