![]() Here's an attempt to retain the efficiency while eliminating the need for repetition of the value name, which, however, is still a little cumbersome:īy using a script block, the value name can be passed in once as a parameter, and the parameter variable ( $args) can then simply be used twice inside the block.Īlternatively, a simple helper function can ease the pain: Get-ItemPropertyValue cmdlet was introduced in Powershell v5, which solves the problem: Harry Martyrossian mentions in a comment on his own answer that the ![]() ![]() '15.0' - because the value names are passed as parameters and property access happens via a variable e.g. Note: All solutions below bypass the problem described in Ian Kemp's's answer - the need to use explicit quoting for certain value names when used as property names e.g. M Jeremy Carter's helpful answer is more convenient, but can be a performance pitfall for keys with a large number of values, because an object with a large number of properties must be constructed.Andy Arismendi's helpful answer explains the annoyance with having to repeat the value name in order to get the value data efficiently.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |