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:
=======================================
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) ...
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 - ...
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 - ...
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
Version/Tag number
v2.5.0
Environment setup
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.
$_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
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
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
Logoff Session...
Vaulted 0 out of 2 accounts successfully.
LogoffUrl