Skip to content

Instantly share code, notes, and snippets.

@infamousjoeg
Last active September 23, 2017 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infamousjoeg/b2730422d55a14d1ee9297d62bfd7203 to your computer and use it in GitHub Desktop.
Save infamousjoeg/b2730422d55a14d1ee9297d62bfd7203 to your computer and use it in GitHub Desktop.
function Get-AIMPassword ([string]$PVWA_URL, [string]$AppID, [string]$Safe, [string]$ObjectName) {
# Declaration
$fetchAIMPassword = "${PVWA_URL}/AIMWebService/api/Accounts?AppID=${AppID}&Safe=${Safe}&Folder=Root&Object=${ObjectName}"
# Execution
try {
$response = Invoke-RestMethod -Uri $fetchAIMPassword -Method GET -ContentType "application/json" -ErrorVariable aimResultErr
Return $response.content
}
catch {
Write-Host "StatusCode: " $_.Exception.Response.StatusCode.value__
Write-Host "StatusDescription: " $_.Exception.Response.StatusDescription
Write-Host "Response: " $_.Exception.Message
Return $false
}
}
$password = Get-AIMPassword -PVWA_URL "https://pvwa.cyberark.local" -AppID "ApplicationID" -Safe "SafeName" -ObjectName "ObjectName"
Write-Host "Your password is: ${password}"
@infamousjoeg
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment