epv-api-scripts icon indicating copy to clipboard operation
epv-api-scripts copied to clipboard

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

Open LCM2023 opened this issue 1 year ago • 3 comments

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?

LCM2023 avatar Jan 31 '23 21:01 LCM2023