cyberark / epv-api-scripts

These API scripts enable CyberArk users to automate privileged account management task like account creation, user management, and more.
https://www.cyberark.com/best
Apache License 2.0
201 stars 176 forks source link

Unable to Get Account Report more than 1000 account #203

Closed engkeen-source closed 2 years ago

engkeen-source commented 3 years ago

Summary

I use powershell get-accounts.ps1 module and specify -AutoNextPage but the csv generated report only capture 1000 account, I want to capture all account in my environment which have around 100k.

Steps to Reproduce

Execute powershell script as shown in picture. Untitled

Expected Results

The csv report should return all account(more than 1000)

Actual Results

The csv report only return 1000 account

Reproducible

Version/Tag number

Environment setup

Additional Information

Add any other context about the problem here.

AssafMiron commented 3 years ago

Hello @engkeen-source ,

We just pushed an update to this script (see #182) Would you mind to download the newest version and try again? Running the script with -Debug -Verbose might also help in the case for you to see all the actions that are done, especially see if the script is able to return the next link (to get more accounts than 1000)

Regards, Assaf

AssafMiron commented 3 years ago

Hi @engkeen-source ,

After consulting with R&D I created a new fix for the issue in this branch (https://github.com/cyberark/epv-api-scripts/blob/GetAccounts_fixes/Get%20Accounts/Get-Accounts.ps1) Would you be able to verify that this solves this issue?

Thanks, Assaf

engkeen-source commented 3 years ago

Hi @AssafMiron

I tested and below is the output.

It didn't return anything

######################Script cd 'D:\REST_API\Github CyberArk\epv-api-scripts-main\epv-api-scripts-main\Get Accounts'

$PVWAURL = 'https://xxxx/passwordvault'

.\Get-Accounts.ps1 -PVWAURL $PVWAURL -List -Report -limit 1000 -AutoNextPage -CSVPath .\Report.csv -Debug -Verbose

######################Console PS D:\REST_API\Github CyberArk\epv-api-scripts-main\epv-api-scripts-main\Get Accounts>> D:\REST_API\test.ps1 VERBOSE: HEAD https://xxxx/passwordvault with 0-byte payload VERBOSE: received 17-byte response of content type VERBOSE: HEAD https://xxxx/passwordvault with 0-byte payload VERBOSE: received 17-byte response of content type VERBOSE: POST https://xxxx/passwordvault/api/auth/cyberark/Logon with -1-byte payload VERBOSE: received 182-byte response of content type application/json; charset=utf-8 Retrieving accounts... DEBUG: Limit: 1000 DEBUG: URL: https://xxxx/passwordvault/api/Accounts?limit=1000 DEBUG: https://xxxx/passwordvault/api/Accounts?limit=1000 VERBOSE: GET https://xxxx/passwordvault/api/Accounts?limit=1000 with 0-byte payload VERBOSE: received 354648-byte response of content type application/json; charset=utf-8 VERBOSE: GET https://xxxx/passwordvault/api/Platforms/ with 0-byte payload VERBOSE: received 275006-byte response of content type application/json; charset=utf-8 Logoff Session... VERBOSE: POST https://xxxx/passwordvault/api/auth/Logoff with 0-byte payload VERBOSE: received 16-byte response of content type application/json; charset=utf-8

PS D:\REST_API\Github CyberArk\epv-api-scripts-main\epv-api-scripts-main\Get Accounts>>

######################Report "id","UserName","Address","SafeName","Platform","CreateDate" ,,,,,"1/1/1970 12:00:00 AM"

engkeen-source commented 3 years ago

Hi @AssafMiron

Note that I added line 271

Else it will keep prompt for confirmation

image

AssafMiron commented 3 years ago

Hi @engkeen-source

I pushed a new change that I hope would solve the issue - would you mind testing in your environment using the changes in the GetAccounts_fix branch?

Thanks, Assaf

On Tue, Aug 17, 2021 at 7:07 AM engkeen-source @.***> wrote:

Hi @AssafMiron https://github.com/AssafMiron

Note that I added line 271

Else it will keep prompt for confirmation

[image: image] https://user-images.githubusercontent.com/71132168/129662072-45753d92-286b-4efe-a992-1302b2f7c5ba.jpeg

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cyberark/epv-api-scripts/issues/203#issuecomment-899977596, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3PN3IDUZBC5M5CMPXWR73T5HOA5ANCNFSM5CA66LOQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .