{"id":305,"date":"2020-03-09T08:00:45","date_gmt":"2020-03-09T08:00:45","guid":{"rendered":"https:\/\/practicalpowershell.com\/?p=305"},"modified":"2020-06-07T16:39:10","modified_gmt":"2020-06-07T22:39:10","slug":"get-history","status":"publish","type":"post","link":"https:\/\/practicalpowershell.com\/get-history\/","title":{"rendered":"Get-History"},"content":{"rendered":"<p>History is important and those that don&#8217;t know it are doomed to repeat it.<BR><br \/>\nOK. We aren&#8217;t talking about that kind of history.  In this Tip of the Week we will be referring to PowerShell session command history. PowerShel<\/p>\n<p>While building scripts or working in a particular environment, we may want to review a particular cmdlet or one-liner we previously used. One method for cycling through these cmdlets is to use the up arrow (or down arrow) to have PowerShell display these past commands. <BR><br \/>\n<em>Get-History<\/em><BR><br \/>\nBut what if we need to see more, perhaps a series of cmdlets that led to a current result?<br \/>\n[sourcecode language=&#8221;powershell&#8221;]<br \/>\nGet-Command *-History<br \/>\n[\/sourcecode]<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-01.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-01.jpg?resize=300%2C118&#038;ssl=1\" alt=\"\" width=\"300\" height=\"118\" class=\"aligncenter size-full wp-image-316\" \/><\/a><br \/>\nAs we can see, there is a series of cmdlets that can help us explore the cmdlet history in PowerShell.  First, let&#8217;s see what we can do with Get-History:<br \/>\n[sourcecode language=&#8221;powershell&#8221;]<br \/>\nGet-Help Get-History -Examples<br \/>\n[\/sourcecode]<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-02.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-02.jpg?resize=570%2C206&#038;ssl=1\" alt=\"\" width=\"570\" height=\"206\" class=\"aligncenter size-full wp-image-315\" srcset=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-02.jpg?w=570&amp;ssl=1 570w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-02.jpg?resize=300%2C108&amp;ssl=1 300w\" sizes=\"auto, (max-width: 570px) 100vw, 570px\" \/><\/a><br \/>\nIf we review the available parameters we see we only have ID and Count.  Let&#8217;s see what we can do with these parameters.<BR><br \/>\nFor example, if we were reviewing an Exchange environment and exporting certain information to files, we might see something like this:<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-03.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-03.jpg?resize=640%2C176&#038;ssl=1\" alt=\"\" width=\"640\" height=\"176\" class=\"aligncenter size-full wp-image-314\" srcset=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-03.jpg?w=954&amp;ssl=1 954w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-03.jpg?resize=300%2C82&amp;ssl=1 300w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-03.jpg?resize=768%2C211&amp;ssl=1 768w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-03.jpg?resize=600%2C165&amp;ssl=1 600w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/>\nIn another example, we are reviewing Active Directory and documenting settings, we might see something like this:<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-04.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-04.jpg?resize=640%2C106&#038;ssl=1\" alt=\"\" width=\"640\" height=\"106\" class=\"aligncenter size-full wp-image-313\" srcset=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-04.jpg?w=806&amp;ssl=1 806w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-04.jpg?resize=300%2C50&amp;ssl=1 300w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-04.jpg?resize=768%2C127&amp;ssl=1 768w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-04.jpg?resize=600%2C99&amp;ssl=1 600w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/>\nNow, if you look at lines 12 and 17, we see there is a  &#8216;\u2026&#8217; at the end of the line.  This means that there are hidden details.   How can we see what is hidden?<br \/>\n[sourcecode language=&#8221;powershell&#8221;]<br \/>\nGet-History -Id 17 | Fl<br \/>\n[\/sourcecode]<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-05.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-05.jpg?resize=640%2C289&#038;ssl=1\" alt=\"\" width=\"640\" height=\"289\" class=\"aligncenter size-full wp-image-312\" srcset=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-05.jpg?w=816&amp;ssl=1 816w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-05.jpg?resize=300%2C135&amp;ssl=1 300w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-05.jpg?resize=768%2C346&amp;ssl=1 768w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-05.jpg?resize=600%2C271&amp;ssl=1 600w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/>\nSame for 12:<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-06.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-06.jpg?resize=640%2C162&#038;ssl=1\" alt=\"\" width=\"640\" height=\"162\" class=\"aligncenter size-full wp-image-311\" srcset=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-06.jpg?w=656&amp;ssl=1 656w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-06.jpg?resize=300%2C76&amp;ssl=1 300w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-06.jpg?resize=600%2C152&amp;ssl=1 600w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/>\nNow if we wanted to flush the cache of what was run in our current PowerShell window, we can run the Clear-History cmdlet.  Then we can run Get-History to verify no history is left:<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-07.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-07.jpg?resize=192%2C110&#038;ssl=1\" alt=\"\" width=\"192\" height=\"110\" class=\"aligncenter size-full wp-image-310\" \/><\/a><br \/>\nNotice that even after we cleared our PowerShell history, the ID count for the commands executed is still incrementing.<BR><br \/>\n<em>Add-History<\/em><BR><br \/>\nAdd-History may see like an odd cmdlet to use in PowerShell, but it&#8217;s intent is to help an operator keep track of cmdlets that have been run in one or more shell windows.  We can use the cmdlet to possibly add the history from other PowerShell sessions to consolidate what has been executed.  Combined this with a Get-History one-liner we can document all items that were run by exporting the list to an external file for later use, for auditing or just documentation purposes.<BR><br \/>\nExamples from Add-History:<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-08.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-08.jpg?resize=640%2C255&#038;ssl=1\" alt=\"\" width=\"640\" height=\"255\" class=\"aligncenter size-full wp-image-309\" srcset=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-08.jpg?w=880&amp;ssl=1 880w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-08.jpg?resize=300%2C119&amp;ssl=1 300w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-08.jpg?resize=768%2C305&amp;ssl=1 768w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-08.jpg?resize=600%2C239&amp;ssl=1 600w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/>\n<em>Invoke-History<\/em><BR><br \/>\nIf we want, once we have the information on a particular command, we can re-execute the cmdlet with the Invoke-history cmdlet.  See the following examples as guidance:<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-09.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-09.jpg?resize=538%2C304&#038;ssl=1\" alt=\"\" width=\"538\" height=\"304\" class=\"aligncenter size-full wp-image-308\" srcset=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-09.jpg?w=538&amp;ssl=1 538w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-09.jpg?resize=300%2C170&amp;ssl=1 300w\" sizes=\"auto, (max-width: 538px) 100vw, 538px\" \/><\/a><br \/>\nUsing the previous list of cmdlets for Active Directory, if we wanted to re-run #17 or #12, we simply need to execute this:<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-10.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-10.jpg?resize=640%2C89&#038;ssl=1\" alt=\"\" width=\"640\" height=\"89\" class=\"aligncenter size-full wp-image-307\" srcset=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-10.jpg?w=880&amp;ssl=1 880w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-10.jpg?resize=300%2C42&amp;ssl=1 300w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-10.jpg?resize=768%2C106&amp;ssl=1 768w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-10.jpg?resize=600%2C83&amp;ssl=1 600w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/>\nHowever, if we&#8217;ve already cleared the information from PowerShell history, we will receive the above error.  If we have not cleared the Exchange examples we can try something like ID 37:<br \/>\n[sourcecode language=&#8221;powershell&#8221;]<br \/>\nInvoke-History -Id 37<br \/>\n[\/sourcecode]<br \/>\nWe would see something like this:<br \/>\n<a href=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-11.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-11.jpg?resize=640%2C128&#038;ssl=1\" alt=\"\" width=\"640\" height=\"128\" class=\"aligncenter size-full wp-image-306\" srcset=\"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-11.jpg?w=988&amp;ssl=1 988w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-11.jpg?resize=300%2C60&amp;ssl=1 300w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-11.jpg?resize=768%2C154&amp;ssl=1 768w, https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-11.jpg?resize=600%2C120&amp;ssl=1 600w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><br \/>\n<strong>Summary<\/strong><BR><br \/>\nThe *History set of cmdlets provides a good insight into what was run in the PowerShell session that we are currently in.   The cmdlet set can easily supplement your current workflows to provide a way to keep track of what is being used to possibly checking syntax or re-executing a one-liner for some other workflow.  Be careful with Clear-History as you may lose crucial information by using it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>History is important and those that don&#8217;t know it are doomed to repeat it. OK. We aren&#8217;t talking about that kind of history. In this Tip of the Week we will be referring to PowerShell session command history. PowerShel While building scripts or working in a particular environment, we may want to review a particular [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rop_custom_images_group":[],"rop_custom_messages_group":[],"rop_publish_now":"initial","rop_publish_now_accounts":[],"rop_publish_now_history":[],"rop_publish_now_status":"pending","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[22],"tags":[],"class_list":["post-305","post","type-post","status-publish","format-standard","hentry","category-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Get-History - Practical PowerShell<\/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:\/\/practicalpowershell.com\/get-history\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get-History - Practical PowerShell\" \/>\n<meta property=\"og:description\" content=\"History is important and those that don&#8217;t know it are doomed to repeat it. OK. We aren&#8217;t talking about that kind of history. In this Tip of the Week we will be referring to PowerShell session command history. PowerShel While building scripts or working in a particular environment, we may want to review a particular [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/practicalpowershell.com\/get-history\/\" \/>\n<meta property=\"og:site_name\" content=\"Practical PowerShell\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-09T08:00:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-07T22:39:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-01.jpg\" \/>\n<meta name=\"author\" content=\"damian\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"damian\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/\"},\"author\":{\"name\":\"damian\",\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/#\\\/schema\\\/person\\\/4d0733c81966e744aabbb49f56d64deb\"},\"headline\":\"Get-History\",\"datePublished\":\"2020-03-09T08:00:45+00:00\",\"dateModified\":\"2020-06-07T22:39:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/\"},\"wordCount\":556,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/#\\\/schema\\\/person\\\/4d0733c81966e744aabbb49f56d64deb\"},\"image\":{\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/practicalpowershell.com\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/Chapter04-History-01.jpg\",\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/\",\"url\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/\",\"name\":\"Get-History - Practical PowerShell\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/practicalpowershell.com\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/Chapter04-History-01.jpg\",\"datePublished\":\"2020-03-09T08:00:45+00:00\",\"dateModified\":\"2020-06-07T22:39:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/practicalpowershell.com\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/Chapter04-History-01.jpg?fit=300%2C118&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/practicalpowershell.com\\\/wp-content\\\/uploads\\\/2020\\\/03\\\/Chapter04-History-01.jpg?fit=300%2C118&ssl=1\",\"width\":300,\"height\":118},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/get-history\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/practicalpowershell.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get-History\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/#website\",\"url\":\"https:\\\/\\\/practicalpowershell.com\\\/\",\"name\":\"Practical PowerShell\",\"description\":\"PowerShell books written by experts\",\"publisher\":{\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/#\\\/schema\\\/person\\\/4d0733c81966e744aabbb49f56d64deb\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/practicalpowershell.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/practicalpowershell.com\\\/#\\\/schema\\\/person\\\/4d0733c81966e744aabbb49f56d64deb\",\"name\":\"damian\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d5a8cc64a5aa27558a897b108e3be1a89859511a3fd26176dac292f26e7a4ae4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d5a8cc64a5aa27558a897b108e3be1a89859511a3fd26176dac292f26e7a4ae4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d5a8cc64a5aa27558a897b108e3be1a89859511a3fd26176dac292f26e7a4ae4?s=96&d=mm&r=g\",\"caption\":\"damian\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d5a8cc64a5aa27558a897b108e3be1a89859511a3fd26176dac292f26e7a4ae4?s=96&d=mm&r=g\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Get-History - Practical PowerShell","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:\/\/practicalpowershell.com\/get-history\/","og_locale":"en_US","og_type":"article","og_title":"Get-History - Practical PowerShell","og_description":"History is important and those that don&#8217;t know it are doomed to repeat it. OK. We aren&#8217;t talking about that kind of history. In this Tip of the Week we will be referring to PowerShell session command history. PowerShel While building scripts or working in a particular environment, we may want to review a particular [&hellip;]","og_url":"https:\/\/practicalpowershell.com\/get-history\/","og_site_name":"Practical PowerShell","article_published_time":"2020-03-09T08:00:45+00:00","article_modified_time":"2020-06-07T22:39:10+00:00","og_image":[{"url":"https:\/\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-01.jpg","type":"","width":"","height":""}],"author":"damian","twitter_card":"summary_large_image","twitter_misc":{"Written by":"damian","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/practicalpowershell.com\/get-history\/#article","isPartOf":{"@id":"https:\/\/practicalpowershell.com\/get-history\/"},"author":{"name":"damian","@id":"https:\/\/practicalpowershell.com\/#\/schema\/person\/4d0733c81966e744aabbb49f56d64deb"},"headline":"Get-History","datePublished":"2020-03-09T08:00:45+00:00","dateModified":"2020-06-07T22:39:10+00:00","mainEntityOfPage":{"@id":"https:\/\/practicalpowershell.com\/get-history\/"},"wordCount":556,"commentCount":0,"publisher":{"@id":"https:\/\/practicalpowershell.com\/#\/schema\/person\/4d0733c81966e744aabbb49f56d64deb"},"image":{"@id":"https:\/\/practicalpowershell.com\/get-history\/#primaryimage"},"thumbnailUrl":"https:\/\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-01.jpg","articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/practicalpowershell.com\/get-history\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/practicalpowershell.com\/get-history\/","url":"https:\/\/practicalpowershell.com\/get-history\/","name":"Get-History - Practical PowerShell","isPartOf":{"@id":"https:\/\/practicalpowershell.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/practicalpowershell.com\/get-history\/#primaryimage"},"image":{"@id":"https:\/\/practicalpowershell.com\/get-history\/#primaryimage"},"thumbnailUrl":"https:\/\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-01.jpg","datePublished":"2020-03-09T08:00:45+00:00","dateModified":"2020-06-07T22:39:10+00:00","breadcrumb":{"@id":"https:\/\/practicalpowershell.com\/get-history\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/practicalpowershell.com\/get-history\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/practicalpowershell.com\/get-history\/#primaryimage","url":"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-01.jpg?fit=300%2C118&ssl=1","contentUrl":"https:\/\/i0.wp.com\/practicalpowershell.com\/wp-content\/uploads\/2020\/03\/Chapter04-History-01.jpg?fit=300%2C118&ssl=1","width":300,"height":118},{"@type":"BreadcrumbList","@id":"https:\/\/practicalpowershell.com\/get-history\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/practicalpowershell.com\/"},{"@type":"ListItem","position":2,"name":"Get-History"}]},{"@type":"WebSite","@id":"https:\/\/practicalpowershell.com\/#website","url":"https:\/\/practicalpowershell.com\/","name":"Practical PowerShell","description":"PowerShell books written by experts","publisher":{"@id":"https:\/\/practicalpowershell.com\/#\/schema\/person\/4d0733c81966e744aabbb49f56d64deb"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/practicalpowershell.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/practicalpowershell.com\/#\/schema\/person\/4d0733c81966e744aabbb49f56d64deb","name":"damian","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d5a8cc64a5aa27558a897b108e3be1a89859511a3fd26176dac292f26e7a4ae4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d5a8cc64a5aa27558a897b108e3be1a89859511a3fd26176dac292f26e7a4ae4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d5a8cc64a5aa27558a897b108e3be1a89859511a3fd26176dac292f26e7a4ae4?s=96&d=mm&r=g","caption":"damian"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/d5a8cc64a5aa27558a897b108e3be1a89859511a3fd26176dac292f26e7a4ae4?s=96&d=mm&r=g"}}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/practicalpowershell.com\/wp-json\/wp\/v2\/posts\/305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/practicalpowershell.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/practicalpowershell.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/practicalpowershell.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/practicalpowershell.com\/wp-json\/wp\/v2\/comments?post=305"}],"version-history":[{"count":1,"href":"https:\/\/practicalpowershell.com\/wp-json\/wp\/v2\/posts\/305\/revisions"}],"predecessor-version":[{"id":317,"href":"https:\/\/practicalpowershell.com\/wp-json\/wp\/v2\/posts\/305\/revisions\/317"}],"wp:attachment":[{"href":"https:\/\/practicalpowershell.com\/wp-json\/wp\/v2\/media?parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/practicalpowershell.com\/wp-json\/wp\/v2\/categories?post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/practicalpowershell.com\/wp-json\/wp\/v2\/tags?post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}