Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-PasUser gives error 500 #464

Closed
redboyhun opened this issue Mar 30, 2023 · 2 comments
Closed

Get-PasUser gives error 500 #464

redboyhun opened this issue Mar 30, 2023 · 2 comments

Comments

@redboyhun
Copy link

Describe the issue

PS M:\> Get-PASUser -Search Prov
Invoke-PASRestMethod : [500] An item with the same key has already been added.
At line:167 char:13
+ ...   $result = Invoke-PASRestMethod -Uri $URI -Method GET -WebSession $S ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: ({"ErrorCode":"C...y been added."}:ErrorRecord) [Invoke-PASRestMethod], Exception
    + FullyQualifiedErrorId : CAWS00001E,Invoke-PASRestMethod

Getting this error, even if that is the first command after psPAS login

Your Environment
Include relevant details about your environment

  • PowerShell Version: 5.1.19041.2364
  • psPAS Version: 5.5.110
  • CyberArk Version: 12.2.0

Additional tests
Working with specific id:

PS M:\> Get-PASUser -id 3

ID UserName Source   UserType       Suspended enableUser ExpiryDate Location
-- -------- ------   --------       --------- ---------- ---------- --------
3  Auditor  CyberArk Built-InAdmins False     False                 \

Not working for listing all:

PS M:\> Get-PASUser
Invoke-PASRestMethod : [500] An item with the same key has already been added.
At line:167 char:13
+ ...   $result = Invoke-PASRestMethod -Uri $URI -Method GET -WebSession $S ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: ({"ErrorCode":"C...y been added."}:ErrorRecord) [Invoke-PASRestMethod], Exception
    + FullyQualifiedErrorId : CAWS00001E,Invoke-PASRestMethod

Not working with -Username:

PS M:\> Get-PASUser -UserName Auditor
Invoke-PASRestMethod : [500] An item with the same key has already been added.
At line:167 char:13
+ ...   $result = Invoke-PASRestMethod -Uri $URI -Method GET -WebSession $S ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: ({"ErrorCode":"C...y been added."}:ErrorRecord) [Invoke-PASRestMethod], Exception
    + FullyQualifiedErrorId : CAWS00001E,Invoke-PASRestMethod

Working with Username and Gen1API:

PS M:\> Get-PASUser -UserName Auditor -UseGen1API

ID UserName Source   UserTypeName   Suspended Disabled ExpiryDate Location
-- -------- ------   ------------   --------- -------- ---------- --------
   Auditor  Internal Built-InAdmins False     True                \
@redboyhun redboyhun changed the title Get-PasUser gives error 500r Get-PasUser gives error 500 Mar 30, 2023
@pspete
Copy link
Owner

pspete commented Apr 3, 2023

Hi @redboyhun

Is it working outside of the module?
You can use something similar to the below

#after New-PASSession
$ThisSession = Get-PASSession

$Method = "GET"
$UrlPath = "API/Users/"

$Request = @{
    "Method"      = $Method
    "Uri"         = "$($ThisSession.BaseUri)/$UrlPath"
    "WebSession"  = $ThisSession.WebSession
    "ContentType" = "application/json"
}

Invoke-RestMethod @Request

@pspete
Copy link
Owner

pspete commented Apr 11, 2023

As it is an error of the "500" type, assumption is that it is not an issue with the module.
Closing the issue based on this.
If assumption incorrect, comment here with the details to reopen.

@pspete pspete closed this as completed Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants