Jump to content


  • Content count

  • Joined

  • Last visited

  1. Hello all. We have recently been reviewing our PowerShell scripts and decided to come up with a function our support staff can use when they want/need a password to be retrieved from Passwordstate. Now the below assumes you have the appropriate IP/Subnets defined and an appropriate API key to retrieve records. This is nothing special, but thought it may help others who are unaware the ease of retrieving records via Passwordstate. This requires PowerShell v3 to leverage 'Invoke-RestMethod' cmdlet. function Get-Password { <# Requires PowerShell v3 for Invoke-RestMethod support Retrieves password record from Passwordstate #> [CmdletBinding()] Param ( [Parameter(Mandatory = $true, Position = 0)] $Id, [Parameter(Mandatory = $true, Position = 1)] $APIKey ) Invoke-RestMethod -Uri https://pstate.domain.org/api/passwords/$($Id)?apikey=$($APIKey) -Method Get } You can then retrieve a record in this manner: $ID = "1234" $APIKey = "12345678900987654321" $Creds = Get-Password -Id $ID -APIKey $APIKey Once you have retrieved the record, you can convert it to a PowerShell credential object for later use: $User = $Creds.Username $Pswd = ConvertTo-SecureString -String $Creds.Password -AsPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential ($User, $Pswd) At this point you can specify the $Credential for cmdlets that support it and no longer store credentials in plain text (or even via "secure string"): Get-Service -ComputerName SRV01 -Name "BITS" -Credential $Credential
  2. During an import, it seems there could be some streamlining done to the process. As an example, the workflow piece that would not change would be Import > Generate CSV Template > (Update template) > click Browse > Select saved template file. At the point where the file is staged and ready for Test/Import, I think there should be an option to proceed with the import if the test is successful. Currently we have to select Continue > (Browse for file again) > Select Import. Example attached. I'm not sure if 'Continue' at that point would be confusing or not, but it does seem unnecessary after a successful test to have to re-do all the steps. The other option would be when you select Continue if the file could already be stored and you just need to select Import Passwords.