Created
April 13, 2022 20:57
-
-
Save ryanvgates/7627a2e608b547ecdd7c2c5516886978 to your computer and use it in GitHub Desktop.
CyberArk PowerShell Login
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Type -AssemblyName System.Web | |
$cred = Get-Credential -Message "Please enter the credentials for logging into CyberArk host cyberarkhost.com" -UserName $env:UserName | |
$AUTH_URI = "https://cyberarkhost.com/PasswordVault/API/auth/LDAP/Logon" | |
$Headers = @{'accept'='application/json';'content-type'='application/json'} | |
$body=@{ | |
username = "$($cred.UserName)" | |
password= "$($cred.GetNetworkCredential().password)" | |
} | |
$CyberBody = $body | convertto-json | |
$token = Invoke-RestMethod -Method Post -Uri $AUTH_URI -Body $CyberBody -Headers $Headers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment