{"id":8381,"date":"2012-08-08T11:59:00","date_gmt":"2012-08-08T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2012\/08\/08\/powertip-creating-a-custom-number-display\/"},"modified":"2012-08-08T11:59:00","modified_gmt":"2012-08-08T11:59:00","slug":"powertip-creating-a-custom-number-display","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-creating-a-custom-number-display\/","title":{"rendered":"PowerTip: Creating a Custom Number Display"},"content":{"rendered":"<p><strong>Summary<\/strong>: Learn how to create a custom number display.<\/p>\n<p><b>Question<\/b>: How do I display a &ldquo;calculated value&rdquo; (megabytes instead of bytes) from a WMI query when piping data into a&nbsp;<b>Format-Table<\/b>&nbsp;cmdlet?<\/p>\n<p style=\"padding-left: 30px\"><b>Answer<\/b>: Create a hash table where you want to display the data, and perform the calculation inside curly brackets, and then assign the results to the&nbsp;<b>expression&nbsp;<\/b>parameter as shown here:<\/p>\n<p style=\"padding-left: 30px\">gwmi win32_logicaldisk -Filter &#8220;drivetype=3&#8243; | ft -Property name, @{ Label=&#8221;freespace&#8221;; expression={$_.freespace\/1MB}}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Learn how to create a custom number display. Question: How do I display a &ldquo;calculated value&rdquo; (megabytes instead of bytes) from a WMI query when piping data into a&nbsp;Format-Table&nbsp;cmdlet? Answer: Create a hash table where you want to display the data, and perform the calculation inside curly brackets, and then assign the results to [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[356,3,45],"class_list":["post-8381","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-powertip","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Learn how to create a custom number display. Question: How do I display a &ldquo;calculated value&rdquo; (megabytes instead of bytes) from a WMI query when piping data into a&nbsp;Format-Table&nbsp;cmdlet? Answer: Create a hash table where you want to display the data, and perform the calculation inside curly brackets, and then assign the results to [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/8381","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=8381"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/8381\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=8381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=8381"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=8381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}