How to use Get-PASAccount selecting Address

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use Get-PASAccount selecting Address

L1 Bithead

Hi all,

 

I am working on some automation scripts for our break-glass accounts. Due to some server limitations where these accounts get provisioned, I have to use net.exe commands vice PowerShell because we can't import the LocalAccounts module.

Because of this, I have to input a password in the net command. This is not desirable for obvious reasons.

 

I am attempting to make some changes to reconcile the account when it is onboarded into CyberArk (in the same script) so the password will change. Until those get approved, I am trying to force a reconcile inside the script using Get-PASAccount and Invoke-PASCPMOperation. I have many accounts in one safe for the break-glass, and at v9.10 I am limited with the Get-PASAccount cmdlet.

 

What I feel should work is Get-PASAccount -Keywords 'keyword' | Where-Object Address -eq 'this identifying address'. This is not giving me the address, or any output other than the warning for >10 accounts found.

 

Ultimately, I need to pull the Account ID of the account that the script creates and use that for the PASCPMOperation to reconcile the account.

 

Long post, any ideas?

1 accepted solution

Accepted Solutions

L6 Presenter

At version 9.10, the API will only return the details of the first account it finds. The "Where-Object" statement becomes redundant as there will only ever be a maximum of 1 result.

The response from the API indicates that "keyword" matches multiple accounts, there is a high chance the account the API finds for you is not the one you want.

This changes at version 10.4, where you can get details of any accounts you have rights to view.

 

Try Get-PASAccount -Keywords 'keyword1, keyword2, keyword3' to see if you can narrow down the results. Maybe use an account that can only see the accounts in the safe they get added to.

Away from the API, depending on the platform configuration, adding the account with an incorrect password would in effect force a reconcile after the account fails verification.

View solution in original post

3 REPLIES 3

L6 Presenter

At version 9.10, the API will only return the details of the first account it finds. The "Where-Object" statement becomes redundant as there will only ever be a maximum of 1 result.

The response from the API indicates that "keyword" matches multiple accounts, there is a high chance the account the API finds for you is not the one you want.

This changes at version 10.4, where you can get details of any accounts you have rights to view.

 

Try Get-PASAccount -Keywords 'keyword1, keyword2, keyword3' to see if you can narrow down the results. Maybe use an account that can only see the accounts in the safe they get added to.

Away from the API, depending on the platform configuration, adding the account with an incorrect password would in effect force a reconcile after the account fails verification.

L1 Bithead

Hey Pete, thanks for the response. And thanks for the psPAS, I use it every single day. Looking forward to upgrading (hopefully) so I won't have to deal with a lot of the API shortcomings in <10.

 

The change I am requesting is what you're talking about in the platform configuration. I want it to verify on onboarding, then add the failure code that will cause the reconcile, but I have to wait for the process.

 

When I login to my work computer tomorrow I will try your suggestion and let you know.

L1 Bithead

That worked to find the one I want. Pulled the AccountID to pass to the Invoke-PASCPMoperation -AccountID $​ID -ReconcileTask -UseClassicAPI and it gives me an invalid parameter for the whole command, but works without using a variable.

  • 1 accepted solution
  • 982 Views
  • 3 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!