{"id":4959,"date":"2016-03-01T12:18:16","date_gmt":"2016-03-01T17:18:16","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=4959"},"modified":"2016-03-01T12:18:16","modified_gmt":"2016-03-01T17:18:16","slug":"the-power-of-custom-properties","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/","title":{"rendered":"The Power of Custom Properties"},"content":{"rendered":"<p>The other day fellow PowerShell MVP Adam Bertram published an <a href=\"http:\/\/www.tomsitpro.com\/articles\/powershell-calculated-properties,2-5.html\" target=\"_blank\">article<\/a> about using custom properties with <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113387\" target=\"_blank\">Select-Object<\/a>. It is a good article in that it gets you thinking about PowerShell in terms of objects and not simple text. But I want to take Adam's article as a jumping off point and take his ideas a bit further. I'm going to use Adam's same example as a learning tool. Don't get distracted by other ways to get the same information. The process and techniques are what matter here.<\/p>\n<p>Whenever I'm working with PowerShell, I'm always thinking about how I can use this at scale.\u00a0 How can I get this same information for 10 or 100 servers? And of course,\u00a0 at this point I need to make sure I include a computername in the results.\u00a0 First, I'll try something with a single computer.<\/p>\n<pre class=\"lang:ps decode:true \">Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName chi-hvr1 |\r\nSelect PSComputername,@{Name = \"MemoryGB\";Expression = { ($_.Capacity | Measure -sum).sum\/1GB}}<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb.png\" alt=\"image\" width=\"644\" height=\"109\" border=\"0\" \/><\/a><\/p>\n<p>Close but not quite. <a title=\"read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=287299\" target=\"_blank\">Get-CimInstance<\/a> is writing multiple objects to the pipeline.\u00a0 The server in question has 2\u00a0 8GB sticks of memory which is what you see in the output. I need something more along Adam's original idea to that this becomes 16GB.<\/p>\n<p>What I really want is the Sum property from <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113349\" target=\"_blank\">Measure-Object<\/a> and to that I need to add a Computername property. I'll turn things around a bit.<\/p>\n<pre class=\"lang:ps decode:true \">Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName chi-hvr1 -PipelineVariable pv|\r\nMeasure-Object -Property capacity -Sum |\r\nSelect @{Name=\"Computername\";Expression={$pv.pscomputername}},\r\n@{Name=\"MemoryGB\";Expression = {$_.sum\/1GB}}<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb-1.png\" alt=\"image\" width=\"611\" height=\"245\" border=\"0\" \/><\/a><\/p>\n<p>This works because I'm using the common PipelineVariable parameter introduced in PowerShell 4.\u00a0 What happens is that the pipeline output from Get-CimInstance is stored in a variable, pv, which I can access later in the expression. In my case I'm defining a new property for the computername using $pv and adding it to the selected output from Measure-Object.<\/p>\n<p>However, if I try this for multiple computer names, I don't get the expected result.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb-2.png\" alt=\"image\" width=\"611\" height=\"241\" border=\"0\" \/><\/a><\/p>\n<p>That's because I'm adding up the physical memory instances from all servers, which isn't really what I want. Instead, this is a situation where I have to process each computer individually.<\/p>\n<pre class=\"lang:ps decode:true \">$computers = \"chi-hvr1\",\"chi-hvr2\",\"chi-web02\",\"chi-win10\",\"chi-tp04\",\"win81-ent-01\"\r\nforeach ($computer in $computers) {\r\n    Get-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $computer -PipelineVariable pv|\r\n    Measure-Object -Property capacity -Sum |\r\n    Select @{Name=\"Computername\";Expression={$pv.pscomputername}},\r\n    @{Name=\"MemoryGB\";Expression = {$_.sum\/1GB}}\r\n}<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb-3.png\" alt=\"image\" width=\"389\" height=\"262\" border=\"0\" \/><\/a><\/p>\n<p>One thing to be careful of when using the ForEach enumerator is that you can't pipe the output to another cmdlet like <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113299\" target=\"_blank\">Export-CSV<\/a>, unless you explicitly save the results to a variable.<\/p>\n<pre class=\"lang:ps decode:true \">$data = Foreach ($computer in $computers) { \u2026<\/pre>\n<p>Then you can pipe $data to other cmdlets. You can use <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113300\" target=\"_blank\">ForEach-Object<\/a> although it might be little harder to follow.<\/p>\n<pre class=\"lang:ps decode:true \">$computers | foreach {\r\nGet-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $_ -PipelineVariable pv|\r\n    Measure-Object -Property capacity -Sum |\r\n    Select @{Name=\"Computername\";Expression={$pv.pscomputername}},\r\n    @{Name=\"MemoryGB\";Expression = {$_.sum\/1GB}}\r\n} | Sort MemoryGB,Computername<\/pre>\n<p>But this makes it easier if you need to pipe the output to something else.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb-4.png\" alt=\"image\" width=\"515\" height=\"396\" border=\"0\" \/><\/a><\/p>\n<p>To wrap this up let's go all out and define a few more custom properties.<\/p>\n<pre class=\"lang:ps decode:true \">$computers | foreach {\r\nGet-CimInstance -ClassName Win32_PhysicalMemory -ComputerName $_ -PipelineVariable pv|\r\n    Measure-Object -Property capacity -Sum |\r\n    Select @{Name = \"Computername\";Expression={$pv.pscomputername}},\r\n    @{Name = \"Computer\";Expression = {\r\n     $cs = Get-CimInstance Win32_computersystem -ComputerName $pv.psComputername\r\n     #construct a string with manufacturer and model\r\n     \"$($cs.Manufacturer):$($cs.Model)\"\r\n    }},\r\n    @{Name = \"MemoryGB\";Expression = {$_.sum\/1GB}},\r\n    @{Name=\"NumberSticks\";Expression = {$_.Count}}\r\n} | Sort MemoryGB,Computername<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb-5.png\" alt=\"image\" width=\"644\" height=\"165\" border=\"0\" \/><\/a><\/p>\n<p>Even though I'm selecting a few properties from the output of Measure-Object, I'm defining several others which are calculated on the fly. There is so much you can do with this technique,\u00a0 but if I lost you anywhere please let me know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The other day fellow PowerShell MVP Adam Bertram published an article about using custom properties with Select-Object. It is a good article in that it gets you thinking about PowerShell in terms of objects and not simple text. But I want to take Adam&#8217;s article as a jumping off point and take his ideas a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New from the blog: The Power of Custom Properties in #PowerShell","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,8,19],"tags":[514,534,540,302],"class_list":["post-4959","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","category-wmi","tag-pipelinevariable","tag-powershell","tag-scripting","tag-select-object"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The Power of Custom Properties &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Power of Custom Properties &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"The other day fellow PowerShell MVP Adam Bertram published an article about using custom properties with Select-Object. It is a good article in that it gets you thinking about PowerShell in terms of objects and not simple text. But I want to take Adam&#039;s article as a jumping off point and take his ideas a...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-01T17:18:16+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"The Power of Custom Properties\",\"datePublished\":\"2016-03-01T17:18:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/\"},\"wordCount\":458,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/image_thumb.png\",\"keywords\":[\"pipelinevariable\",\"PowerShell\",\"Scripting\",\"Select-Object\"],\"articleSection\":[\"PowerShell\",\"Scripting\",\"WMI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/\",\"name\":\"The Power of Custom Properties &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/image_thumb.png\",\"datePublished\":\"2016-03-01T17:18:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/image_thumb.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/03\\\/image_thumb.png\",\"width\":644,\"height\":109},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4959\\\/the-power-of-custom-properties\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Power of Custom Properties\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Power of Custom Properties &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/","og_locale":"en_US","og_type":"article","og_title":"The Power of Custom Properties &#8226; The Lonely Administrator","og_description":"The other day fellow PowerShell MVP Adam Bertram published an article about using custom properties with Select-Object. It is a good article in that it gets you thinking about PowerShell in terms of objects and not simple text. But I want to take Adam's article as a jumping off point and take his ideas a...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/","og_site_name":"The Lonely Administrator","article_published_time":"2016-03-01T17:18:16+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"The Power of Custom Properties","datePublished":"2016-03-01T17:18:16+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/"},"wordCount":458,"commentCount":6,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb.png","keywords":["pipelinevariable","PowerShell","Scripting","Select-Object"],"articleSection":["PowerShell","Scripting","WMI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/","name":"The Power of Custom Properties &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb.png","datePublished":"2016-03-01T17:18:16+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/03\/image_thumb.png","width":644,"height":109},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4959\/the-power-of-custom-properties\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"The Power of Custom Properties"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1603,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/","url_meta":{"origin":4959,"position":0},"title":"Select Object Properties with Values","author":"Jeffery Hicks","date":"August 16, 2011","format":false,"excerpt":"Here's another concept I know I've written about in the past but that needed an update. A common technique I use when exploring and discovering objects is to pipe the object to Select-Object specifying all properties, get-service spooler | select *. There's nothing wrong with this approach but depending on\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2369,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2369\/get-ip-addresses-with-powershell\/","url_meta":{"origin":4959,"position":1},"title":"Get IP Addresses with PowerShell","author":"Jeffery Hicks","date":"June 6, 2012","format":false,"excerpt":"In celebration of World IPv6 Day, I thought I'd post a little PowerShell code to return IP addresses for a computer. This information is stored in WMI with the Win32_NetworkAdapterConfiguration class. This class will return information about a number of virtual adapters as well so I find it easier to\u2026","rel":"","context":"In &quot;Scripting&quot;","block_context":{"text":"Scripting","link":"https:\/\/jdhitsolutions.com\/blog\/category\/scripting\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/06\/networkcables-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":6478,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6478\/powershell-scripting-getting-git-size-retooled\/","url_meta":{"origin":4959,"position":2},"title":"Getting Git Size with PowerShell Retooled","author":"Jeffery Hicks","date":"January 30, 2019","format":false,"excerpt":"A few days ago I wrote about my experiences in designing a PowerShell function that reports on the size of the hidden .git folder. In that version of the function I decided to include a parameter that would permit the user to get the size pre-formatted as either KB, MB\u2026","rel":"","context":"In &quot;Git&quot;","block_context":{"text":"Git","link":"https:\/\/jdhitsolutions.com\/blog\/category\/git\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-29.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-29.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-29.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-29.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":9074,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9074\/the-value-of-objects\/","url_meta":{"origin":4959,"position":3},"title":"The Value of Objects","author":"Jeffery Hicks","date":"July 5, 2022","format":false,"excerpt":"This is a reprint of an article published earlier this year in my premium PowerShell newsletter, Behind the PowerShell Pipeline. This is a sample of what my subscribers get 6-8 times a month. I expect I will write several articles about PowerShell and its relationship with objects. I know that\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/07\/getting-drive-usage.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/07\/getting-drive-usage.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/07\/getting-drive-usage.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3093,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3093\/friday-fun-its-powershell-baby\/","url_meta":{"origin":4959,"position":4},"title":"Friday Fun: It&#8217;s PowerShell, Baby!","author":"Jeffery Hicks","date":"June 7, 2013","format":false,"excerpt":"The other day I received an email looking for guidance on using Invoke-Webrequest to pull data from a table on a web page. Specifically, he wanted to get the list of popular baby names from http:\/\/www.ssa.gov\/OACT\/babynames\/index.html. I gave him some quick tips but figured this would also be another teaching\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"baby","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/06\/baby-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":6492,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6492\/creating-more-git-powershell-tools\/","url_meta":{"origin":4959,"position":5},"title":"Creating More Git PowerShell Tools","author":"Jeffery Hicks","date":"February 1, 2019","format":false,"excerpt":"I have received a tremendous amount of interest in my recent articles on creating a git sizing tool using PowerShell. Many of you were savvy enough to realize the journey I was describing was just as important as the destination. With that in mind, I decided to revisit another PowerShell\u2026","rel":"","context":"In &quot;Git&quot;","block_context":{"text":"Git","link":"https:\/\/jdhitsolutions.com\/blog\/category\/git\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/image_thumb-3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/image_thumb-3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/image_thumb-3.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/02\/image_thumb-3.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=4959"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4959\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}