Reputation: 82507
I have the following script:
New-PSDrive -Name X -PSProvider FileSystem -Root "$DeployLocation" -Credential $credentials
New-PSDrive -Name K -PSProvider FileSystem -Root "$autobuildSourceFiles" -Credential $credentials
When this runs, the first drive maps correctly, but the second one fails with the following error:
InvalidOperation: The specified network password is not correct
This is really a confusing error, because I pass in the exact same $credentials
object for both calls. If one of them works, then I do not see how the password can be incorrect.
In case it is relevant, the variables look like this:
$DeployLocation = "\\dev-server\DevFiles\Technical\MyProjectNameHere"
$autobuildSourceFiles = "\\mainshare\build`$\Technical\MyProjectNameHere\1.0.0.94"
The user in the $credentials
variable has read and write permissions to $DeployLocation
and read-only permissiosn to $autobuildSourceFiles
. But I don't see how that would cause a password error.
Things I have tried:
PSDrive
). When I swap the order, the same one (drive "K") fails.Note: I am using Powershell Version 5.1.14393.5127 on Windows.
What could be causing this error, and how can I work around it?
Upvotes: 1
Views: 1728