{"id":8650,"date":"2021-10-20T09:43:04","date_gmt":"2021-10-20T13:43:04","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=8650"},"modified":"2021-10-20T09:43:09","modified_gmt":"2021-10-20T13:43:09","slug":"removing-obsolete-powershell-remoting-configurations","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/","title":{"rendered":"Removing Obsolete PowerShell Remoting Configurations"},"content":{"rendered":"\n<p>I'm pretty sure I've discussed this before, but Microsoft is scheduled to release PowerShell 7.2 soon, I thought it might be good to revisit this topic. Here's the potential issue. If you've been installing PowerShell 7 releases for a while, and have been enabling PowerShell remoting, you most likely have a list of remoting session configurations like this.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs.png\"><img loading=\"lazy\" decoding=\"async\" width=\"619\" height=\"617\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs.png\" alt=\"\" class=\"wp-image-8651\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs.png 619w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs-300x299.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs-150x150.png 150w\" sizes=\"auto, (max-width: 619px) 100vw, 619px\" \/><\/a><\/figure>\n\n\n\n<p>If you run Get-PSSessionConfiguration in Windows PowerShell, you'll these in addition to the Windows PowerShell 5.1 sessions. Now, there may not be any problem in having all of these configurations, but personally, I find it a bit messy. I don't like keeping something if it isn't being used. Time for a little housekeeping.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Unregister-PSSessionConfiguration<\/h2>\n\n\n\n<p>Removing a session configuration is simple enough using Unregister-PSSessionConfiguration. Specify the configuration name, and it is gone. The cmdlet also supports -WhatIf and -Confirm which I always recommend that you use. This is equivalent to the carpenter's adage of \"Measure twice, cut once.\" But I want an easy way to dump everything I'm not using except for the session configuration associated with the current PowerShell version. On my system that is 7.1.5. As an added twist, I also have the latest preview of PowerShell 7.2 installed, including a remoting configuration. I'd like to keep that as well. I know over time I'll need to do this housekeeping task again, so I might as well build a PowerShell function.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Remove-ObsoleteSessionConfiguration<\/h2>\n\n\n\n<p>My function is written to run in Windows PowerShell 5.1 as well as PowerShell 7. If I'm running in Windows PowerShell, I want to exclude the default session configurations.  I'll use a regular expression pattern.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$Exclude = \"microsoft.powershell|microsoft.powershell.workflow|microsoft.powershell32|microsoft.windows.servermanagerworkflows|PowerShell.$($PSVersionTable.PSVersion)\"<\/code><\/pre>\n\n\n\n<p>The last entry is calculated and should correspond to a PowerShell 7 session configuration. When I run this in Windows PowerShell this will create an entry that will likely never exist, but that won't affect the filtering. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\"> (Get-PSSessionConfiguration -verbose:$False).where({$_.name -notmatch $exclude})<\/code><\/pre>\n\n\n\n<p>I'm using the Where() method to gain a slight performance advantage. By the way, I am intentionally turning off Verbose output for Get-PSSessionConfiguration. The output for this command shows functions that are going to be run and very little in the way of useful information. I suspect the verbose output was used during development, which is a good technique, but then the verbose output was never revised.<\/p>\n\n\n\n<p>Each session configuration is then piped to Unregister-PSSessionConfiguration.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\"> Unregister-PSSessionConfiguration -Verbose:$false -Confirm<\/code><\/pre>\n\n\n\n<p>Again, I'm turning off Verbose output for the same reason. I am also explicitly using the -Confirm parameter. I want to <strong>always <\/strong>be prompted to remove the session configuration. <\/p>\n\n\n\n<p>My function includes support for -Whatif.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config-whatif.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"212\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config-whatif-1024x212.png\" alt=\"\" class=\"wp-image-8652\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config-whatif-1024x212.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config-whatif-300x62.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config-whatif-768x159.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config-whatif-850x176.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config-whatif.png 1087w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Of course, when I run the function without -Whatif, the confirm process takes over.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config.png\"><img loading=\"lazy\" decoding=\"async\" width=\"815\" height=\"303\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config.png\" alt=\"\" class=\"wp-image-8653\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config.png 815w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config-300x112.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/remove-obsolete-config-768x286.png 768w\" sizes=\"auto, (max-width: 815px) 100vw, 815px\" \/><\/a><\/figure>\n\n\n\n<p>I can select the configurations to remove and those, like the PowerShell preview, that I want to keep.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/saved-config.png\"><img loading=\"lazy\" decoding=\"async\" width=\"528\" height=\"282\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/saved-config.png\" alt=\"\" class=\"wp-image-8654\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/saved-config.png 528w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/saved-config-300x160.png 300w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Try It<\/h2>\n\n\n\n<p>Here is the code I am using. I also encourage you to read the about_Functions_CmdletBindingAttribute help topic.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">#requires -version 5.1\n#requires -RunAsAdministrator\n\nFunction Remove-ObsoleteSessionConfiguration {\n    [cmdletbinding(SupportsShouldProcess,ConfirmImpact=\"High\")]\n    Param()\n    Begin {\n        Write-Verbose \"[$((Get-Date).TimeofDay) BEGIN  ] Starting $($myinvocation.mycommand)\"\n        #exclude these default configurations as a regex pattern\n        $Exclude = \"microsoft.powershell|microsoft.powershell.workflow|microsoft.powershell32|microsoft.windows.servermanagerworkflows|PowerShell.$($PSVersionTable.PSVersion)\"\n        Write-Verbose \"[$((Get-Date).TimeofDay) BEGIN  ] Excluding $Exclude\"\n    } #begin\n\n    Process {\n        Write-Verbose \"[$((Get-Date).TimeofDay) PROCESS] Getting non-default PowerShell Remoting configurations\"\n        &lt;#\n         turn off Verbose output for Get-PSSessionConfiguration and Unregister-PSSessionConfiguration.\n         These command displays PowerShell code which adds no value for my purpose.\n        #>\n        (Get-PSSessionConfiguration -verbose:$False).where({$_.name -notmatch $exclude}) |\n        Unregister-PSSessionConfiguration -Verbose:$false -Confirm\n    } #process\n\n    End {\n        Write-Verbose \"[$((Get-Date).TimeofDay) END    ] Ending $($myinvocation.mycommand)\"\n    } #end\n\n} #close Remove-PSRemotingConfiguration<\/code><\/pre>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">Use with <strong><em>great caution<\/em><\/strong> and test it thoroughly in a non-production environment, especially if you have created your own custom session configurations. <\/p>\n\n\n\n<p class=\"has-black-color has-text-color\">If you have custom configurations, make sure you have all the required files to re-create them if necessary. After running this function,  you should restart with WinRM service.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m pretty sure I&#8217;ve discussed this before, but Microsoft is scheduled to release PowerShell 7.2 soon, I thought it might be good to revisit this topic. Here&#8217;s the potential issue. If you&#8217;ve been installing PowerShell 7 releases for a while, and have been enabling PowerShell remoting, you most likely have a list of remoting session&#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":"New on the blog: Removing Obsolete #PowerShell Remoting Configurations #PS7Now","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,610,8],"tags":[534,658,624,657],"class_list":["post-8650","post","type-post","status-publish","format-standard","hentry","category-powershell","category-powershell-7","category-scripting","tag-powershell","tag-powershell-remoting","tag-ps7now","tag-sessionconfiguration"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Removing Obsolete PowerShell Remoting Configurations &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"Here&#039;s a PowerShell function you can use to remove obsolete remoting session configurations. Runs in Windows PowerShell and PowerShell 7.\" \/>\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\/8650\/removing-obsolete-powershell-remoting-configurations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Removing Obsolete PowerShell Remoting Configurations &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Here&#039;s a PowerShell function you can use to remove obsolete remoting session configurations. Runs in Windows PowerShell and PowerShell 7.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-20T13:43:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-20T13:43:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Removing Obsolete PowerShell Remoting Configurations\",\"datePublished\":\"2021-10-20T13:43:04+00:00\",\"dateModified\":\"2021-10-20T13:43:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/\"},\"wordCount\":529,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/sessionconfigs.png\",\"keywords\":[\"PowerShell\",\"PowerShell Remoting\",\"PS7Now\",\"SessionConfiguration\"],\"articleSection\":[\"PowerShell\",\"PowerShell 7\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/\",\"name\":\"Removing Obsolete PowerShell Remoting Configurations &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/sessionconfigs.png\",\"datePublished\":\"2021-10-20T13:43:04+00:00\",\"dateModified\":\"2021-10-20T13:43:09+00:00\",\"description\":\"Here's a PowerShell function you can use to remove obsolete remoting session configurations. Runs in Windows PowerShell and PowerShell 7.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/sessionconfigs.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/10\\\/sessionconfigs.png\",\"width\":619,\"height\":617},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8650\\\/removing-obsolete-powershell-remoting-configurations\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Removing Obsolete PowerShell Remoting Configurations\"}]},{\"@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":"Removing Obsolete PowerShell Remoting Configurations &#8226; The Lonely Administrator","description":"Here's a PowerShell function you can use to remove obsolete remoting session configurations. Runs in Windows PowerShell and PowerShell 7.","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\/8650\/removing-obsolete-powershell-remoting-configurations\/","og_locale":"en_US","og_type":"article","og_title":"Removing Obsolete PowerShell Remoting Configurations &#8226; The Lonely Administrator","og_description":"Here's a PowerShell function you can use to remove obsolete remoting session configurations. Runs in Windows PowerShell and PowerShell 7.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/","og_site_name":"The Lonely Administrator","article_published_time":"2021-10-20T13:43:04+00:00","article_modified_time":"2021-10-20T13:43:09+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Removing Obsolete PowerShell Remoting Configurations","datePublished":"2021-10-20T13:43:04+00:00","dateModified":"2021-10-20T13:43:09+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/"},"wordCount":529,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs.png","keywords":["PowerShell","PowerShell Remoting","PS7Now","SessionConfiguration"],"articleSection":["PowerShell","PowerShell 7","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/","name":"Removing Obsolete PowerShell Remoting Configurations &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs.png","datePublished":"2021-10-20T13:43:04+00:00","dateModified":"2021-10-20T13:43:09+00:00","description":"Here's a PowerShell function you can use to remove obsolete remoting session configurations. Runs in Windows PowerShell and PowerShell 7.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/10\/sessionconfigs.png","width":619,"height":617},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8650\/removing-obsolete-powershell-remoting-configurations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Removing Obsolete PowerShell Remoting Configurations"}]},{"@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":5895,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5895\/another-look-at-powershell-core-version-information\/","url_meta":{"origin":8650,"position":0},"title":"Another Look at PowerShell Core Version Information","author":"Jeffery Hicks","date":"February 8, 2018","format":false,"excerpt":"As PowerShell Core begins to spread into our world, and as we start thinking about working and scripting cross-platform, it will be useful to know what type of platform you are running on. The built in $PSVersionTable is an obvious place to start. On PowerShell Core there are also some\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\/2018\/02\/image_thumb-5.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-5.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/02\/image_thumb-5.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":7347,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-7\/7347\/powershell-7-remoting-cleanup\/","url_meta":{"origin":8650,"position":1},"title":"PowerShell 7 Remoting Cleanup","author":"Jeffery Hicks","date":"March 10, 2020","format":false,"excerpt":"Now that PowerShell 7 is here and hopefully installed on your Windows 10 desktop, you're good to go, right? I'd say you probably all set. However, if like me, you were running PowerShell 7 betas or had PowerShell Core also installed, a little housekeeping might be in order. I don't\u2026","rel":"","context":"In &quot;PowerShell 7&quot;","block_context":{"text":"PowerShell 7","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-7\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/03\/image_thumb-7.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/03\/image_thumb-7.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/03\/image_thumb-7.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/03\/image_thumb-7.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7969,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-7\/7969\/deploy-openssh-server-to-windows-10\/","url_meta":{"origin":8650,"position":2},"title":"Deploy OpenSSH Server to Windows 10","author":"Jeffery Hicks","date":"December 16, 2020","format":false,"excerpt":"PowerShell 7 offers a number of compelling reasons to adopt it. One of the best is support for SSH as a PowerShell remoting protocol. Unfortunately, this is not a topic that typically comes up for Windows-centric IT Pros. I know this is definitely true in my case, and a deficiency\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\/12\/sshserver-installed.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/sshserver-installed.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":8499,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8499\/using-the-powershell-ise-as-a-remote-management-console\/","url_meta":{"origin":8650,"position":3},"title":"Using the PowerShell ISE as a Remote Management Console","author":"Jeffery Hicks","date":"July 20, 2021","format":false,"excerpt":"Way back before the days of PowerShell Core, or even VS Code for that matter, the PowerShell ISE was the center of my PowerShell world. I spent a lot of time finding ways to make it easier for me to use and to push it to its limits. Naturally, 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\/2021\/07\/ise-remotetab-form2.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":5425,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5425\/nic-2017-slides-and-demos\/","url_meta":{"origin":8650,"position":4},"title":"NIC 2017 Slides and Demos","author":"Jeffery Hicks","date":"February 10, 2017","format":false,"excerpt":"Earlier this month I had the pleasure of presenting at the Nordic Infrastructure Conference (NIC). This is still a relatively young conference as these things go, but you couldn't tell based on my experiences.\u00a0 Given the demise of TechEd Europe, conferences like this are filling the void, and doing a\u2026","rel":"","context":"In &quot;Conferences&quot;","block_context":{"text":"Conferences","link":"https:\/\/jdhitsolutions.com\/blog\/category\/conferences\/"},"img":{"alt_text":"Nic2017-logo","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/02\/Nic2017-logo_thumb-1.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":347,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/347\/winrm-domain-or-workgroup\/","url_meta":{"origin":8650,"position":5},"title":"WinRM: Domain or Workgroup?","author":"Jeffery Hicks","date":"September 11, 2009","format":false,"excerpt":"I'm curious about something and would like to hear from you. PowerShell v2 remoting uses WinRM which in a domain environment is very secure and easy to use. You can even use a GPO to configure your domain members. However you can also use WinRM in a workgroup environment but\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":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8650","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=8650"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8650\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8650"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8650"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8650"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}