Difference between revisions of "Credentials (PowerShell)"

Jump to navigation Jump to search
m
→‎Store Password Securely: Added "ConvertTo-SecureString : Key not valid for use in specified state"
m (→‎Store Password Securely: Minor rewording etc)
m (→‎Store Password Securely: Added "ConvertTo-SecureString : Key not valid for use in specified state")
Line 64: Line 64:
</source>
</source>
...obviously to make the above more useful you'd test that the user/pass combo supplied was correct prior to saving to file.
...obviously to make the above more useful you'd test that the user/pass combo supplied was correct prior to saving to file.
=== ConvertTo-SecureString : Key not valid for use in specified state ===
This is the error you get if you try to decrypt the contents of your password file using a user account other than that which was used to encrypt it.
The password file must be created/encrypted as the same logged in user as the account under which the script will run.  Therefore if your script will be running from a scheduled task, run from a server using a service account, you must be logged onto the that machine with the service account when you create the file.


== Logged-In User's Credentials ==
== Logged-In User's Credentials ==

Navigation menu