PoShPACLI icon indicating copy to clipboard operation
PoShPACLI copied to clipboard

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

Open InconstantRO opened this issue 2 years ago • 0 comments

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

Your Environment

  • PowerShell Version: 5.1
  • PoShPACLI Version: 2.1.27
  • PACLI Version: 12.2.0.70
  • CyberArk Version: 12.2.4

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.

InconstantRO avatar Dec 16 '22 14:12 InconstantRO