Powershell & retrieving all property values of an object
When using Powershell Get- cmdlets, properties of objects with multiple values can be cut off from the display when there are more than 4 values, shown by the presence of an ellipsis "...". For example:
PS > Get-Process chrome | Select-Object -Property Name, Threads
Name Threads
---- -------
chrome {22028, 16880, 21516, 19624...}
chrome {21652, 22216, 20708, 5416...}
chrome {19324, 20720, 15220, 4392...}
chrome {22000, 22440, 14148, 11320...}
chrome {20704, 18532, 4880, 20552...}
chrome {8204, 9296, 20712, 17148...}
chrome {5884, 11812, 18120, 21216...}
chrome {14656, 504, 21756, 21976...}
chrome {14184, 6480, 22100, 6920...}
chrome {2776, 8108, 156, 14864...}
This can be avoided by piping to Select-Object with the -ExpandProperty switch and specifying the one property you need expanded. However, this limits you to expanding one property at a time.
If you need more than 4 property values in the output for multiple properties in one command, you can instead use the Preference Variable $FormatEnumerationLimit. As may be obvious from the above output, the default value of this variable is 4. To ensure you include all property values in your output, you can set this to -1:
$FormatEnumerationLimit = -1
If we run the above Get-Process from before, our displayed output would now be:
PS > Get-Process chrome | Select-Object -Property Name, Threads
Name Threads
---- -------
chrome {22028, 16880, 21516, 19624, 6304, 2800, 10300, 10212, 21748, 9656, 13176, 18516, 21196, 21920, 7760, 15108, 20532, 14020, 12884, 9124, 7052, 21488, 22508, 23128}
chrome {21652, 22216, 20708, 5416, 15104, 8924, 6520, 16220, 6080, 15700, 19296, 8608, 9276, 1332}
chrome {19324, 20720, 15220, 4392, 10788, 14152, 17116, 4736, 20996, 10620, 15804, 6000, 3372, 18728, 832, 4164, 1648, 10936, 5976}
chrome {22000, 22440, 14148, 11320, 21900, 12168, 12760, 21808, 3568, 20620, 2632, 7952, 15100, 32, 3464, 10480, 960, 13856, 9280, 18304, 2120, 13672, 2368, 22072, 18428}
chrome {20704, 18532, 4880, 20552, 19800, 12044, 11376, 15548, 16680, 22064, 21540, 796, 20176, 10268, 7824, 15684, 20960, 20536, 22396, 8312}
chrome {8204, 9296, 20712, 17148, 21680, 5908, 21912}
chrome {5884, 11812, 18120, 21216, 10952, 6160, 2500, 22332, 17028, 21452, 6428}
chrome {14656, 504, 21756, 21976, 19860, 14888, 15560, 21720, 18968, 21308, 17036, 10872, 20292, 17040, 22152, 480, 27528, 23448}
chrome {14184, 6480, 22100, 6920, 17948, 21692, 12912, 19804, 20680, 17556, 15992, 21252, 10228, 15160, 8028, 12280, 16612, 3732, 21204}
chrome {2776, 8108, 156, 14864, 13256, 16732, 22172, 21112, 8452, 20968, 1136, 4016, 13404, 19104, 3120, 12616, 22192, 13016, 21760, 21020}
Preference variables will reset to their default values after that Powershell session is closed. For the variable to persist between sessions, you can consider using Powershell profiles.