Skip to content

Instantly share code, notes, and snippets.

@secpg
Last active August 7, 2018 17:37
Show Gist options
  • Save secpg/a58cf817c53cd019364229fa58783bcf to your computer and use it in GitHub Desktop.
Save secpg/a58cf817c53cd019364229fa58783bcf to your computer and use it in GitHub Desktop.
CyberArk CCP - This script will perform a GET Password call to the CCP using client certificate authentication. The user will be prompted for the certificate PW at runtime.
#### ####
## ##
# This script will call the CCP using client certificate authentication #
# You will be prompted for the pfx file password #
## ##
#### ####
# Declare Variables
$BASEURL="___" #example: "https://pvwa.cyberark.com"
$SAFE="___" #CyberArk Safe name
$APPID="___" #CyberArk Application ID
$FOLDER="Root" #CyberArk Safe Folder - Default=Root
$OBJECT="___" #CyberArk object "Name"
$CERTPATH="___" #example: C:\path\to\cert.pfx
# Retrieve Certificate
$CERT=Get-PfxCertificate -FilePath $CERTPATH
# Call the CCP
Invoke-RestMethod -Uri "$BASEURL/AIMWebService/api/Accounts?AppID=$APPID&Safe=$SAFE&Folder=$FOLDER&Object=$OBJECT" -Method Get -CertificateThumbprint $CERT.ThumbPrint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment