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
197 stars 176 forks source link

Get-DiscoveredAccountsReport.ps1 - Format-URL errors when using filter options #318

Open LCM2023 opened 1 year ago

LCM2023 commented 1 year ago

When executing the api, it works as long as there's no filtering added. As soon as there's a filter, then the Format-URL error appears

.\Get-DiscoveredAccountsReport.ps1 -PVWAURL https://_subdomain_.privilegecloud.cyberark.com/passwordvault -List -PlatformType "Windows Server Local" -SearchKeywords "svc" -AutoNextPage -CSVPath "C:\temp\svc_pending.csv"

Error: There was an Error creating the filter URL. Error: Source:System.Management.Automation; Message: The term 'Format-URL' is not recognized as the name of a cmdlet, function , script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. There was an Error getting filtered Discovered Accounts. Error: Source:System.Management.Automation; Message: Cannot bind argument to parameter 'URI' because it is an empty string.

This should filter the pending safe results to only show accounts that have svc in the name and are of type Windows Local Server however I get the error above. I have tried various filters and all have the same outcome. If I remove the filters, then it runs as expected.

I found 3 references to Format-URL in the api: $retURL += "search=$(Format-URL $sSearch)&" $filters += "platformType eq $(Format-URL $sPlatformType)" $retURL += "sort=$(Format-URL $sSortParam)&"

Any idea why I would be getting that message?

bab29 commented 1 year ago

Can you please provide the line numbers?

LCM2023 commented 1 year ago

Line 561, 569 and 601. Thanks!

bab29 commented 10 months ago

Still needs review

ckzip777 commented 2 weeks ago

When I run the script with the following options I get an error: Get-DiscoveredAccountsReport.ps1 -PVWAURL https://PAS.mydomain.com/PasswordVault -List -PlatformType "Windows Server Local" -SearchKeywords "Admin" -AutoNextPage -CSVPath "C:\temp\admin_August-2024.csv"

Get-LogonHeader : A parameter cannot be found that matches parameter name 'concurrentSession'. At C:\Users\administrator\Documents\Get-DiscoveredAccountsReport.ps1:678 char:95

I tried to login with CyberArk authentication type or with Radius authentication type. Getting the same error message.

Can you help?