{"id":2119,"date":"2012-02-16T12:54:16","date_gmt":"2012-02-16T17:54:16","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=2119"},"modified":"2012-02-16T12:54:16","modified_gmt":"2012-02-16T17:54:16","slug":"create-html-bar-charts-from-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/","title":{"rendered":"Create HTML Bar Charts from PowerShell"},"content":{"rendered":"<p>I saw a very nice mention on Twitter today where someone had taken an idea of mine and created something practical and in <a href=\"http:\/\/yfrog.com\/khej0ryj\" title=\"check out the result\" target=\"_blank\">production<\/a>. It is always nice to hear. The inspiring article was something I worked up that showed using the <a href=\"http:\/\/jdhitsolutions.com\/blog\/2011\/12\/friday-fun-drive-usage-console-graph\/\" title=\"read the original article\" target=\"_blank\">PowerShell console as a graphing tool<\/a>. Of course someone immediately wanted to know about turning this into HTML. Actually he wanted this in a web page that would automatically refresh. I don't think I can manage that, but I came up with a demo script that will create a colorized bar graph in ah HTML page. If you want to update it, simply re-run your command.<\/p>\n<p>Here's the demo code.<\/p>\n<p><code lang=\"PowerShell\"><br \/>\n#requires -version 2.0<\/p>\n<p>Param (<br \/>\n[string[]]$computers=@($env:computername),<br \/>\n[string]$Path=\"drivereport.htm\"<br \/>\n)<\/p>\n<p>$Title=\"Drive Report\"<\/p>\n<p>#embed a stylesheet in the html header<br \/>\n$head = @\"<\/p>\n<style>\nbody { background-color:#FFFFCC;\n       font-family:Tahoma;\n       font-size:12pt; }\ntd, th { border:1px solid #000033; \n         border-collapse:collapse; }\nth { color:white;\n     background-color:#000033; }\ntable, tr, td, th { padding: 0px; margin: 0px }\ntable { margin-left:10px; }\n<\/style>\n<p><Title>$Title<\/Title><br \/>\n<br \/>\n\"@ <\/p>\n<p>#define an array for html fragments<br \/>\n$fragments=@()<\/p>\n<p>#get the drive data<br \/>\n$data=get-wmiobject -Class Win32_logicaldisk -filter \"drivetype=3\" -computer $computers<\/p>\n<p>#group data by computername<br \/>\n$groups=$Data | Group-Object -Property SystemName<\/p>\n<p>#this is the graph character<br \/>\n[string]$g=[char]9608 <\/p>\n<p>#create html fragments for each computer<br \/>\n#iterate through each group object<\/p>\n<p>ForEach ($computer in $groups) {<\/p>\n<p>    $fragments+=\"<H2>$($computer.Name)<\/H2>\"<\/p>\n<p>    #define a collection of drives from the group object<br \/>\n    $Drives=$computer.group<\/p>\n<p>    #create an html fragment<br \/>\n    $html=$drives | Select @{Name=\"Drive\";Expression={$_.DeviceID}},<br \/>\n    @{Name=\"SizeGB\";Expression={$_.Size\/1GB  -as [int]}},<br \/>\n    @{Name=\"UsedGB\";Expression={\"{0:N2}\" -f (($_.Size - $_.Freespace)\/1GB) }},<br \/>\n    @{Name=\"FreeGB\";Expression={\"{0:N2}\" -f ($_.FreeSpace\/1GB) }},<br \/>\n    @{Name=\"Usage\";Expression={<br \/>\n      $UsedPer= (($_.Size - $_.Freespace)\/$_.Size)*100<br \/>\n      $UsedGraph=$g * ($UsedPer\/2)<br \/>\n      $FreeGraph=$g* ((100-$UsedPer)\/2)<br \/>\n      #I'm using place holders for the < and > characters<br \/>\n      \"xopenFont color=Redxclose{0}xopen\/FontxclosexopenFont Color=Greenxclose{1}xopen\/fontxclose\" -f $usedGraph,$FreeGraph<br \/>\n    }} | ConvertTo-Html -Fragment <\/p>\n<p>    #replace the tag place holders. It is a hack but it works.<br \/>\n    $html=$html -replace \"xopen\",\"<\"\n    $html=$html -replace \"xclose\",\">\"<\/p>\n<p>    #add to fragments<br \/>\n    $Fragments+=$html<\/p>\n<p>    #insert a return between each computer<br \/>\n    $fragments+=\"<br \/>\"<\/p>\n<p>} #foreach computer<\/p>\n<p>#add a footer<br \/>\n$footer=(\"<br \/><I>Report run {0} by {1}\\{2}<I>\" -f (Get-Date -displayhint date),$env:userdomain,$env:username)<br \/>\n$fragments+=$footer<\/p>\n<p>#write the result to a file<br \/>\nConvertTo-Html -head $head -body $fragments  | Out-File $Path<br \/>\n<\/code><\/p>\n<p>The key concept here is that I'm building a final HTML file from a collection of HTML fragments. I think most of the script should be self-explanatory. The core part of the script takes the collection of drives for a computer, selects some custom properties and converts it into an HTML fragment.<\/p>\n<p><code lang=\"PowerShell\"><br \/>\n#create an html fragment<br \/>\n    $html=$drives | Select @{Name=\"Drive\";Expression={$_.DeviceID}},<br \/>\n    @{Name=\"SizeGB\";Expression={$_.Size\/1GB  -as [int]}},<br \/>\n    @{Name=\"UsedGB\";Expression={\"{0:N2}\" -f (($_.Size - $_.Freespace)\/1GB) }},<br \/>\n    @{Name=\"FreeGB\";Expression={\"{0:N2}\" -f ($_.FreeSpace\/1GB) }},<br \/>\n    @{Name=\"Usage\";Expression={<br \/>\n      $UsedPer= (($_.Size - $_.Freespace)\/$_.Size)*100<br \/>\n      $UsedGraph=$g * ($UsedPer\/2)<br \/>\n      $FreeGraph=$g* ((100-$UsedPer)\/2)<br \/>\n      #I'm using place holders for the < and > characters<br \/>\n      \"xopenFont color=Redxclose{0}xopen\/FontxclosexopenFont Color=Greenxclose{1}xopen\/fontxclose\" -f $usedGraph,$FreeGraph<br \/>\n    }} | ConvertTo-Html -Fragment<br \/>\n<\/code><\/p>\n<p>The tricky part is the value for \"Usage\" In the Expression scriptblock I'm calculating a value for how much disk space is used and how much is free. I then create a string that is my graphing character ([CHAR]9608) times a value. The value is the corresponding percentage divided by 2 because I want to put the used graphic right next to the free graphic. And this leads me to the hack: I want the used graph to be in Red and the free graph string to be in Green. I'm taking the easy way and using a FONT tag. But, I can't use the < and > characters because Convertto-HTML \"translates\" them. I couldn't find anyway around this. So instead I use a place holder.<\/p>\n<p><code lang=\"PowerShell\"><br \/>\n \"xopenFont color=Redxclose{0}xopen\/FontxclosexopenFont Color=Greenxclose{1}xopen\/fontxclose\" -f $usedGraph,$FreeGraph<br \/>\n<\/code><\/p>\n<p>All I need to do is replace the placeholders from the HTML output.<\/p>\n<p><code lang=\"PowerShell\"><br \/>\n    #replace the tag place holders. It is a hack but it works.<br \/>\n    $html=$html -replace \"xopen\",\"<\"\n    $html=$html -replace \"xclose\",\">\"<\/p>\n<p>    #add to fragments<br \/>\n    $Fragments+=$html<br \/>\n<\/code><\/p>\n<p>Perhaps not the most elegant solution, but it works. The script wraps up by taking all of the HTML code and creates the final file.<\/p>\n<p><code lang=\"PowerShell\"><br \/>\nConvertTo-Html -head $head -body $fragments  | Out-File $Path<br \/>\n<\/code><\/p>\n<p>To run this for a group of computers I can run a command like:<\/p>\n<p><code lang=\"DOS\"><br \/>\nPS C:\\scripts> .\\demo-HtmlBarChart.ps1 \"jdhit-dc01\",\"serenity\",\"quark\"<br \/>\n<\/code><\/p>\n<p>Here is the result:<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives.png\" target='_blank'><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives-300x214.png\" alt=\"\" title=\"html-drives\" width=\"300\" height=\"214\" class=\"aligncenter size-medium wp-image-2120\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives-300x214.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives-1024x733.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives.png 1263w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I haven't found a way to make this process more generic and my script, while it works, isn't really production ready; that's why I call it a demo script. But perhaps you'll take inspiration and come up with some wonderful. If you do, I hope you'll let me know and share with the PowerShell community.<\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/demo-HtmlBarChart.txt'>Demo-HtmlBarChart<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I saw a very nice mention on Twitter today where someone had taken an idea of mine and created something practical and in production. It is always nice to hear. The inspiring article was something I worked up that showed using the PowerShell console as a graphing tool. Of course someone immediately wanted to know&#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":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[75,8,19],"tags":[229,237,534,547],"class_list":["post-2119","post","type-post","status-publish","format-standard","hentry","category-powershell-v2-0","category-scripting","category-wmi","tag-convertto-html","tag-html","tag-powershell","tag-wmi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create HTML Bar Charts from 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\/scripting\/2119\/create-html-bar-charts-from-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create HTML Bar Charts from PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I saw a very nice mention on Twitter today where someone had taken an idea of mine and created something practical and in production. It is always nice to hear. The inspiring article was something I worked up that showed using the PowerShell console as a graphing tool. Of course someone immediately wanted to know...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2012-02-16T17:54:16+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives-300x214.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\\\/2119\\\/create-html-bar-charts-from-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Create HTML Bar Charts from PowerShell\",\"datePublished\":\"2012-02-16T17:54:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/\"},\"wordCount\":418,\"commentCount\":3,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/02\\\/html-drives-300x214.png\",\"keywords\":[\"ConvertTo-HTML\",\"HTML\",\"PowerShell\",\"WMI\"],\"articleSection\":[\"PowerShell v2.0\",\"Scripting\",\"WMI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/\",\"name\":\"Create HTML Bar Charts from PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/02\\\/html-drives-300x214.png\",\"datePublished\":\"2012-02-16T17:54:16+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/02\\\/html-drives.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/02\\\/html-drives.png\",\"width\":\"1263\",\"height\":\"905\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/2119\\\/create-html-bar-charts-from-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell v2.0\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell-v2-0\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create HTML Bar Charts from 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":"Create HTML Bar Charts from 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\/scripting\/2119\/create-html-bar-charts-from-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Create HTML Bar Charts from PowerShell &#8226; The Lonely Administrator","og_description":"I saw a very nice mention on Twitter today where someone had taken an idea of mine and created something practical and in production. It is always nice to hear. The inspiring article was something I worked up that showed using the PowerShell console as a graphing tool. Of course someone immediately wanted to know...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2012-02-16T17:54:16+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives-300x214.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\/2119\/create-html-bar-charts-from-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Create HTML Bar Charts from PowerShell","datePublished":"2012-02-16T17:54:16+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/"},"wordCount":418,"commentCount":3,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives-300x214.png","keywords":["ConvertTo-HTML","HTML","PowerShell","WMI"],"articleSection":["PowerShell v2.0","Scripting","WMI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/","name":"Create HTML Bar Charts from PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives-300x214.png","datePublished":"2012-02-16T17:54:16+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/02\/html-drives.png","width":"1263","height":"905"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2119\/create-html-bar-charts-from-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell v2.0","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},{"@type":"ListItem","position":2,"name":"Create HTML Bar Charts from 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":2119,"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":1201,"url":"https:\/\/jdhitsolutions.com\/blog\/wmi\/1201\/new-event-report-revised\/","url_meta":{"origin":2119,"position":1},"title":"New Event Report Revised","author":"Jeffery Hicks","date":"March 8, 2011","format":false,"excerpt":"Last year I posted an update to an old Mr. Roboto script that was an update to an even older VBScript. Still with me? My last revision leveraged the new Get-WinEvent cmdlet to create an HTML report of recent error activity on one or more computers. The problem was that\u2026","rel":"","context":"In &quot;Mr. Roboto&quot;","block_context":{"text":"Mr. Roboto","link":"https:\/\/jdhitsolutions.com\/blog\/category\/mr-roboto\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3516,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3516\/friday-fun-50-shades-of-powershell-html-reports\/","url_meta":{"origin":2119,"position":2},"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":2241,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2241\/skipping-wmi-system-properties-in-powershell\/","url_meta":{"origin":2119,"position":3},"title":"Skipping WMI System Properties in PowerShell","author":"Jeffery Hicks","date":"April 25, 2012","format":false,"excerpt":"One of my favorite techniques when using WMI in PowerShell is to pipe an object to Select-Object and select all properties. Try this: get-wmiobject win32_bios | select * It works, but it also gets all of the system properties like __PATH which I rarely care about. I also get other\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1750,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1750\/friday-fun-perf-counters-with-write-progress\/","url_meta":{"origin":2119,"position":4},"title":"Friday Fun Perf Counters with Write-Progress","author":"Jeffery Hicks","date":"November 11, 2011","format":false,"excerpt":"While working on my course for TrainSignal on managing Windows Servers with PowerShell, I came up with an interesting use of the Write-Progress cmdlet. I was working on the performance monitoring lesson and realized I could use Write-Progress as rudimentary graphing tool. The cmdlet has a parameter that lets you\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2809,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/","url_meta":{"origin":2119,"position":5},"title":"PowerShell Morning Report with Credentials","author":"Jeffery Hicks","date":"February 22, 2013","format":false,"excerpt":"I had an email about trying to use my Morning Report script to connect to machines that required alternate credentials. For example, you might have non-domain systems in a DMZ. Fair enough. Since most of the report script uses WMI, it wasn't too hard to add a Credential parameter and\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"morning report","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2119","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=2119"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2119\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}