pspete / PoShPACLI

Powershell Module for CyberArk PACLI
MIT License
72 stars 19 forks source link

New-PVLogonFile parse error, expecting `';'' if PV_Configuration.xml already exists #75

Open InconstantRO opened 1 year ago

InconstantRO commented 1 year ago

Your issue may already be reported. Please search existing issues before creating one.

Your Environment

Expected Behaviour

New-PVLogonFile should create new logon file

Current Behaviour

I receive an error: parse error, expecting `';'

Possible Solution

Replace $Null = Invoke-PACLICommand $Script:PV.ClientPath CREATELOGONFILE $($PSBoundParameters | ConvertTo-ParameterString) With $Null = Invoke-PACLICommand $Script:PV.ClientPath CREATELOGONFILE $($PSBoundParameters | ConvertTo-ParameterString -NoVault -NoUser) In New-PVLogonFile.ps1 file

Steps to Reproduce (for bug reports)

  1. Pre-generate PV_Configuration.xml file, by running PACLI logon normally. Example commands to be run to generate that file: Set-PVConfiguration -ClientPath $pacliPath Start-PVPacli -sessionID $sessionID New-PVVaultDefinition -vault $vaultName -address $vaultAddress Connect-PVVault -user $creds.UserName -password $creds.Password Disconnect-PVVault Stop-PVPacli
  2. Try to run commands below again, once PV_Configuration.xml file already exists, and you'll get an error Set-PVConfiguration -ClientPath $pacliPath Start-PVPacli -sessionID $sessionID New-PVLogonFile -logonFile $Global:hash.pacliLogonFilePath -username $creds.UserName -password $creds.Password

I think the problem is that CREATELOGONFILE doesn't accept vault and user attributes, but when PV_Configuration.xml is already pre-created, script is using params from old file.

Context

I'm trying to generate new logon file to be used later.