Closed sgarrison77 closed 11 months ago
Update... when running the script with -verbose enabled, I see that it's taking time to process mainly due to these safes containing large numbers of accounts within... typically 8k-18k accounts in each safe.
It seems to be pulling objects from the safe 100 at a time, is it possible to increase the number of accounts it pulls per Invoke from 100 to something much larger?
Verbose Log Example:
[2023-09-20 01:03:13] [VERBOSE] Invoke-RestMethod -Uri https://<pvwa fqdn>/PasswordVault/api/Accounts?filter=safename eq <safename> -Method Get -Header System.Collections.Hashtable -ContentType "application/json" -TimeoutSec 2700
[2023-09-20 01:03:18] [VERBOSE] Invoke-REST Response: @{value=System.Object[]; count=13178; nextLink=api/Accounts?offset=100&**limit=100**&filter=safename+eq+<safename>}
[2023-09-20 01:03:18] [VERBOSE] Invoke-RestMethod -Uri https://<pvwa fqdn>/PasswordVault/api/Accounts?offset=100&**limit=100**&filter=safename+eq+<safename> -Method Get -Header System.Collections.Hashtable -ContentType "application/json" -TimeoutSec 2700
[2023-09-20 01:03:23] [VERBOSE] Invoke-REST Response: @{value=System.Object[]; count=13178; nextLink=api/Accounts?offset=200&**limit=100**&filter=safename+eq+<safename>}
I have found a resolution... the switch "WideAccountsSearch" was not working in combination with the -Delete switch.
I modified the script to add 'Delete' parameter to the "WideAccountsSearch" switch.... the time it takes to delete the accounts has dropped from 24minutes to ~12 seconds per account.
95 #Use this switch when "WideAccountsSearch" is enabled use to quicken searches via name"
96 [Parameter(ParameterSetName = 'Update', Mandatory = $false)]
97 [Parameter(ParameterSetName = 'Delete', Mandatory = $false)]
98 [Switch]$WideAccountsSearch,
resolved
I need to delete several thousand accounts from multiple safes in our vault. Using the -Delete flag, I'm trying to delete accounts from a .csv and it's taking more than 20 minutes per account to delete... here's my log out put (account/host/safe names obscured)
Our PAS environment version is v12.2
Any suggestions?
As you can see, 24 minutes passed to get the "Deleted successfully" result for the first account on the list.
Command Syntax Used
.\Accounts_Onboard_Utility.ps1 -PVWAURL "https://<pvwa fqdn>/PasswordVault" -Delete -CsvPath '.\delete_accounts - linux.csv'
Log: