{"id":1891,"date":"2011-12-09T11:37:44","date_gmt":"2011-12-09T16:37:44","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1891"},"modified":"2011-12-09T11:37:44","modified_gmt":"2011-12-09T16:37:44","slug":"friday-fun-drive-usage-console-graph","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/","title":{"rendered":"Friday Fun Drive Usage Console Graph"},"content":{"rendered":"<p>I think you'll like this. Normally, I prefer my PowerShell commands to write objects to the pipeline. But there's nothing wrong with sending output directly to the console, as long as you know that the output is intended only for the screen. What I find frustrating is the use of Write-Host when really, pipelined objects would be better. But for today, I'm going to revel in the beauty of the console and create a colorized drive utilization graph.<!--more--><\/p>\n<p>The color will come from the BackgroundColor or ForegroundColor properties of Write-Host. For example, try this command in your PowerShell session:<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> write-host (\" \"*30) -BackgroundColor Yellow<br \/>\n[\/cc]<\/p>\n<p>The command is creating a \"string\" of 30 spaces. See where I'm going with this? Using WMI I can get drive usage information and turn it into values that I can \"graph\" using Write-Host. Here's the code I'm working with:<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n#requires -version 2.0<\/p>\n<p>Param (<br \/>\n[string[]]$computers=@(\"computera\",\"computerb\",\"computerc\")<br \/>\n)<\/p>\n<p>#get the current window width so that our lines will be proportional<br \/>\n$Width = $Host.UI.RawUI.BufferSize.Width\/2<\/p>\n<p>$data=get-wmiobject -Class Win32_logicaldisk -filter \"drivetype=3\" -computer $computers<\/p>\n<p>#get length of longest computername so we can pad<br \/>\n$longest=$data | select -ExpandProperty SystemName | sort Length | select -last 1<\/p>\n<p>#group data by computername<br \/>\n$groups=$Data | Group-Object -Property SystemName<\/p>\n<p>Clear-Host<br \/>\nWrite-Host (\"`n{0} {1}`n\" -f \"Disk Drive Report\",(Get-Date)) -ForegroundColor Yellow<\/p>\n<p>#iterate through each group object<br \/>\nForEach ($computer in $groups) {<\/p>\n<p>    #define a collection of drives from the group object<br \/>\n    $Drives=$computer.group<\/p>\n<p>    #iterate through each drive on each computer<br \/>\n    Foreach ($drive in $drives) {<br \/>\n        $FreeDividedSize=$drive.FreeSpace\/$drive.Size<br \/>\n        [string]$PerFree=\"{0:P}\" -f $FreeDividedSize<br \/>\n        [int]$FreePad=$Width*$FreeDividedSize <\/p>\n<p>        $Used=$drive.Size - $drive.Freespace<br \/>\n        $UsedDividedSize=$used\/$drive.Size<br \/>\n        [string]$perUsed=\"{0:P}\" -f $UsedDividedSize<br \/>\n        [int]$UsedPad=$Width*$UsedDividedSize<\/p>\n<p>        #not currently used<br \/>\n        [string]$UsedGB=\"{0:N2}GB  \" -f ($Used\/1GB)<br \/>\n        [string]$FreeGB=\"{0:N2}GB  \" -f ($drive.FreeSpace\/1GB)<\/p>\n<p>        #this is the graph character<br \/>\n        [string]$g=[char]9608<br \/>\n        [string]$freeGraph=$g*($FreePad)<br \/>\n        [string]$UsedGraph=$g*($UsedPad)  <\/p>\n<p>        write-host (\"[{0}] {1} \" -f $drive.systemname.PadRight($longest.length),$drive.DeviceID)  -NoNewline<br \/>\n        write-host $freeGraph -ForegroundColor darkgreen -NoNewline<br \/>\n        write-host $UsedGraph -ForegroundColor red -NoNewline<br \/>\n        write-host (\" {0} free \" -f $PerFree)<\/p>\n<p>        #insert a return between each drive<br \/>\n        write-host \"`r\"<br \/>\n    } #foreach drive<br \/>\n    #insert a blank line between computers if you want<br \/>\n    #Write-host \"`n\"<br \/>\n} #foreach computer<br \/>\n[\/cc]<\/p>\n<p>Because I will need to adjust my graph to accommodate the width of the PowerShell window, I'm going to retrieve the console width and divide by 2. This will give me plenty of room to fit in the other output and still make a nice looking graph.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n#get the current window width so that our lines will be proportional<br \/>\n$Width = $Host.UI.RawUI.BufferSize.Width\/2<br \/>\n[\/cc]<\/p>\n<p>The script takes a collection of computer names and retrieves fixed logical disk information via WMI.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n$data=get-wmiobject -Class Win32_logicaldisk -filter \"drivetype=3\" -computer $computers<br \/>\n[\/cc]<\/p>\n<p>Because I'm most likely going to be reporting on a group of computers, I want to include the computer name in the output. And because I want to keep everything proportional, I need to find the longest computer name. For all other names, I'll pad their names to equal the longest name. You'll see.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n#get length of longest computername so we can pad<br \/>\n$longest=$data | select -ExpandProperty SystemName | sort Length | select -last 1<br \/>\n[\/cc]<\/p>\n<p>After a bit of experimentation, I decided the best way to process the data was to group it based on computer name, so I pipe it to Group-Object, grouping on the computername (systemname) property.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n#group data by computername<br \/>\n$groups=$Data | Group-Object -Property SystemName<br \/>\n[\/cc]<\/p>\n<p>Now for the report. For every computer in the group, I'm going to enumerate every logical drive, get some stats and graph them. I didn't have to group them, but for a number of reasons, as well as showing you how to use the cmdlet, I decided to. When I piped the WMI results to Group-Object, I got a new object type. The object has a Group property which will be the collection of objects that have been grouped based on the property name, in my case, SystemName. Thus the Group property is a collection of Win32_LogicalDisk objects.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n#iterate through each group object<br \/>\nForEach ($computer in $groups) {<br \/>\n    #define a collection of drives from the group object<br \/>\n    $Drives=$computer.group<br \/>\n[\/cc]<\/p>\n<p>Now I can run some calculations and format the size and freespace properties. I'll be using these values with Write-Host.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n #iterate through each drive on each computer<br \/>\n    Foreach ($drive in $drives) {<br \/>\n        $FreeDividedSize=$drive.FreeSpace\/$drive.Size<br \/>\n        [string]$PerFree=\"{0:P}\" -f $FreeDividedSize<br \/>\n        [int]$FreePad=$Width*$FreeDividedSize <\/p>\n<p>        $Used=$drive.Size - $drive.Freespace<br \/>\n        $UsedDividedSize=$used\/$drive.Size<br \/>\n        [string]$perUsed=\"{0:P}\" -f $UsedDividedSize<br \/>\n        [int]$UsedPad=$Width*$UsedDividedSize<\/p>\n<p>        #not currently used<br \/>\n        [string]$UsedGB=\"{0:N2}GB  \" -f ($Used\/1GB)<br \/>\n        [string]$FreeGB=\"{0:N2}GB  \" -f ($drive.FreeSpace\/1GB)<br \/>\n[\/cc]<\/p>\n<p>Notice I'm using the -f operator to construct new strings, and format data. The qualifiers P and N will format the value as percent and a number, respectively. I originally planned in including the usage values directly in the bar chart, but it skewed the proportions. Instead, I decided to use a character and repeat it X number of times as necessary to reflect the amount of free space and amount used. I picked a block character, although I could have just used a space.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n #this is the graph character<br \/>\n [string]$g=[char]9608<br \/>\n [string]$freeGraph=$g*($FreePad)<br \/>\n [string]$UsedGraph=$g*($UsedPad)<br \/>\n[\/cc]<\/p>\n<p>Armed with these values, I can now use Write-Host to create the graph. Because I want to graph system information, free space and usage on the same line, I tell Write-Host to not create a new line. The first part writes the computer name in square brackets. I'm also padding the computer name with empty spaces at the end so that the brackets all line up. After the computer name is the drive letter, or device ID.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nwrite-host (\"[{0}] {1} \" -f $drive.systemname.PadRight($longest.length),$drive.DeviceID)  -NoNewline<br \/>\n[\/cc]<\/p>\n<p>Remember, this is all on the same line. So next I \"graph\" usage using the -Foregroundcolor parameter.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n write-host $freeGraph -ForegroundColor darkgreen -NoNewline<br \/>\n write-host $UsedGraph -ForegroundColor red -NoNewline<br \/>\n[\/cc]<\/p>\n<p>The last part writes the percent free value. At this point I have nothing else to write on the line so I'll let Write-Host insert a return.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n write-host (\" {0} free \" -f $PerFree)<br \/>\n[\/cc]<\/p>\n<p>I toyed with a number of spacing options but ended up inserting a return after every result.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n#insert a return between each drive<br \/>\nwrite-host \"`r\"<br \/>\n[\/cc]<\/p>\n<p>The final script can be run like this:<\/p>\n<p>[cc lang=\"DOS\"]<br \/>\nPS C:\\> S:\\demo-colorgraph.ps1 \"client2\",\"coredc01\",\"server01\"<br \/>\n[\/cc]<\/p>\n<p>Here's the end result:<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/colordrivegraph.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/colordrivegraph-300x129.png\" alt=\"\" title=\"colordrivegraph\" width=\"300\" height=\"129\" class=\"aligncenter size-medium wp-image-1894\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/colordrivegraph-300x129.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/colordrivegraph.png 837w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>If you need a quick visual check, this works just fine. However, because nothing is written to the pipeline all you can do is look; but sometimes that is enough. If nothing else, maybe you picked up a few PowerShell tidbits that might help in your own work.<\/p>\n<p>You can download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/demo-colorgraph.txt' target='_blank'>demo-colorgraph.ps1<\/a> to kick around. As with all my Friday Fun posts, this is not intended as a production ready, or even production worthy script, but rather something to have a little fun with and learn something new along the way.  Enjoy.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I think you&#8217;ll like this. Normally, I prefer my PowerShell commands to write objects to the pipeline. But there&#8217;s nothing wrong with sending output directly to the console, as long as you know that the output is intended only for the screen. What I find frustrating is the use of Write-Host when really, pipelined objects&#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":[4,8,19],"tags":[176,103,342,534,101],"class_list":["post-1891","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","category-wmi","tag-console","tag-get-wmiobject","tag-group-object","tag-powershell","tag-write-host"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Friday Fun Drive Usage Console Graph &#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\/1891\/friday-fun-drive-usage-console-graph\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun Drive Usage Console Graph &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I think you&#039;ll like this. Normally, I prefer my PowerShell commands to write objects to the pipeline. But there&#039;s nothing wrong with sending output directly to the console, as long as you know that the output is intended only for the screen. What I find frustrating is the use of Write-Host when really, pipelined objects...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-12-09T16:37:44+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/colordrivegraph-300x129.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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun Drive Usage Console Graph\",\"datePublished\":\"2011-12-09T16:37:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/\"},\"wordCount\":1231,\"commentCount\":10,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/12\\\/colordrivegraph-300x129.png\",\"keywords\":[\"console\",\"Get-WMIObject\",\"Group-Object\",\"PowerShell\",\"Write-Host\"],\"articleSection\":[\"PowerShell\",\"Scripting\",\"WMI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/\",\"name\":\"Friday Fun Drive Usage Console Graph &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/12\\\/colordrivegraph-300x129.png\",\"datePublished\":\"2011-12-09T16:37:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/12\\\/colordrivegraph.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/12\\\/colordrivegraph.png\",\"width\":\"837\",\"height\":\"362\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1891\\\/friday-fun-drive-usage-console-graph\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun Drive Usage Console Graph\"}]},{\"@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 Drive Usage Console Graph &#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\/1891\/friday-fun-drive-usage-console-graph\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun Drive Usage Console Graph &#8226; The Lonely Administrator","og_description":"I think you'll like this. Normally, I prefer my PowerShell commands to write objects to the pipeline. But there's nothing wrong with sending output directly to the console, as long as you know that the output is intended only for the screen. What I find frustrating is the use of Write-Host when really, pipelined objects...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-12-09T16:37:44+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/colordrivegraph-300x129.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun Drive Usage Console Graph","datePublished":"2011-12-09T16:37:44+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/"},"wordCount":1231,"commentCount":10,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/colordrivegraph-300x129.png","keywords":["console","Get-WMIObject","Group-Object","PowerShell","Write-Host"],"articleSection":["PowerShell","Scripting","WMI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/","name":"Friday Fun Drive Usage Console Graph &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/colordrivegraph-300x129.png","datePublished":"2011-12-09T16:37:44+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/colordrivegraph.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/12\/colordrivegraph.png","width":"837","height":"362"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1891\/friday-fun-drive-usage-console-graph\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Friday Fun Drive Usage Console Graph"}]},{"@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":449,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/449\/drive-report-console-chart\/","url_meta":{"origin":1891,"position":0},"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":904,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/904\/friday-fun-color-my-world\/","url_meta":{"origin":1891,"position":1},"title":"Friday Fun: Color My World","author":"Jeffery Hicks","date":"September 3, 2010","format":false,"excerpt":"The end of another work week and time for a little PowerShell fun. When I first started using PowerShell, I was fascinated by Write-Host and the ability to write colorized text to the console. Visions of ANSI art danced in my head, but I've moved on. Using colors with Write-Host\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\/09\/color-1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/09\/color-1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/09\/color-1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":2098,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2098\/valentines-day-powershell-fun\/","url_meta":{"origin":1891,"position":2},"title":"Valentines Day PowerShell Fun","author":"Jeffery Hicks","date":"February 14, 2012","format":false,"excerpt":"In case you missed some of the fun on Twitter and Google Plus, here are the PowerShell valentines I sent today. These are intended to be run from the PowerShell console, not the ISE. Also, depending on your console font, you might get slightly different results. I use Lucida Console.\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\/2012\/02\/psvalentine.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2361,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2361\/friday-fun-another-powershell-console-graph\/","url_meta":{"origin":1891,"position":3},"title":"Friday Fun: Another PowerShell Console Graph","author":"Jeffery Hicks","date":"June 1, 2012","format":false,"excerpt":"Late last year I posted a demo script to create a horizontal bar graph in the PowerShell console. I liked it and many of you did as well. But I also wanted to be able to create a vertical bar graph, ie one with columns. This is much trickier since\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\/2012\/06\/demo-bargraph-300x172.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":840,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/840\/pipelines-consoles-and-hosts\/","url_meta":{"origin":1891,"position":4},"title":"Pipelines, Consoles and Hosts","author":"Jeffery Hicks","date":"August 19, 2010","format":false,"excerpt":"I continue to come across a particular topic in discussion forums that causes many PowerShell beginners a lot of headaches and more than a little frustration. I know I've written about this before and I'm sure I'll cover it again, but when writing anything in PowerShell that you see in\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\/2010\/08\/write-demo.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2679,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2679\/graphing-with-the-powershell-console\/","url_meta":{"origin":1891,"position":5},"title":"Graphing with the PowerShell Console","author":"Jeffery Hicks","date":"January 9, 2013","format":false,"excerpt":"I've written before about using the PowerShell console as a graphing tool, primarily using Write-Host. Most of what I've published before were really proof of concept. I decided to try and come up with a more formal and re-usable tool that could create a horizontal bar graph based on a\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"out-consolegraph-1","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-1-1024x735.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-1-1024x735.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-1-1024x735.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1891","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=1891"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1891\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1891"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1891"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1891"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}