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

Accounts_Onboard_Utility fails #409

Open
PinkyAndDaBrain opened this issue Sep 26, 2024 · 1 comment
Open

Accounts_Onboard_Utility fails #409

PinkyAndDaBrain opened this issue Sep 26, 2024 · 1 comment
Labels

Comments

@PinkyAndDaBrain
Copy link

PinkyAndDaBrain commented Sep 26, 2024

Summary

We upgraded to 14.2. Our account onboarding script stopped working. We tried switching to the current script instead of the older version we were using from 2021, but the script still fails.

Reproducible

  • [X ] Always

Version/Tag number

v2.5.0

Environment setup

  • Can you describe the environment in which this product is running? CyberArk is hosted on Windows Server 2016 VMs in vCenter. Script is being ran from Server 2022 environments.

Additional Information

When running the script, it fails when evaluating $_safeOwners due to the null value of $_safeMembers.members. It seems like the API is returning the data in a different format than expected to the powershell script.

This is the same command we have been using successfully for years:

Accounts_Onboard_Utility.ps1 -PVWAURL "https://PVWAFQDN/PasswordVault" -CsvPath .\onboard_accounts_test.csv -Create -TemplateSafe "Safe_ca_Template"

$_safeOwners = $_safeMembers.members | Where-Object { $_.UserName -NotIn $_defaultUsers } | Select-Object -Property @{Name = 'MemberName'; Expression = { $_.UserName } }, Permissions

There is no "members" property in $_safeMembers object.

image (6)

$_SafeMembers= {

@{safeUrlId=Safe_ca_Template; safeName=Safe_ca_Template; safeNumber=116; memberId=##; memberName=PasswordManager; memberType=User; membershipExpirationDate=; isExpiredMembershipEnable=False; isPredefinedUser=False; isReadOnly=False; permissions= },

@{safeUrlId=Safe_ca_Template; safeName=Safe_ca_Template; safeNumber=116; memberId=###; memberName=svc_ecscyb_safemgmt; memberType=User; membershipExpirationDate=; isExpiredMembershipEnable=False; isPredefinedUser=False; isReadOnly=False; permissions= },

@{safeUrlId=Safe_ca_Template; safeName=Safe_ca_Template; safeNumber=116; memberId=##; memberName=svc_Servicename; memberType=User; membershipExpirationDate=; isExpiredMembershipEnable=False; isPredefinedUser=False; isReadOnly=False; permissions=}}

SCRIPT OUTPUT

=======================================
Welcome to Accounts Onboard Utility

Starting script (v2.5.0)
Current version (2.5.0) is the latest!

Getting PVWA Credentials to start Onboarding Accounts
Checking Template Safe...
Safe Safe_ca_Template exists
You cannot call a method on a null-valued expression.
At C:\temp\Accounts_Onboard_Utility.ps1:1484 char:7

  •     If ($TemplateSafeMembers.MemberName.Contains($creds.UserName) ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

Reading CSV from :C:\temp\onboard_accounts_test.csv

Starting to Onboard 2 accounts
Safe safe_ca_BRTest12 exists
CSV Line: 2
SafeName: ""
Username: "BRTest12"
Address: "DOMAIN"
Object: ""
Error Message: {"Details":[{"ErrorCode":"PASWS031E","ErrorMessage":"Safe [safe_ca_BRTest12] was not found","ParameterName":"safeName"}],"ErrorCode":"PASWS167E","ErrorMessage":"There are so
me invalid parameters"}
Exception Message: The remote server returned an error: (400) Bad Request.
Status Code: 400
Status Description: Bad Request
Index operation failed; the array index evaluated to null.
At C:\temp\Accounts_Onboard_Utility.ps1:939 char:6

  • If ($Global:BadAccountHashTable[$global:workAccount.name].count - ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArrayIndex

Safe safe_ca_BRTest22 exists
CSV Line: 3
SafeName: ""
Username: "BRTest22"
Address: "Domain"
Object: ""
Error Message: {"Details":[{"ErrorCode":"PASWS031E","ErrorMessage":"Safe [safe_ca_BRTest22] was not found","ParameterName":"safeName"}],"ErrorCode":"PASWS167E","ErrorMessage":"There are so
me invalid parameters"}
Exception Message: The remote server returned an error: (400) Bad Request.
Status Code: 400
Status Description: Bad Request
Index operation failed; the array index evaluated to null.
At C:\temp\Accounts_Onboard_Utility.ps1:939 char:6

  • If ($Global:BadAccountHashTable[$global:workAccount.name].count - ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : NullArrayIndex

Logoff Session...

Vaulted 0 out of 2 accounts successfully.

LogoffUrl

@PinkyAndDaBrain
Copy link
Author

Updated with new output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant