Open InconstantRO opened 3 years ago
Also I think it could be possible to normalize it in that way that later you can use ConvertFrom-Csv function, which also supports multi-line attributes and can grab it correctly natively and afterwards you will have parameter contain also multi-line string, instead of single line normalized line, as I did above. I belive that it is enough to replace double quotes " with single ' qote in the CPM Error message Headers are just for example below, h1, h2, etc.. could be replaced by "Filename", "Accessed", etc..
$header = "h1", "h2", "h3", "h4", "h5", "h6", "h7", "h8", "h9", "h10", "h11", "h12", "h13", "h14", "h15", "h16", "h17", "h18", "h19", "h20", "h21", "h22", "h23", "h24", "h25", "h26", "h27", "h28", "h29", "h30", "h31", "h32"
$csvPo = $normalizedoutput | ConvertFrom-Csv -Header $header
Your issue may already be reported. Please search existing
issues
before creating one.Your Environment
PowerShell Version: Name Value
PSVersion 5.1.17763.1852 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.17763.1852 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
PoShPACLI Version: ModuleVersion = '2.1.27'
PACLI Version: File version: 11.1.0.59 Product version: 11.01.0
CyberArk Version: 11.1
Expected Behaviour
Find-PVFile function should provide the list of files and deatails about each file in the safe.
Current Behaviour
This function stops returning correct file details after one of the files contains attribute with multi-line content. For example, if FileCategories attribute contains CPMErrorDetails value wich spans on multiple lines.
Possible Solution
Before sending output to ConvertFrom-PacliOutput normalize it to avoid new lines and also # characters in the CPM error. Here is example code:
Also it could be good to check the $Results.length to make sure that it can be divided by 32 without leftovers. If you get floating number, by division on 32, then your properties are shifted.
Steps to Reproduce (for bug reports)
1 . Create some attribute on account which accepts multiline input and set it.
2 . Add several accounts in the safe. All of them may contain this multiline attribute set or only some accoutns may have this attribute set.
3 . Try to use Find-PVFile function to query all accounts in the safe.
Here is example output, before it being processed by ConvertFrom-PacliOutput function, you can use it to reproduce the issue. Here I have 2 accounts in the safe:
4 . Check the output and notice that after account with multi-line attribute all properties of other accounts would not be displayed correctly, because in the function below you expect that each property is located in a separate line, but in our case lines are shifted down because of multi-line property value:
Sample Output
Context
I'm getting the list of all accounts in safe with all their attributes, including filecategories and export it as a table.