Saving credentials for reuse by powershell and error ConvertTo-SecureString : Key not valid for use in specified state

前端 未结 5 2122
长情又很酷
长情又很酷 2020-11-29 07:07

I was doing something like described in this post to save credentials in a secured file so our automated process can use that to run remote PS scripts via Invoke-command: ht

5条回答
  •  温柔的废话
    2020-11-29 07:39

    ConvertFrom-SecureString takes a Key ( and SecureKey) parameter. You can specify the key to save the encrypted standard string and then use the key again in ConvertTo-SecureString to get back the secure string, irrespective of the user account.

    http://technet.microsoft.com/en-us/library/dd315356.aspx

    In a project, I have implemented asymmetric encryption, whereby people encrypt the password using the public key and the automation process has the private key to decrypt passwords: Handling passwords in production config for automated deployment

提交回复
热议问题