{"id":1301,"date":"2011-03-31T10:33:19","date_gmt":"2011-03-31T14:33:19","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1301"},"modified":"2011-03-31T10:33:19","modified_gmt":"2011-03-31T14:33:19","slug":"get-file-hash","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/","title":{"rendered":"Get File Hash"},"content":{"rendered":"<p>The other day I had the need to calculate MD5 file hashes in order to compare files. The PowerShell Community Extensions has a nifty cmdlet, Get-Hash, that does exactly that. Unfortunately, sometimes even free tools like this aren't an option, as in the case of my client. Or they don't go far enough. So with a little work I wrote my own function to compute a file hash using either MD5, SHA1, or SHA256.<!--more--><\/p>\n<p>My function, Get-FileHash, takes file names as input and writes a custom object to the pipeline.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS E:\\temp> get-filehash winlogon.xml<\/p>\n<p>Date     : 3\/31\/2011 10:04:46 AM<br \/>\nFullName : E:\\temp\\winlogon.xml<br \/>\nFileHash : 817511618E6ECCF41DC3CA93B5677EDE<br \/>\nHashType : MD5<br \/>\nFilename : winlogon.xml<br \/>\nSize     : 17700<br \/>\n[\/cc]<\/p>\n<p>The Date property is not the file date but the date of the hash. I can even audit entire folders and use the data later.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nC:\\work> dir c:\\scripts\\*.ps* | Get-FileHash | Export-CLIXml PSScriptHashes.xml<br \/>\n[\/cc]<\/p>\n<p>Here's the function minus the comment based help, which I generated by the way with <a href=\"http:\/\/jdhitsolutions.com\/blog\/2011\/03\/new-comment-help\/\" target=\"_blank\">New-CommentHelp.<br \/>\n<\/a><br \/>\n[cc lang=\"PowerShell\"]<br \/>\nFunction Get-FileHash {<\/p>\n<p>[cmdletbinding(SupportsShouldProcess=$True,ConfirmImpact=\"Low\")]<\/p>\n<p>Param (<br \/>\n  [Parameter(Position=0,Mandatory=$True,HelpMessage=\"Enter file name and path.\",<br \/>\n  ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]<br \/>\n  [ValidateNotNullorEmpty()]<br \/>\n  [Alias(\"name\",\"file\",\"path\")]<br \/>\n  [string[]]$PSPath,<br \/>\n  [Parameter(Position=1,Mandatory=$False)]<br \/>\n  [Alias(\"hash\")]<br \/>\n  [ValidateSet(\"MD5\",\"SHA1\",\"SHA256\")]<br \/>\n  [string]$Type = \"MD5\",<br \/>\n  [switch]$Force<br \/>\n)<\/p>\n<p>Begin<br \/>\n{<br \/>\n    #what time are we starting?<br \/>\n    $cmdStart=Get-Date<br \/>\n    Write-Verbose \"$(Get-Date) Starting $($myinvocation.mycommand)\"<\/p>\n<p>    if ($force)<br \/>\n    {<br \/>\n        Write-Verbose \"$(Get-Date) Using -Force to find hidden files\"<br \/>\n    }<br \/>\n    #create the hash provider<br \/>\n    Switch ($Type) {<br \/>\n    \"sha1\"  {<br \/>\n                $provider = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider<br \/>\n            }<br \/>\n    \"sha256\"  {<br \/>\n                $provider = New-Object System.Security.Cryptography.SHA256CryptoServiceProvider<br \/>\n            }<br \/>\n    \"md5\"   {<br \/>\n                $provider = New-Object System.Security.Cryptography.MD5CryptoServiceProvider<br \/>\n            }<br \/>\n     }<br \/>\n   Write-Verbose \"$(Get-Date) Calculating $type hash\"<br \/>\n} #begin<\/p>\n<p>Process<br \/>\n{<br \/>\n    Foreach ($name in $PSPath) {<br \/>\n        Write-Verbose \"$(Get-Date) Verifying $name\"<\/p>\n<p>        #verify file exists<br \/>\n        if (Test-Path -Path $name)<br \/>\n        {<br \/>\n            Write-Verbose \"$(Get-Date) Path verified\"<\/p>\n<p>            Try<br \/>\n            {<br \/>\n                #get the file item<br \/>\n                if ($force)<br \/>\n                {<br \/>\n                    $file=Get-Item -Path $name -force -ErrorAction \"Stop\"<br \/>\n                }<br \/>\n                else<br \/>\n                {<br \/>\n                   $file=Get-Item -Path $name -ErrorAction \"Stop\"<br \/>\n                }<br \/>\n            }<\/p>\n<p>            Catch<br \/>\n            {<br \/>\n                Write-Warning \"Cannot get item $name. Verify it is not a hidden file (did you use -Force?) and that you have correct permissions.\"<br \/>\n            }<\/p>\n<p>            #only process if we were able to get the item<br \/>\n            if ($file)<br \/>\n            {<br \/>\n                #only process if file size is greater than 0<br \/>\n                #this will also fail if the object is not from the<br \/>\n                #filesystem provider<br \/>\n                if ($file.length -gt 0)<br \/>\n                {<br \/>\n                    Write-Verbose \"$(Get-Date) Opening file stream\"<br \/>\n                    if ($pscmdlet.ShouldProcess($file.fullname))<br \/>\n                    {<br \/>\n                      Try<br \/>\n                      {<br \/>\n                        $inStream = $file.OpenRead()<br \/>\n                        Write-Verbose \"$(Get-Date) Computing hash\"<br \/>\n                        $start=Get-Date<br \/>\n                        $hashBytes = $provider.ComputeHash($inStream)<br \/>\n                        $end=Get-Date<br \/>\n                        Write-Verbose \"$(Get-Date) hash computed in $(($end-$start).ToString())\"<br \/>\n                        Write-Verbose \"$(Get-Date) Closing file stream\"<br \/>\n                        $inStream.Close() | Out-Null<\/p>\n<p>                        #define a hash string variable<br \/>\n                        $hashString=\"\"<br \/>\n                        Write-Verbose \"$(Get-Date) hashing file bytes\"<\/p>\n<p>                        foreach ($byte in $hashBytes)<br \/>\n                        {<br \/>\n                            #calculate the hash<br \/>\n                            $hashString+=$byte.ToString(\"X2\")<br \/>\n                        }<\/p>\n<p>                          #write the hash object to the pipeline<br \/>\n                          New-Object -TypeName PSObject -Property @{<br \/>\n                            Filename=$file.name<br \/>\n                            FullName=$file.Fullname<br \/>\n                            FileHash=$hashString<br \/>\n                            HashType=$Type<br \/>\n                            Size=$file.length<br \/>\n                            Date=Get-Date<br \/>\n                          }<br \/>\n                       } #try<br \/>\n                       Catch<br \/>\n                       {<br \/>\n                          Write-Warning \"Failed to get file contents for $($file.name).\"<br \/>\n                          Write-Warning $_.Exception.Message<br \/>\n                       }<br \/>\n                     } #should process<br \/>\n                    } #if $file.length<br \/>\n                    else<br \/>\n                     {<br \/>\n                        Write-Warning \"$(Get-Date) File size for $name is 0 or is not from the filesystem provider.\"<br \/>\n                     }<br \/>\n             }#if $file<br \/>\n        } #if Test-Path<br \/>\n        else<br \/>\n        {<br \/>\n            Write-Warning \"$(Get-Date) Failed to find $name.\"<br \/>\n        }<\/p>\n<p>    } #foreach $file<\/p>\n<p>} #process<\/p>\n<p>End<br \/>\n{<br \/>\n    Write-Verbose \"$(Get-Date) Ending $($myinvocation.mycommand)\"<br \/>\n    #what time did we finish?<br \/>\n    $cmdEnd=Get-Date<br \/>\n    Write-Verbose \"$(Get-Date) Total processing time $(($cmdEnd-$cmdStart).ToString())\"<br \/>\n}<\/p>\n<p>} #end function<br \/>\n[\/cc]<\/p>\n<p>The function takes file names as a parameter. You can also specify the hash algorithm. The default is MD5. If you will be calculating hash signatures for hidden items you will need to use -Force. Although I'm not changing the file, I included -WhatIf support because calculating a hash for a 30GB VHD takes some time and I often just wanted to test the rest of the function.<\/p>\n<p>Much of the function is comprised of error handling and testing. For example if the item is not in the filesystem or has a 0 size, there is nothing to calculate so I check for those things. Same thing goes for permissions. You must have READ permission otherwise there's no way to calculate a hash. If you don't, then an exception is caught.<\/p>\n<p>The core functionality is derived from creating an appropriate crypto provider.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nSwitch ($Type) {<br \/>\n    \"sha1\"  {<br \/>\n                $provider = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider<br \/>\n            }<br \/>\n    \"sha256\"  {<br \/>\n                $provider = New-Object System.Security.Cryptography.SHA256CryptoServiceProvider<br \/>\n            }<br \/>\n    \"md5\"   {<br \/>\n                $provider = New-Object System.Security.Cryptography.MD5CryptoServiceProvider<br \/>\n            }<br \/>\n     }<br \/>\n[\/cc]<\/p>\n<p>Once I've confirmed the file, it's contents are read as a stream and the provider computes a hash.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n$inStream = $file.OpenRead()<br \/>\nWrite-Verbose \"$(Get-Date) Computing hash\"<br \/>\n$start=Get-Date<br \/>\n$hashBytes = $provider.ComputeHash($inStream)<br \/>\n$end=Get-Date<br \/>\nWrite-Verbose \"$(Get-Date) hash computed in $(($end-$start).ToString())\"<br \/>\nWrite-Verbose \"$(Get-Date) Closing file stream\"<br \/>\n$inStream.Close() | Out-Null<br \/>\n[\/cc]<\/p>\n<p>This is where disk speed really comes into play. It took over a minute to calculate a hash for a 3GB file on an external USB drive and 17 seconds on an SSD.  In any event, the hash is collection of bytes which is converted into a friendly string format.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n foreach ($byte in $hashBytes) {<br \/>\n     #calculate the hash<br \/>\n     $hashString+=$byte.ToString(\"X2\")<br \/>\n }<br \/>\n[\/cc]<\/p>\n<p>At this point all that remains is to create a custom object with the information I want.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\n#write the hash object to the pipeline<br \/>\nNew-Object -TypeName PSObject -Property @{<br \/>\nFilename=$file.name<br \/>\nFullName=$file.Fullname<br \/>\nFileHash=$hashString<br \/>\nHashType=$Type<br \/>\nSize=$file.length<br \/>\nDate=Get-Date<br \/>\n}<br \/>\n[\/cc]<\/p>\n<p>I hope you'll let me know what works, and doesn't. I'm also open to enhancement suggestions.<\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/Get-FileHash.txt'>Get-FileHash<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The other day I had the need to calculate MD5 file hashes in order to compare files. The PowerShell Community Extensions has a nifty cmdlet, Get-Hash, that does exactly that. Unfortunately, sometimes even free tools like this aren&#8217;t an option, as in the case of my client. Or they don&#8217;t go far enough. So with&#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],"tags":[273,32,190,534,540],"class_list":["post-1301","post","type-post","status-publish","format-standard","hentry","category-powershell-v2-0","category-scripting","tag-cryptography","tag-functions","tag-new-object","tag-powershell","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Get File Hash &#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\/1301\/get-file-hash\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get File Hash &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"The other day I had the need to calculate MD5 file hashes in order to compare files. The PowerShell Community Extensions has a nifty cmdlet, Get-Hash, that does exactly that. Unfortunately, sometimes even free tools like this aren&#039;t an option, as in the case of my client. Or they don&#039;t go far enough. So with...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-03-31T14:33:19+00:00\" \/>\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\\\/1301\\\/get-file-hash\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1301\\\/get-file-hash\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Get File Hash\",\"datePublished\":\"2011-03-31T14:33:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1301\\\/get-file-hash\\\/\"},\"wordCount\":911,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"keywords\":[\"cryptography\",\"functions\",\"new-object\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"PowerShell v2.0\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1301\\\/get-file-hash\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1301\\\/get-file-hash\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1301\\\/get-file-hash\\\/\",\"name\":\"Get File Hash &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2011-03-31T14:33:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1301\\\/get-file-hash\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1301\\\/get-file-hash\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/scripting\\\/1301\\\/get-file-hash\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell v2.0\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell-v2-0\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get File Hash\"}]},{\"@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":"Get File Hash &#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\/1301\/get-file-hash\/","og_locale":"en_US","og_type":"article","og_title":"Get File Hash &#8226; The Lonely Administrator","og_description":"The other day I had the need to calculate MD5 file hashes in order to compare files. The PowerShell Community Extensions has a nifty cmdlet, Get-Hash, that does exactly that. Unfortunately, sometimes even free tools like this aren't an option, as in the case of my client. Or they don't go far enough. So with...","og_url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-03-31T14:33:19+00:00","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\/1301\/get-file-hash\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Get File Hash","datePublished":"2011-03-31T14:33:19+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/"},"wordCount":911,"commentCount":4,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"keywords":["cryptography","functions","new-object","PowerShell","Scripting"],"articleSection":["PowerShell v2.0","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/","url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/","name":"Get File Hash &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"datePublished":"2011-03-31T14:33:19+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1301\/get-file-hash\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell v2.0","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},{"@type":"ListItem","position":2,"name":"Get File Hash"}]},{"@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":2062,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2062\/export-and-import-hash-tables\/","url_meta":{"origin":1301,"position":0},"title":"Export and Import Hash Tables","author":"Jeffery Hicks","date":"February 2, 2012","format":false,"excerpt":"I use hash tables quite a bit and with the impending arrival of PowerShell 3.0 I expect even more so. PowerShell v3 allows you to define a hash table of default parameter values. I'm not going to to cover that feature specifically, but it made me realize I needed a\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":2390,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2390\/get-acl-information-with-powershell\/","url_meta":{"origin":1301,"position":1},"title":"Get ACL Information with PowerShell","author":"Jeffery Hicks","date":"June 21, 2012","format":false,"excerpt":"I got a question in the \"Ask Don and Jeff\" forum on PowerShell.com that intrigued me. The issue was working with the results of the Get-ACL cmdlet. The resulting object includes a property called Access which is a collection of access rule objects. Assuming you are using this with the\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\/06\/get-aclinfo-1-300x77.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4449,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4449\/measure-that-folder-with-powershell-revisited\/","url_meta":{"origin":1301,"position":2},"title":"Measure that Folder with PowerShell Revisited","author":"Jeffery Hicks","date":"July 15, 2015","format":false,"excerpt":"Last year I posted a PowerShell function to measure the size of a folder. I recently had a need to use it again, and realized it needed a few tweaks. By default, the original version recursively searched through all subfolders. But there may be situations where you only want to\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":1369,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1369\/scripting-games-2001-beginner-event-5-commentary\/","url_meta":{"origin":1301,"position":3},"title":"Scripting Games 2011 Beginner Event 5 Commentary","author":"Jeffery Hicks","date":"April 25, 2011","format":false,"excerpt":"My commentary for Beginner Event 5 in the 2011 Scripting Games is now available. One item that seems to be missing on the ScriptingGuys site is my complete solution so I thought I would share it here, plus a variation. My sample solution is perhaps a little over-wrought for a\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":4465,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4465\/measuring-folders-with-powershell-one-more-time\/","url_meta":{"origin":1301,"position":4},"title":"Measuring Folders with PowerShell One More Time","author":"Jeffery Hicks","date":"July 22, 2015","format":false,"excerpt":"I know I just posted an update to my Measure-Folder function but I couldn't help myself and now I have an update to the update. Part of the update came as the result of a comment asking about formatting results to a certain number of decimal places. I typically the\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":2704,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2704\/powershell-graphing-with-out-gridview\/","url_meta":{"origin":1301,"position":5},"title":"PowerShell Graphing with Out-Gridview","author":"Jeffery Hicks","date":"January 14, 2013","format":false,"excerpt":"I've received a lot of interest for my last few posts on graphing with the PowerShell console. But I decided I could add one more feature. Technically it might have made more sense to turn this into a separate function, but I decided to simply modify the last version of\u2026","rel":"","context":"In &quot;Powershell 3.0&quot;","block_context":{"text":"Powershell 3.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-3-0\/"},"img":{"alt_text":"out-consolegraph-gv","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-gv-1024x548.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-gv-1024x548.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/out-consolegraph-gv-1024x548.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1301","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=1301"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1301\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}