pspete / psPAS

PowerShell module for CyberArk Privileged Access Security REST API
https://pspas.pspete.dev
MIT License
293 stars 91 forks source link

Not able add remote Machines list while creating account with Add-PASAccount #310

Closed kentLee170 closed 4 years ago

kentLee170 commented 4 years ago

Describe the issue Hi Team, i need create new more than 1000 accounts that with different remote Machines list. Can you assist me on the command Add-PASAccount as i Not able add remote Machines list while creating account with Add-PASAccount.

below are my accounts.csv file UserName,Password,Address,LogonDomain,RemoteMachines,SafeName,PlatformID Pntb_pam_adea1,NoUpdateNeeded,T.com,T,server01;server02,PAM-Win-ADEA,PAMWindowDomain Pntb_pam_adea2,NoUpdateNeeded,T.com,T,server01;server02;DC01,PAM-Win-ADEA,PAMWindowDomain

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots & Console Output If applicable, add screenshots to help explain your problem. image

image

Console Output Code Block: $Accounts = Import-Csv -Path .\Accounts.csv

New-PASSession -Credential $creds -BaseURI https://server02.t.com

foreach($Account in $Accounts){

$Password = ConvertTo-SecureString -String $Account.Password -AsPlainText -Force

Add-PASAccount -secretType Password `
-secret $Password `
-platformAccountProperties @{"LOGONDOMAIN"=$Account.LogonDomain} `
-SafeName $Account.SafeName `
-PlatformID $Account.PlatformID `
-Address $Account.Address `
-Username $Account.Username`
-remoteMachines @{"remoteMachines"="$Account.remoteMachines"} `
-accessRestrictedToRemoteMachines $true

}



**Your Environment**
Include relevant details about your environment

* PowerShell Version:
* psPAS Version:4.4.71
* CyberArk Version:11.3

**Additional context**
Add any other context about the problem here.
pspete commented 4 years ago

Try:

-remoteMachines $Account.remoteMachines
kentLee170 commented 4 years ago

Hi pspete, thanks for the update, it work with -remoteMachines $Account.remoteMachines btw can we have -remoteMachines on Set-PASAccount, or how i bulky change -remoteMachines value on exiting accounts via Set-PASAccount

pspete commented 4 years ago

As per the examples:

Set-PASAccount -AccountID $someID -op replace -path "/remoteMachinesAccess/remotemachines" -value "Some;Machines;Here"
kentLee170 commented 4 years ago

thanks pspete

pspete commented 4 years ago

no problem @kentLee170