{"id":1156,"date":"2011-02-21T09:00:36","date_gmt":"2011-02-21T14:00:36","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1156"},"modified":"2011-02-19T12:30:33","modified_gmt":"2011-02-19T17:30:33","slug":"powershell-ise-most-recent-files","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/","title":{"rendered":"PowerShell ISE Most Recent Files"},"content":{"rendered":"<p>The PowerShell ISE is a handy tool for editing and testing your scripts, functions and modules. If you can't afford a good commercial editor then you should at least be using the ISE. One benefit of the ISE is that it has its own object model which means it is extensible. One thing I always missed in the ISE was a most recently used list. So I created one.<!--more--><\/p>\n<p>I've been thinking about this for awhile and Oisin Grehan's recent <a href=\"http:\/\/www.nivot.org\/2011\/02\/14\/MakingWindowsPowerShellISEGoodEnough.aspx\" target=\"_blank\">post on an ISE Session module<\/a> got me finally going. But rather than deal with restoring the ISE to a previous state, I simply wanted a list of files that I had recently opened. My solution was to take advantage of the CollectionChanged event of the $psISE.CurrentPowerShellTab.Files object. Whenever a file is added (or removed) this event is triggered, or \"fired\". Using the Register-ObjectEvent cmdlet, I created an event handler.<br \/>\n[cc lang=\"PowerShell\"]<br \/>\nRegister-ObjectEvent $psise.CurrentPowerShellTab.Files -EventName collectionchanged `<br \/>\n-sourceIdentifier \"ISEChangeLog\"-action {...<br \/>\n[\/cc]<br \/>\nThis is done within the ISE. The code in the Action script block will execute every time the collection changes. So that's the core of this code.  When the event fires, there is a new object, $event, which contains information about the event. In my case, I can use the Sender property which will be a psISE File object for every file in the current collection. My solution was to get the file's name and path and write it to a CSV file. I also decided to include a datetime stamp. This is the date and time the file was added, not necessarily edited or saved. <\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n #initialize an array to hold recent file paths<br \/>\n $recent=@()<br \/>\n #get a list of the $Count most recent files and add each path to the $recent array<br \/>\n Import-CSV $global:ISERecent | Sort LastEdit | Select -Last $count | foreach {$recent+=$_.Fullpath}<\/p>\n<p>  #iterate ISEFile objects but only those that have been saved, not Untitled and not already in the list.<br \/>\n  $event.sender |<br \/>\n  where {($_.IsSaved) -AND (-Not $_.IsUntitled) -AND ($recent -notContains $_.Fullpath)} |<br \/>\n  foreach {<br \/>\n    #add the filename to the list<br \/>\n   \"$($_.Fullpath),$($_.Displayname),$(Get-Date)\" | out-file $global:ISERecent -append -Encoding ASCII<br \/>\n  } #foreach<br \/>\n[\/cc]<\/p>\n<p>With this CSV, I could then get the last X number of items, my code has a default of 5, and add them to a custom menu under AddOns. My script includes a function to handle this.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nFunction Update-ISEMRU {<br \/>\nParam()<br \/>\n     #remove the five most recent files<br \/>\n     $mru=$psise.CurrentPowerShellTab.AddOnsMenu.Submenus | where {$_.Displayname -eq \"Most Recent\"}<br \/>\n     $mru.submenus.clear()<\/p>\n<p>     #get the five most recent files and add them to the menu<br \/>\n     #resort them so that the last closed file is on the top of the menu<br \/>\n     Import-CSV $global:ISERecent | Sort LastEdit | Select -Last $count  | Sort LastEdit -Descending | foreach {<br \/>\n     #create a string with the filepath<br \/>\n     [string]$cmd=\"`$psise.CurrentPowerShelltab.Files.Add(\"\"$($_.fullpath)\"\")\"<br \/>\n     #turn it into a script block<br \/>\n     $action=$executioncontext.InvokeCommand.NewScriptBlock($cmd)<br \/>\n     #add it to the menu<br \/>\n     $mru.submenus.Add($_.Displayname,$action,$null)<br \/>\n    }<br \/>\n  } #end function<br \/>\n[\/cc]<\/p>\n<p>In my ISE profile script, I call my script, passing it the number of most recent items I want to keep.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n. c:\\scripts\\Set-ISEMostRecent.ps1 -count 7<br \/>\n[\/cc]<\/p>\n<p>When I run the ISE, I'll get a new menu like this.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/isemenu.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/isemenu-300x198.png\" alt=\"\" title=\"ISE Most Recent\" width=\"300\" height=\"198\" class=\"aligncenter size-medium wp-image-1157\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/isemenu-300x198.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/isemenu.png 865w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>To keep the CSV file from getting out of control, I have code to check it and if there are twice as many items as fit in the menu, then only the most recent X number are kept.  This is the final script.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nParam([int]$Count=5)<\/p>\n<p>#Create the add-on menu<br \/>\n$mru=$psise.CurrentPowerShellTab.AddOnsMenu.Submenus.Add(\"Most Recent\",$null,$null)<\/p>\n<p>$global:ISERecent=(Join-Path -path $env:Userprofile\\Documents\\WindowsPowershell -child \"$($psise.CurrentPowerShellTab.displayname) ISE Most Recent.csv\")<br \/>\nif (-Not (Test-Path $global:ISERecent))<br \/>\n{<br \/>\n    #create the csv file header<br \/>\n    \"Fullpath,DisplayName,LastEdit\" | out-File $global:ISERecent -Encoding ASCII<br \/>\n}<br \/>\nelse<br \/>\n{<\/p>\n<p>#check for log file and trim it to $Count items if there are more than twice the $count items<br \/>\n$save=Import-CSV -Path $global:ISERecent | Sort LastEdit -descending<br \/>\nif ($save.count -ge ($count*2))<br \/>\n{<br \/>\n   $save[0..$count] | Export-Csv -Path $global:ISERecent -Encoding ASCII<br \/>\n}<\/p>\n<p>  Import-CSV $global:ISERecent | Select -Last $count | Sort LastEdit -descending | foreach {<br \/>\n     #create a string with the filepath<br \/>\n     [string]$cmd=\"`$psise.CurrentPowerShelltab.Files.Add(\"\"$($_.fullpath)\"\")\"<br \/>\n     #turn it into a script block<br \/>\n     $action=$executioncontext.InvokeCommand.NewScriptBlock($cmd)<br \/>\n     #add it to the menu<br \/>\n     $mru.submenus.Add($_.Displayname,$action,$null) | out-Null<br \/>\n    }<br \/>\n}<\/p>\n<p>#define a function to update the MRU<br \/>\nFunction Update-ISEMRU {<br \/>\nParam()<br \/>\n     #remove the five most recent files<br \/>\n     $mru=$psise.CurrentPowerShellTab.AddOnsMenu.Submenus | where {$_.Displayname -eq \"Most Recent\"}<br \/>\n     $mru.submenus.clear()<\/p>\n<p>     #get the five most recent files and add them to the menu<br \/>\n     #resort them so that the last closed file is on the top of the menu<br \/>\n     Import-CSV $global:ISERecent | Sort LastEdit | Select -Last $count  | Sort LastEdit -Descending | foreach {<br \/>\n     #create a string with the filepath<br \/>\n     [string]$cmd=\"`$psise.CurrentPowerShelltab.Files.Add(\"\"$($_.fullpath)\"\")\"<br \/>\n     #turn it into a script block<br \/>\n     $action=$executioncontext.InvokeCommand.NewScriptBlock($cmd)<br \/>\n     #add it to the menu<br \/>\n     $mru.submenus.Add($_.Displayname,$action,$null)<br \/>\n    }<br \/>\n  } #end function<\/p>\n<p>#register the event to watch for changes<br \/>\nRegister-ObjectEvent $psise.CurrentPowerShellTab.Files -EventName collectionchanged `<br \/>\n-sourceIdentifier \"ISEChangeLog\"-action {<br \/>\n #initialize an array to hold recent file paths<br \/>\n $recent=@()<br \/>\n #get a list of the $Count most recent files and add each path to the $recent array<br \/>\n Import-CSV $global:ISERecent | Sort LastEdit | Select -Last $count | foreach {$recent+=$_.Fullpath}<\/p>\n<p>  #iterate ISEFile objects but only those that have been saved, not Untitled and not already in the list.<br \/>\n  $event.sender |<br \/>\n  where {($_.IsSaved) -AND (-Not $_.IsUntitled) -AND ($recent -notContains $_.Fullpath)} |<br \/>\n  foreach {<br \/>\n    #add the filename to the list<br \/>\n   \"$($_.Fullpath),$($_.Displayname),$(Get-Date)\" | out-file $global:ISERecent -append -Encoding ASCII<br \/>\n  } #foreach<br \/>\n  #refresh the menu<br \/>\n  Update-ISEMRU <\/p>\n<p>}  #close -action<br \/>\n[\/cc]<\/p>\n<p>If you open a second PowerShell tab, you'll get a new recent menu. However, if you rename the tab the menu updating will stop. But, the next time you open the ISE and open that 2nd tab, you'll get the menu back.  The other limitation is that when you have an untitled script, right now I don't save them, when you save the script with a name it is not added to the most recent list. The next time you add open a file, as long as you new script is still open it will get added. But I have no good way now of handling new scripts. And if you save and close and untitled script, it won't make the list. I've experimented with some ugly workarounds but haven't found anything I like so I've left that out of this version.<\/p>\n<p>You'll have to <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/Set-ISEMostRecent.txt' target=\"_blank\">download the script<\/a> and let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The PowerShell ISE is a handy tool for editing and testing your scripts, functions and modules. If you can&#8217;t afford a good commercial editor then you should at least be using the ISE. One benefit of the ISE is that it has its own object model which means it is extensible. One thing I always&#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,231],"tags":[232,534,253],"class_list":["post-1156","post","type-post","status-publish","format-standard","hentry","category-powershell","category-powershell-ise","tag-ise","tag-powershell","tag-register-objectevent"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PowerShell ISE Most Recent Files &#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\/1156\/powershell-ise-most-recent-files\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PowerShell ISE Most Recent Files &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"The PowerShell ISE is a handy tool for editing and testing your scripts, functions and modules. If you can&#039;t afford a good commercial editor then you should at least be using the ISE. One benefit of the ISE is that it has its own object model which means it is extensible. One thing I always...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-02-21T14:00:36+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/isemenu-300x198.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=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"PowerShell ISE Most Recent Files\",\"datePublished\":\"2011-02-21T14:00:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/\"},\"wordCount\":1107,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/02\\\/isemenu-300x198.png\",\"keywords\":[\"ISE\",\"PowerShell\",\"Register-ObjectEvent\"],\"articleSection\":[\"PowerShell\",\"PowerShell ISE\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/\",\"name\":\"PowerShell ISE Most Recent Files &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/02\\\/isemenu-300x198.png\",\"datePublished\":\"2011-02-21T14:00:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/02\\\/isemenu.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/02\\\/isemenu.png\",\"width\":\"865\",\"height\":\"572\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1156\\\/powershell-ise-most-recent-files\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PowerShell ISE Most Recent Files\"}]},{\"@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":"PowerShell ISE Most Recent Files &#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\/1156\/powershell-ise-most-recent-files\/","og_locale":"en_US","og_type":"article","og_title":"PowerShell ISE Most Recent Files &#8226; The Lonely Administrator","og_description":"The PowerShell ISE is a handy tool for editing and testing your scripts, functions and modules. If you can't afford a good commercial editor then you should at least be using the ISE. One benefit of the ISE is that it has its own object model which means it is extensible. One thing I always...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-02-21T14:00:36+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/isemenu-300x198.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":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"PowerShell ISE Most Recent Files","datePublished":"2011-02-21T14:00:36+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/"},"wordCount":1107,"commentCount":6,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/isemenu-300x198.png","keywords":["ISE","PowerShell","Register-ObjectEvent"],"articleSection":["PowerShell","PowerShell ISE"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/","name":"PowerShell ISE Most Recent Files &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/isemenu-300x198.png","datePublished":"2011-02-21T14:00:36+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/isemenu.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/02\/isemenu.png","width":"865","height":"572"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1156\/powershell-ise-most-recent-files\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"PowerShell ISE Most Recent Files"}]},{"@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":2673,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2673\/friday-fun-edit-recent-file\/","url_meta":{"origin":1156,"position":0},"title":"Friday Fun: Edit Recent File","author":"Jeffery Hicks","date":"January 4, 2013","format":false,"excerpt":"As you might imagine I work on a lot of PowerShell projects at the same time. Sometimes I'll start something at the beginning of the week and then need to come back to it at the end of the week. The problem is that I can't always remembered what I\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":"Edit-RecentFile","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/Edit-RecentFile-300x209.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4305,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4305\/what-powershell-script-was-i-working-on\/","url_meta":{"origin":1156,"position":1},"title":"What PowerShell Script Was I Working On?","author":"Jeffery Hicks","date":"March 24, 2015","format":false,"excerpt":"Last week I shared a script for finding recently modified files in a given directory. In fact, it wouldn't be that difficult to find the last files I was working on and open them in the PowerShell ISE. Assuming my Get-RecentFile function is loaded it is a simple as this:\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":1197,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1197\/a-few-ise-tweaks\/","url_meta":{"origin":1156,"position":2},"title":"A few ISE tweaks","author":"Jeffery Hicks","date":"March 8, 2011","format":false,"excerpt":"If you use the PowerShell ISE as your primary script editor, you might want to tweak it a bit. The first thing you'll need is your ISE profile script. If it doesn't exist, you'll need to create. PowerShell will look for file C:\\Users\\USERNAME\\Documents\\WindowsPowerShell\\Microsoft.PowerShellISE_profile.ps1 (on Windows 7 anyway). Any commands 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":1319,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-ise\/1319\/powershell-ise-case-closed\/","url_meta":{"origin":1156,"position":3},"title":"PowerShell ISE Case Closed","author":"Jeffery Hicks","date":"April 5, 2011","format":false,"excerpt":"When writing a PowerShell script or function, things like indentations, white space and case make a big difference in how easy it is to read and understand your code. Sometimes it can be helpful to have a word or sentence in all upper case so that it stands out. Here\u2026","rel":"","context":"In &quot;PowerShell ISE&quot;","block_context":{"text":"PowerShell ISE","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-ise\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7468,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7468\/powershell-7-scripting-with-the-powershell-ise\/","url_meta":{"origin":1156,"position":4},"title":"PowerShell 7 Scripting with the PowerShell ISE","author":"Jeffery Hicks","date":"May 11, 2020","format":false,"excerpt":"By now, everyone should have gotten the memo that with the move to PowerShell 7, the PowerShell ISE should be considered deprecated. When it comes to PowerShell script and module development for PowerShell 7, the recommended tool is Visual Studio Code. It is free and offers so much more than\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\/2020\/05\/ise-ps7.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ise-ps7.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ise-ps7.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ise-ps7.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":5060,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-ise\/5060\/jumping-in-the-powershell-ise\/","url_meta":{"origin":1156,"position":5},"title":"Jumping in the PowerShell ISE","author":"Jeffery Hicks","date":"June 6, 2016","format":false,"excerpt":"During my day I may be working on multiple files in the PowerShell ISE. Often these files are part of different modules and since I use git I generally need to be in the same directory as the file I'm working on. This necessitates a lot of manually changing location\u2026","rel":"","context":"In &quot;PowerShell ISE&quot;","block_context":{"text":"PowerShell ISE","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-ise\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-3.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-3.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-3.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1156","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=1156"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1156\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}