{"id":6130,"date":"2018-10-11T13:28:01","date_gmt":"2018-10-11T17:28:01","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=6130"},"modified":"2018-10-11T13:28:01","modified_gmt":"2018-10-11T17:28:01","slug":"creating-colorful-html-disk-reports-with-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/","title":{"rendered":"Creating Colorful HTML Disk Reports with PowerShell"},"content":{"rendered":"<p>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. As I looked at the code I thought about what would be interesting to add and now a day or two later I have something new to show you.<\/p>\n<p><!--more--><\/p>\n<p>The function could have been revised using commands in the Storage module like Get-Volume and Get-Disk. But I decided to stick to using <a title=\"read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=287299\" rel=\"noopener\">Get-CimInstance<\/a> to query traditional Win32_* classes. I also wanted to leverage the use of Get-CimAssociatedInstance to capture additional information. You can find the script file as a gist on Github.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/jdhitsolutions\/d23086d1365bd332ffef96c5ef2de9dd.js\"><\/script><\/p>\n<p>Usage is pretty straightforward. You specify one or more computers and off you go. There is a default value for the resulting HTML file, but you'll likely want to specify your own.\u00a0\u00a0 Because the function is generating custom HTML on the fly, I also provided options for you to provide pre and post content HTML material, just as you might with <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113290\" rel=\"noopener\">ConvertTo-HTML<\/a>. I also give you an option to specify a graphics file which is display like a logo at the top of the report. The graphics file will be embedded in the HTML file. The CSS is also embedded in the HTML making the entire file completely self-contained.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">$params = @{\r\nComputername = 'bovine320','dom1','think51','srv1','win10'\r\nPath = 'c:\\work\\r.html'\r\nPrecontent = \"&lt;H3&gt;Company Confidential&lt;\/H3&gt;\" \r\nPostContent = \"This report is provided &lt;i&gt;as-is&lt;\/i&gt;. Use commands like &lt;b&gt;Get-Volume&lt;\/b&gt; to validate.\"\r\nLogoPath = 'c:\\scripts\\db.png'\r\n}\r\nNew-HTMLDiskReport @params\r\n<\/pre>\n<p>As you look through the code, notice how I'm using <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113428\" rel=\"noopener\">Write-Progress<\/a> to keep the user informed. This is something I wish more of you used instead of <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113426\" rel=\"noopener\">Write-Host<\/a>. It makes your code much more professional. Let me show you the result.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb.png\" alt=\"image\" width=\"1028\" height=\"745\" border=\"0\" \/><\/a><\/p>\n<p>The color gradient is self-evident but let me point out a few other things. Notice the footer.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb-1.png\" alt=\"image\" width=\"964\" height=\"260\" border=\"0\" \/><\/a><\/p>\n<p>This is something I've started doing in my HTML report scripts and I encourage you to think about. At some point, you might set up a script like this to run as a scheduled job or task. Perhaps emailing a group of Admins. Over time and with staff turnover, you may wonder \"Where is this coming from?\" Hopefully, the metadata information can help you track it down. I create a custom object and convert it to an HTML fragment.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">#add some metadata about this report\r\n[xml]$metadata = [pscustomobject]@{\r\n    \"Report Run\" = \"$((Get-Date).ToUniversalTime()) UTC\"\r\n    \"Run By\"     = \"$($env:USERDOMAIN)\\$env:username\"\r\n    Originated   = $env:Computername\r\n    Command      = $($myinvocation.invocationname)\r\n    Version      = \"2.0\"\r\n} | ConvertTo-html -as List -Fragment\r\n<\/pre>\n<p>If you look in the code you'll see additional steps to insert style tags.<\/p>\n<p>The other feature is the use of the Title attribute, or a customized version, to display additional information. If you hover your mouse over the computer name, you'll see a popup with the operating system.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb-2.png\" alt=\"image\" width=\"744\" height=\"195\" border=\"0\" \/><\/a><\/p>\n<p>Because I save the HTML as XML I can easily parse and update it.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">#convert drive objects to HTML but as an XML document\r\nWrite-Verbose \"Converting to XML\"\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$pop = $html.CreateAttribute(\"title\")\r\n$pop.value = (Get-Ciminstance -ClassName Win32_OperatingSystem -Property caption -cimsession $cs).caption\r\n$html.table.item(\"caption\").attributes.append($pop) | Out-Null\r\n<\/pre>\n<p>I do something similar with physical media information when you hover over the device ID.<\/p>\n<p><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"image\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb-3.png\" alt=\"image\" width=\"998\" height=\"484\" border=\"0\" \/><\/a><\/p>\n<p>Getting the information uses Get-CimassociatedInstance. Because a computer might have more than one drive, I create a hashtable using the device ID as the key and the DiskDrive instance as the value.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">#initialize a hashtable of for phsyical media\r\n$hash = @{}\r\n#Create a custom object for each drive\r\n$drives = foreach ($item in $data) {\r\n                        \r\n    $Physical = $item | Get-CimAssociatedInstance -ResultClassName Win32_DiskPartition | Get-CimAssociatedInstance -ResultClassName Win32_DiskDrive\r\n    $hash.Add($item.DeviceID,$physical)\r\n\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<\/pre>\n<p>Later I add a custom tip class.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">#add physical media as a popup for each device\r\nfor ($i=1; $i -le $html.table.tr.count -1;$i++) {\r\n    $id = $html.table.tr[$i].ChildNodes[0].\"#text\"\r\n    $pop = $html.CreateAttribute(\"tip\")\r\n    $props = ($hash.Item($id) | Select-Object -property Caption,SerialNumber,FirmwareRevision,Size,InterfaceType,SCSI* | Out-String).trim()     \r\n    $pop.Value = $props\r\n    $html.table.tr[$i].ChildNodes[0].Attributes.append($pop) | Out-Null\r\n}\r\n<\/pre>\n<p>The hardest part, since I am not a web design person, was getting the correct style settings to display the text neatly.<\/p>\n<pre class=\"lang:ps mark:0 decode:true\">td[tip]:hover {\r\n    color: #ff2283;\r\n    position: relative;\r\n}\r\n\r\ntd[tip]:hover:after {\r\n    content: attr(tip);\r\n    left: 0;\r\n    top: 100%;\r\n    margin-left: 80px;\r\n    margin-top: 10px;\r\n    width: 400px;\r\n    padding: 3px 8px;\r\n    position: absolute;\r\n    color: #85003a;\r\n    font-family: 'Courier New', Courier, monospace;\r\n    font-size: 10pt;\r\n    background-color: gainsboro;\r\n    white-space: pre-wrap;\r\n}\r\n<\/pre>\n<p>But I have to say I like the way it turned out.<\/p>\n<p>You may not have a need for this script as it is written, but hopefully, I've given you a few ideas and some code samples to begin working with. Enjoy and I hope you'll let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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. As I looked at the&#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 on the blog: Creating Colorful HTML Disk Reports with #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":[224,237,534,597],"class_list":["post-6130","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","category-wmi","tag-function","tag-html","tag-powershell","tag-storage"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Creating Colorful HTML Disk Reports with PowerShell &#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\/6130\/creating-colorful-html-disk-reports-with-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating Colorful HTML Disk Reports with PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"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. As I looked at the...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-11T17:28:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Creating Colorful HTML Disk Reports with PowerShell\",\"datePublished\":\"2018-10-11T17:28:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/\"},\"wordCount\":583,\"commentCount\":10,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/image_thumb.png\",\"keywords\":[\"Function\",\"HTML\",\"PowerShell\",\"Storage\"],\"articleSection\":[\"PowerShell\",\"Scripting\",\"WMI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/\",\"name\":\"Creating Colorful HTML Disk Reports with PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/image_thumb.png\",\"datePublished\":\"2018-10-11T17:28:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/image_thumb.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/10\\\/image_thumb.png\",\"width\":1028,\"height\":745},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/6130\\\/creating-colorful-html-disk-reports-with-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating Colorful HTML Disk Reports with PowerShell\"}]},{\"@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":"Creating Colorful HTML Disk Reports with PowerShell &#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\/6130\/creating-colorful-html-disk-reports-with-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Creating Colorful HTML Disk Reports with PowerShell &#8226; The Lonely Administrator","og_description":"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. As I looked at the...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2018-10-11T17:28:01+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Creating Colorful HTML Disk Reports with PowerShell","datePublished":"2018-10-11T17:28:01+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/"},"wordCount":583,"commentCount":10,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb.png","keywords":["Function","HTML","PowerShell","Storage"],"articleSection":["PowerShell","Scripting","WMI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/","name":"Creating Colorful HTML Disk Reports with PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb.png","datePublished":"2018-10-11T17:28:01+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/image_thumb.png","width":1028,"height":745},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6130\/creating-colorful-html-disk-reports-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Creating Colorful HTML Disk Reports with PowerShell"}]},{"@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":6130,"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":3516,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/","url_meta":{"origin":6130,"position":1},"title":"Friday Fun: 50 Shades of PowerShell HTML Reports","author":"Jeffery Hicks","date":"October 25, 2013","format":false,"excerpt":"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\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"happyreport","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/11\/happyreport-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":449,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/449\/drive-report-console-chart\/","url_meta":{"origin":6130,"position":2},"title":"Drive Report Console Chart","author":"Jeffery Hicks","date":"October 15, 2009","format":false,"excerpt":"In thinking about some of my recent posts, I realize I should make clear that these scripts and functions are not necessarily good PowerShell examples. They don\u2019t take advantage of objects and the pipeline. They are single purpose and one-dimensional. Not that there\u2019s anything wrong with that. My recent examples,\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"drivereport screenshot","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/10\/drivereport_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4985,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4985\/converting-text-to-html-revised\/","url_meta":{"origin":6130,"position":3},"title":"Converting Text to HTML Revised","author":"Jeffery Hicks","date":"May 9, 2016","format":false,"excerpt":"A few years ago I published a PowerShell function to convert text files into HTML listings. I thought it would be handy to convert scripts to HTML documents with line numbering and some formatting. Turns out someone actually used it! He had some questions about the function which led me\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"convertto-htmllisting2","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/05\/convertto-htmllisting2_thumb.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/05\/convertto-htmllisting2_thumb.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/05\/convertto-htmllisting2_thumb.png?resize=525%2C300 1.5x"},"classes":[]},{"id":3966,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3966\/friday-fun-text-to-html\/","url_meta":{"origin":6130,"position":4},"title":"Friday Fun Text to HTML","author":"Jeffery Hicks","date":"August 22, 2014","format":false,"excerpt":"I love being able to create HTML documents from PowerShell commands. The Convertto-HTML cmdlet will happily turn any object into an HTML table using whatever properties you specify. Plus you can do all sorts of fancy things such as embedding a style sheet in the header, creating HTML fragments and\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"html","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/08\/html-150x150.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":9074,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9074\/the-value-of-objects\/","url_meta":{"origin":6130,"position":5},"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":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/6130","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=6130"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/6130\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=6130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=6130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=6130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}