epv-api-scripts
epv-api-scripts copied to clipboard
Get-DiscoveredAccountsReport.ps1 - Format-URL errors when using filter options
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?
Can you please provide the line numbers?
Line 561, 569 and 601. Thanks!
Still needs review
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
- ... alue $(Get-LogonHeader -Credentials $creds -concurrentSession $concur ...
-
~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidArgument: (:) [Get-LogonHeader], ParameterBindingException
- FullyQualifiedErrorId : NamedParameterNotFound,Get-LogonHeader
I tried to login with CyberArk authentication type or with Radius authentication type. Getting the same error message.
Can you help?