Thanks everyone for you help. It was my fault. The output of ConvertFrom-JSON was not a hashtable, so splatting did not work. You can find online for a cmdlet to convert the output to a hashtable, or in Powershell Core (Powershell version 6 and above) use ConvertFrom-JSON -AsHashtable.
Powershell 5.1 variable splatting not working properly with Add-PASSafeMember
I'm using this module pspas.pspete.dev, and I try to splat this $groupConfig variable which is a hash table (values in error message below). So running
Add-PASSafeMember @groupConfig
returns this error
Add-PASSafeMember : A positional parameter cannot be found that accepts argument '@{SafeName=Phuc2403_4;
MemberName=SafeAccess_Phuc2403_4_Owner; UseAccounts=True; RetrieveAccounts=True; ListAccounts=True; AddAccounts=True;
UpdateAccountContent=True; UpdateAccountProperties=True; InitiateCPMAccountManagementOperations=True;
SpecifyNextAccountContent=True; RenameAccounts=True; DeleteAccounts=True; UnlockAccounts=True; ManageSafe=True;
ManageSafeMembers=True; BackupSafe=True; ViewAuditLog=True; ViewSafeMembers=True; RequestsAuthorizationLevel=2;
AccessWithoutConfirmation=True; CreateFolders=True; DeleteFolders=True; MoveAccountsAndFolders=True}'.
At line:1 char:1
+ Add-PASSafeMember @groupConfig
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Add-PASSafeMember], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Add-PASSafeMember
Thanks everyone for any suggestion.
2 additional answers
Sort by: Most helpful
-
Ian Xue (Shanghai Wicresoft Co., Ltd.) 29,651 Reputation points Microsoft Vendor
2021-03-25T04:50:05.3+00:00 Hi,
As it's a third-party module you can report the issue to the author.
https://github.com/pspete/psPAS/issuesBest Regards,
Ian Xue============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. -
Rich Matheisen 44,776 Reputation points
2021-03-24T19:10:15.38+00:00 Did the module writer code for the use of splatted parameters? That's a question you should ask the module's author.