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 2 years ago • 4 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

Can you please provide the line numbers?

bab29 avatar Mar 17 '23 16:03 bab29

Line 561, 569 and 601. Thanks!

LCM2023 avatar Mar 17 '23 20:03 LCM2023

Still needs review

bab29 avatar Oct 24 '23 01:10 bab29

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?

ckzip777 avatar Aug 29 '24 12:08 ckzip777