{"id":3516,"date":"2013-10-25T13:10:19","date_gmt":"2013-10-25T17:10:19","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=3516"},"modified":"2013-10-25T13:10:19","modified_gmt":"2013-10-25T17:10:19","slug":"friday-fun-50-shades-of-powershell-html-reports","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/","title":{"rendered":"Friday Fun: 50 Shades of PowerShell HTML Reports"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/11\/happyreport.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-2547\" alt=\"happyreport\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/11\/happyreport-150x150.png\" width=\"150\" height=\"150\" \/><\/a> I've been working on a project for a client that includes creating an HTML report, generated by PowerShell. I originally thought I would include a certain feature but decided against it. However, this is so cool I thought I'd share it with you as a Friday Fun article. I've done alot this year with some advanced HTML scripting techniques and this one might come in handy.<\/p>\n<p>I'm always looking for ways to add visual reinforcement to my HTML reports. And since keeping track of disk space is a common IT Pro task, I figured it would be nice to have a visual representation on disk utilization. So I created a short proof of concept script that generates an HTML report like this:<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/gradientdemo.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/gradientdemo-300x176.png\" alt=\"gradientdemo\" width=\"300\" height=\"176\" class=\"aligncenter size-medium wp-image-3517\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/gradientdemo-300x176.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/gradientdemo-624x368.png 624w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/gradientdemo.png 907w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>What do you think? Here's how I did it.<\/p>\n<pre class=\"lang:ps decode:true \" >#requires -version 3.0\r\n\r\n&lt;#\r\nproof of concept using an HTML gradient.\r\n#&gt;\r\n\r\n[cmdletbinding()]\r\nParam(\r\n[string]$Computername=$env:computername,\r\n[string]$ReportTitle=\"Drive Utilization Report\",\r\n[string]$Path=\"$env:temp\\utilization.htm\"\r\n)\r\n\r\n#define HTML header with style elements\r\n$head = @'\r\n&lt;style&gt;\r\nbody { background-color:#FFFFFF;\r\n       font-family:Calibri;\r\n       font-size:12pt; }\r\ntd, th { border:0px solid black; \r\n         border-collapse:collapse; }\r\nth { color:white;\r\n     background-color:black; }\r\ntable, tr, td, th { padding: 2px; margin: 0px }\r\ntr:nth-child(odd) {background-color: lightgray}\r\ntable {\r\nwidth:95%;\r\nmargin-left:10px; \r\nmargin-bottom:20px;\r\n}\r\ncaption \r\n{\r\nbackground-color:#FFFF66;\r\ntext-align:left;\r\nfont-weight:bold;\r\nfont-size:14pt;\r\n}\r\n&lt;\/style&gt;\r\n'@\r\n\r\n &lt;#\r\n Define a here string for coloring percentage cells.\r\n The starting and ending percents will need to provided\r\n using the -f operator.\r\n #&gt;\r\n$gradient=@\"\r\nfilter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, \r\nStartColorStr=#0A802D, EndColorStr=#FF0011)\r\nbackground-color: #376C46;\r\nbackground-image: -mso-linear-gradient(left, #0A802D {0}%, #FF0011 {1}%);\r\nbackground-image: -ms-linear-gradient(left, #0A802D {0}%, #FF0011 {1}%);\r\nbackground-image: -moz-linear-gradient(left, #0A802D {0}%, #FF0011 {1}%);\r\nbackground-image: -o-linear-gradient(left, #0A802D {0}%, #FF0011 {1}%);\r\nbackground-image: -webkit-linear-gradient(left, #0A802D {0}%, #FF0011 {1}%);\r\nbackground-image: linear-gradient(left, #0A802D {0}%, #FF0011 {1}%);\r\n\"@\r\n\r\n#define an array to hold HTML fragments\r\n$fragments=@()\r\n\r\n#get the data for the report\r\n$data = Get-CimInstance Win32_logicaldisk -filter \"drivetype=3\" -ComputerName $computername\r\n\r\n#Create a custom object for each drive\r\n$drives = foreach ($item in $data) {\r\n    $prophash = [ordered]@{\r\n    Drive = $item.DeviceID\r\n    Volume = $item.VolumeName\r\n    SizeGB = $item.size\/1GB -as [int]\r\n    FreeGB = \"{0:N4}\" -f ($item.Freespace\/1GB)\r\n    PercentFree = [math]::Round(($item.Freespace\/$item.size) * 100,2)\r\n    }\r\n    New-Object PSObject -Property $prophash\r\n} #foreach item\r\n\r\n#convert drive objects to HTML but as an XML document\r\n[xml]$html = $drives | ConvertTo-Html -Fragment\r\n\r\n#add the computer name as the table caption\r\n$caption= $html.CreateElement(\"caption\")                                                                     \r\n$html.table.AppendChild($caption) | Out-Null                                                                            \r\n$html.table.caption= $data[0].SystemName\r\n\r\n#go through rows again and add gradient\r\nfor ($i=1;$i -le $html.table.tr.count-1;$i++) {\r\n  $class = $html.CreateAttribute(\"style\")\r\n  [int]$start = $html.table.tr[$i].td[-1]\r\n  #create the gradient using starting and ending values\r\n  #based on %free\r\n  $class.value = $Gradient -f $start,(100-$start)\r\n  $html.table.tr[$i].ChildNodes[4].Attributes.Append($class) | Out-Null\r\n} #for\r\n\r\n#add the html to the fragments\r\n$fragments+= $html.InnerXml\r\n\r\n#include a footer\r\n$fragments+=\"&lt;I&gt;Report run $(Get-Date)&lt;\/I&gt;\"\r\n\r\n#create the final report\r\nConvertTo-HTML -head $head -title $reportTitle -PreContent \"&lt;h1&gt;Drive Utilization&lt;\/h1&gt;\" -PostContent $fragments |\r\nOut-File -FilePath $path -Encoding ascii\r\n<\/pre>\n<p>The key element here is the addition of a gradient. In the script you can see that I've defined a here string for the gradient. The string includes code to support just about any browser, that's why you see all the background-image lines. The here string also has place holders, {0} and {1} for the starting and ending percentages. I'll explain how that works in a moment.<\/p>\n<p>Using Get-CIMInstance, the script gets fixed logical disks. Now, instead of simply creating an HTML fragment, I create the fragment as an XML document. This allows me to add a caption to the table, using the computer name. Then I iterate through the table node, skipping the first row which is the table header. I create an attribute called Style.<\/p>\n<pre class=\"lang:ps decode:true \" >for ($i=1;$i -le $html.table.tr.count-1;$i++) {\r\n  $class = $html.CreateAttribute(\"style\")\r\n...<\/pre>\n<p>Next, I get the value of the last <TD> cell, which is the PercentFree value. That's one of the reasons I used an ordered hashtable so I could guarantee that the last cell would always be the PercentFree property. I grab the value and make sure it is an integer.<\/p>\n<pre class=\"lang:ps decode:true \" >[int]$start = $html.table.tr[$i].td[-1]<\/pre>\n<p>I can use this value and plug it in to my gradient here string using the -f operator.<\/p>\n<pre class=\"lang:ps decode:true \" >$class.value = $Gradient -f $start,(100-$start)<\/pre>\n<p>I append the style attribute to each node. This allows me to set different values for each drive. <\/p>\n<pre class=\"lang:ps decode:true \" >$html.table.tr[$i].ChildNodes[4].Attributes.Append($class) | Out-Null<\/pre>\n<p>After going through the table rows, all that remains is to add the modified HTML, which is the InnerXML property to my array of fragments and create the final report.<\/p>\n<p>The gradient isn't absolute but it gives you a rough visual approximation of how much free space is on each drive. By the way, you can also use the gradient in the body element of a style sheet if you want to jazz up the background of your report.<\/p>\n<p>I included plenty of comments in my code which I hope helps. If not, please leave a comment. Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been working on a project for a client that includes creating an HTML report, generated by PowerShell. I originally thought I would include a certain feature but decided against it. However, this is so cool I thought I&#8217;d share it with you as a Friday Fun article. I&#8217;ve done alot this year with some&#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_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New! Friday Fun: 50 Shades of #PowerShell HTML Reports","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},"jetpack_post_was_ever_published":false},"categories":[271,359,8,135,19],"tags":[387,568,237,534,397,540,547],"class_list":["post-3516","post","type-post","status-publish","format-standard","hentry","category-friday-fun","category-powershell-3-0","category-scripting","category-windows-server","category-wmi","tag-cim","tag-friday-fun","tag-html","tag-powershell","tag-reporting","tag-scripting","tag-wmi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Friday Fun: 50 Shades of PowerShell HTML Reports &#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\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun: 50 Shades of PowerShell HTML Reports &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I&#039;ve been working on a project for a client that includes creating an HTML report, generated by PowerShell. I originally thought I would include a certain feature but decided against it. However, this is so cool I thought I&#039;d share it with you as a Friday Fun article. I&#039;ve done alot this year with some...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2013-10-25T17:10:19+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/11\/happyreport-150x150.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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun: 50 Shades of PowerShell HTML Reports\",\"datePublished\":\"2013-10-25T17:10:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/\"},\"wordCount\":456,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/11\\\/happyreport-150x150.png\",\"keywords\":[\"CIM\",\"Friday Fun\",\"HTML\",\"PowerShell\",\"Reporting\",\"Scripting\",\"WMI\"],\"articleSection\":[\"Friday Fun\",\"Powershell 3.0\",\"Scripting\",\"Windows Server\",\"WMI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/\",\"name\":\"Friday Fun: 50 Shades of PowerShell HTML Reports &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/11\\\/happyreport-150x150.png\",\"datePublished\":\"2013-10-25T17:10:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/11\\\/happyreport.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/11\\\/happyreport.png\",\"width\":\"304\",\"height\":\"335\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/3516\\\/friday-fun-50-shades-of-powershell-html-reports\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Friday Fun\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/friday-fun\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun: 50 Shades of PowerShell HTML Reports\"}]},{\"@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":"Friday Fun: 50 Shades of PowerShell HTML Reports &#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\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun: 50 Shades of PowerShell HTML Reports &#8226; The Lonely Administrator","og_description":"I've been working on a project for a client that includes creating an HTML report, generated by PowerShell. I originally thought I would include a certain feature but decided against it. However, this is so cool I thought I'd share it with you as a Friday Fun article. I've done alot this year with some...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/","og_site_name":"The Lonely Administrator","article_published_time":"2013-10-25T17:10:19+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/11\/happyreport-150x150.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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun: 50 Shades of PowerShell HTML Reports","datePublished":"2013-10-25T17:10:19+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/"},"wordCount":456,"commentCount":9,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/11\/happyreport-150x150.png","keywords":["CIM","Friday Fun","HTML","PowerShell","Reporting","Scripting","WMI"],"articleSection":["Friday Fun","Powershell 3.0","Scripting","Windows Server","WMI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/","name":"Friday Fun: 50 Shades of PowerShell HTML Reports &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/11\/happyreport-150x150.png","datePublished":"2013-10-25T17:10:19+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/11\/happyreport.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/11\/happyreport.png","width":"304","height":"335"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Friday Fun","item":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},{"@type":"ListItem","position":2,"name":"Friday Fun: 50 Shades of PowerShell HTML Reports"}]},{"@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":1977,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1977\/the-powershell-morning-report\/","url_meta":{"origin":3516,"position":0},"title":"The PowerShell Morning Report","author":"Jeffery Hicks","date":"January 10, 2012","format":false,"excerpt":"I love how easy it is to manage computers with Windows PowerShell. It is a great reporting tool, but often I find people getting locked into one approach. I'm a big believer in flexibility and re-use and using objects in the pipeline wherever I can. So I put together a\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"Zazu","src":"https:\/\/i0.wp.com\/www.lionking.org\/imgarchive\/Clip_Art\/zazu03.gif?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":826,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/826\/friday-the-13-script-blocks\/","url_meta":{"origin":3516,"position":1},"title":"Friday the 13 Script Blocks","author":"Jeffery Hicks","date":"August 13, 2010","format":false,"excerpt":"In celebration of Friday the 13th and to help ward off any triskaidekaphobia I thought I'd offer up 13 PowerShell scriptblocks. These are scriptblocks that might solve a legitimate business need like finding how long a server has been running to the more mercurial such as how many hours before\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":6130,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/","url_meta":{"origin":3516,"position":2},"title":"Creating Colorful HTML Disk Reports with PowerShell","author":"Jeffery Hicks","date":"October 11, 2018","format":false,"excerpt":"I have no idea what possessed me, but the other day I came across an older script that uses PowerShell to create an HTML report showing drive utilization for a group of computers. The utilization is displayed using a color gradient from green to red to provide a visual reference.\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\/2018\/10\/image_thumb-3.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb-3.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb-3.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb-3.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":3627,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3627\/friday-fun-with-rest-regex-and-replacements\/","url_meta":{"origin":3516,"position":3},"title":"Friday Fun with REST, Regex and Replacements","author":"Jeffery Hicks","date":"January 24, 2014","format":false,"excerpt":"I just love using the web cmdlets that were introduced in PowerShell 3.0. One of the cmdlets I use the most is Invoke-RESTMethod. This isn't because I'm dealing with sites that offer REST-ful services, but rather I like that the cmdlet does all the heavy lifting for me when I\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"computereye","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/computereye-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":995,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/995\/friday-fun-the-kitchen-sink-prompt\/","url_meta":{"origin":3516,"position":4},"title":"Friday Fun &#8211; The Kitchen Sink Prompt","author":"Jeffery Hicks","date":"October 29, 2010","format":false,"excerpt":"On my last Friday Fun post on PowerShell prompts, I got a terrific comment from Bart Vandyck about his prompt which has just about everything you would want. I too have a \"kitchen sink\" prompt, that is to say, one with the proverbial \"everything but the kitchen sink\". Or you\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/everything-console-1024x798.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/everything-console-1024x798.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/10\/everything-console-1024x798.png?resize=525%2C300 1.5x"},"classes":[]},{"id":2090,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2090\/morning-report-revised\/","url_meta":{"origin":3516,"position":5},"title":"Morning Report Revised","author":"Jeffery Hicks","date":"February 13, 2012","format":false,"excerpt":"Last month I posted a PowerShell script I called The Morning Report. I received some very nice feedback. One comment was about making it easier to use the script in a pipelined expression. For example, get a list of computers from a text file and create a single HTML report.\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\/02\/morningreport-revised-300x126.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3516","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=3516"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3516\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}