{"id":8027,"date":"2021-01-14T17:25:46","date_gmt":"2021-01-14T22:25:46","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=8027"},"modified":"2021-01-14T19:27:17","modified_gmt":"2021-01-15T00:27:17","slug":"powershell-modules-in-a-cross-version-world","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/","title":{"rendered":"PowerShell Modules in a Cross-Version World"},"content":{"rendered":"\n<p>The other day I was helping a friend sort out some module-related questions. While helping him, I realized his questions and problems were not unique. Now that many of us are running Windows PowerShell 7 side-by-side, what are the implications when it comes to using PowerShell modules? What are the potential \"gotchas\"? And what can you do to reduce the likelihood of problems?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PowerShellGet<\/h2>\n\n\n\n<p>Both Windows PowerShell and PowerShell rely on module commands like Find-Module and Install-Module. However, if you need to support modules cross-version, you might need to satisfy a critical requirement. By the way, use Windows PowerShell to run all of these commands unless otherwise directed.<\/p>\n\n\n\n<p>Open Windows PowerShell and run<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Get-Module powershellget -ListAvailable<\/code><\/pre>\n\n\n\n<p>If the only version you see is 1.0.0.1, you need to update the module. The PowerShellGet module is where you get the module commands and in a cross-version world, you need a later version of the module.<\/p>\n\n\n\n<p>However, you can't simply run<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Update-Module PowerShellGet<\/code><\/pre>\n\n\n\n<p>If you do, you'll get an error. The 1.0.0.1 version is a <em>system <\/em>module that came with your version of Windows 10. It was not installed in the traditional sense. But no problem. You can still install it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Install-Module PowerShellGet -Force -Repository PSGallery<\/code><\/pre>\n\n\n\n<p>I'm  being very concise in the command to install the Microsoft version. Let's verify.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Remove-Module PowerShellGet -ErrorAction Ignore\nImport-Module PowerShellGet\nGet-Module PowerShellGet<\/code><\/pre>\n\n\n\n<p>You should see at least version 2.2.5. If so you are ready to continue. By the way, now that you've used Install-Module, if there is a later version update, you can use Update-Module to install it. Don't worry about the original system version. PowerShell will automatically use the latest version of the module by default.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PSModulePath<\/h2>\n\n\n\n<p>The next part of the puzzle is an environmental variable called %PSModulePath%. This variable contains all of the locations that PowerShell and Windows PowerShell looks for modules. This is what makes module autoloading possible. This is where it gets interesting.<\/p>\n\n\n\n<p>Here's my variable on a clean Windows 10 installation.<\/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\/01\/module-locations.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"260\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations-1024x260.png\" alt=\"Windows PowerShell module locations\" class=\"wp-image-8028\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations-1024x260.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations-300x76.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations-768x195.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations-850x216.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations.png 1078w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>I split the path on the \";\" delimiter to make it easier to read. There are 3 default locations. Once for the current user, one for all users and one for system modules. For the most part, we'll ignore anything in the system path. When you install a new module it will go in either the user and all users path. More on that in a bit.<\/p>\n\n\n\n<p>Here is the same thing in PowerShell 7.1.<\/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\/01\/ps7modulepaths.png\"><img loading=\"lazy\" decoding=\"async\" width=\"983\" height=\"334\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/ps7modulepaths.png\" alt=\"\" class=\"wp-image-8029\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/ps7modulepaths.png 983w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/ps7modulepaths-300x102.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/ps7modulepaths-768x261.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/ps7modulepaths-850x289.png 850w\" sizes=\"auto, (max-width: 983px) 100vw, 983px\" \/><\/a><\/figure>\n\n\n\n<p>Another way to think of the system path is that is under $PSHome. Look closely. PowerShell 7 also knows about the Windows PowerShell system and all users locations! This means that PowerShell can \"see\" modules installed by Windows PowerShell. However, Windows PowerShell cannot \"see\" anything installed by PowerShell.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install-Module<\/h2>\n\n\n\n<p>Now that this hopefully clear, let's install some modules. In PowerShell, I'll install a module that I know only works in PowerShell 7.x.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">install-module Bluebirdps -Scope AllUsers -force<\/code><\/pre>\n\n\n\n<p>Notice the -Scope parameter. By default, installed modules are per user. But in this case I wanted to install the module for All Users. This means the account used to install the module needs admin rights to C:\\Program Files. This is why the default is to the user's location -- to avoid the need of admin credentials. While I'm at it, I'll install another module in PowerShell 7.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Install-Module PSReleaseTools -force<\/code><\/pre>\n\n\n\n<p>In Windows PowerShell, I'll install a module for all users and one using the default scope.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Install-Module PSScriptTools -Scope AllUsers -force\nInstall-Module WTToolbox -force<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Get-InstalledModule<\/h2>\n\n\n\n<p>The next question should be, \"How can I see what modules are available?\". One command you can use, and one that I had not been aware of, is Get-InstalledModule. Here's what I get in PowerShell.<\/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\/01\/get-installed-ps7.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"284\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-ps7-1024x284.png\" alt=\"Installed PowerShell modules\" class=\"wp-image-8030\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-ps7-1024x284.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-ps7-300x83.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-ps7-768x213.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-ps7-850x235.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-ps7.png 1531w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>You can see by the location that one module is for the user and one is for all users. Notice there are no modules from Windows PowerShell.<\/p>\n\n\n\n<p>Here's the same thing from the Windows PowerShell side.<\/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\/01\/get-installed-51.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"471\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-51-1024x471.png\" alt=\"\" class=\"wp-image-8031\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-51-1024x471.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-51-300x138.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-51-768x353.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-51-850x391.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/get-installed-51.png 1517w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Nothing from PowerShell 7 shows up. But there is one important item I want to point out. Earlier I installed the WTToolBox module without specifying a scope. The default is the user scope yet look at the location. Here's what happened. I was running Windows PowerShell as Administrator, i.e. in an elevated session. In this context, the \"user\" is the same as \"all users\". In some ways that is a good thing because any Windows PowerShell modules installed for all users can be used in PowerShell 7.x, assuming compatibility.<\/p>\n\n\n\n<p><strong>Key TakeAway #1: Get-InstalledModule only shows modules installed per PowerShell version.<\/strong><\/p>\n\n\n\n<p><strong>Key TakeAway #2: Installing a module as an elevated user always installs the module for all users.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Get-Module<\/h2>\n\n\n\n<p>So how can you \"see\" what modules are available? Use Get-Module. By default, the module only shows the currently loaded modules. The key parameter you need to remember is -ListAvailable.<\/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\/01\/list-module.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"194\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/list-module-1024x194.png\" alt=\"listing an available module\" class=\"wp-image-8033\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/list-module-1024x194.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/list-module-300x57.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/list-module-768x146.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/list-module-850x161.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/list-module.png 1359w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Get-Module searches the PSModulePath locations which is why this works in PowerShell 7. To \"see\" everything run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Get-Module -listavailable<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/allmodules.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"551\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/allmodules-1024x551.png\" alt=\"\" class=\"wp-image-8034\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/allmodules-1024x551.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/allmodules-300x161.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/allmodules-768x413.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/allmodules-1536x826.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/allmodules-850x457.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/allmodules.png 1569w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Here's a little code snippet to inventory available modules.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$p = $env:PSModulePath -split \";\"\n $m = Get-Module -ListAvailable\n foreach ($loc in $p) {\n     [pscustomobject]@{\n         Location = $loc\n         Modules = ($m | where {$_.path -match $loc.replace(\"\\\",\"\\\\\") } ).count\n     }   \n }<\/code><\/pre>\n\n\n\n<p>This is a composite of results from both versions of PowerShell.<\/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\/01\/module-inventory.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"396\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-inventory-1024x396.png\" alt=\"module inventory\" class=\"wp-image-8035\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-inventory-1024x396.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-inventory-300x116.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-inventory-768x297.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-inventory-850x329.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-inventory.png 1164w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p><strong>Key TakeAway #3: If you need to use a module in both Windows PowerShell and PowerShell 7.x, install it for all users in Windows PowerShell.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>I hope this walk-through cleared up any mystery or confusion.  Before you go let me mention a few things. First, just because PowerShell can \"see\" a Windows PowerShell module, there is no guarantee it will work. Don't let this deter you. The vast majority of Windows PowerShell modules work just fine in PowerShell. Those that don't most likely fail due to a .NET dependency that isn't supported in .NET Core, which is what PowerShell is running under.<\/p>\n\n\n\n<p>Second, your PSModulePath variable might be different. Depending on the applications or programs you install, you might have additional locations. On my primary desktop, I have SQL Server Express installed so my variable includes C:\\Program Files (x86)\\Microsoft SQL Server\\150\\Tools\\PowerShell\\Modules\\.<\/p>\n\n\n\n<p>Technically, you could modify the environmental variable or adjust locations with a profile script. You might do this if you want to include a custom location. But I would advise against updating the variable so that Windows PowerShell can \"see\" PowerShell module locations. I'm working under the assumption that if a module is installed in PowerShell it requires PowerShell. For example, I installed the BluebirdPS module in PowerShell. If I modified things so that I could import it into Windows PowerShell, it will most likely fail. If you need modules to work cross-version, install them in Windows PowerShell for all users.<\/p>\n\n\n\n<p> I encourage you to update PowerShellGet and then take a few minutes reading help and examples for the module commands.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The other day I was helping a friend sort out some module-related questions. While helping him, I realized his questions and problems were not unique. Now that many of us are running Windows PowerShell 7 side-by-side, what are the implications when it comes to using PowerShell modules? What are the potential &#8220;gotchas&#8221;? And what can&#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: #PowerShell Modules in a Cross-Version World","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],"tags":[205,534,624],"class_list":["post-8027","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-modules","tag-powershell","tag-ps7now"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PowerShell Modules in a Cross-Version World &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"An explanation and guide on the best way to install and manage modules cross-version with Window PowerShell and PowerShell 7.x.\" \/>\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\/8027\/powershell-modules-in-a-cross-version-world\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PowerShell Modules in a Cross-Version World &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"An explanation and guide on the best way to install and manage modules cross-version with Window PowerShell and PowerShell 7.x.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-14T22:25:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-15T00:27:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations-1024x260.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=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"PowerShell Modules in a Cross-Version World\",\"datePublished\":\"2021-01-14T22:25:46+00:00\",\"dateModified\":\"2021-01-15T00:27:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/\"},\"wordCount\":1082,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/module-locations-1024x260.png\",\"keywords\":[\"modules\",\"PowerShell\",\"PS7Now\"],\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/\",\"name\":\"PowerShell Modules in a Cross-Version World &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/module-locations-1024x260.png\",\"datePublished\":\"2021-01-14T22:25:46+00:00\",\"dateModified\":\"2021-01-15T00:27:17+00:00\",\"description\":\"An explanation and guide on the best way to install and manage modules cross-version with Window PowerShell and PowerShell 7.x.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/module-locations.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/module-locations.png\",\"width\":1078,\"height\":274},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8027\\\/powershell-modules-in-a-cross-version-world\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PowerShell Modules in a Cross-Version World\"}]},{\"@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 Modules in a Cross-Version World &#8226; The Lonely Administrator","description":"An explanation and guide on the best way to install and manage modules cross-version with Window PowerShell and PowerShell 7.x.","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\/8027\/powershell-modules-in-a-cross-version-world\/","og_locale":"en_US","og_type":"article","og_title":"PowerShell Modules in a Cross-Version World &#8226; The Lonely Administrator","og_description":"An explanation and guide on the best way to install and manage modules cross-version with Window PowerShell and PowerShell 7.x.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/","og_site_name":"The Lonely Administrator","article_published_time":"2021-01-14T22:25:46+00:00","article_modified_time":"2021-01-15T00:27:17+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations-1024x260.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":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"PowerShell Modules in a Cross-Version World","datePublished":"2021-01-14T22:25:46+00:00","dateModified":"2021-01-15T00:27:17+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/"},"wordCount":1082,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations-1024x260.png","keywords":["modules","PowerShell","PS7Now"],"articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/","name":"PowerShell Modules in a Cross-Version World &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations-1024x260.png","datePublished":"2021-01-14T22:25:46+00:00","dateModified":"2021-01-15T00:27:17+00:00","description":"An explanation and guide on the best way to install and manage modules cross-version with Window PowerShell and PowerShell 7.x.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/01\/module-locations.png","width":1078,"height":274},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8027\/powershell-modules-in-a-cross-version-world\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"PowerShell Modules in a Cross-Version World"}]},{"@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":9023,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9023\/powershell-first-timers\/","url_meta":{"origin":8027,"position":0},"title":"PowerShell First-Timers","author":"Jeffery Hicks","date":"May 11, 2022","format":false,"excerpt":"Are you a PowerShell first-timer? Someone who is finally dipping their toes into the PowerShell pool. Or maybe you want to poke around and see what all the fuss is about. If so, here are some steps you might want to take. Even if you've been using PowerShell for a\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\/2022\/05\/pester-install-fail.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/05\/pester-install-fail.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/05\/pester-install-fail.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/05\/pester-install-fail.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":5143,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5143\/compare-powershell-modules\/","url_meta":{"origin":8027,"position":1},"title":"Compare PowerShell Modules","author":"Jeffery Hicks","date":"June 29, 2016","format":false,"excerpt":"One of the attractive features in PowerShell v5 is PowerShellGet. This module includes commands which makes it easy to discover and install PowerShell modules from the Internet, or even your network. The modules are stored in online repositories. Microsoft maintains one called PSGallery. Typically you will use PowerShell commands to\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"Comparing module versions","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-26.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-26.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-26.png?resize=525%2C300 1.5x"},"classes":[]},{"id":9325,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9325\/powershell-refresh\/","url_meta":{"origin":8027,"position":2},"title":"PowerShell Refresh","author":"Jeffery Hicks","date":"March 1, 2024","format":false,"excerpt":"The other day on X, I was asked about what things I would setup or configure on a new PowerShell installation. This is something I actually have thought about and face all the time when I setup a new demo virtual machine. I had been meaning to build new tooling\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":9003,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/9003\/tips-for-powershell-gallery-success\/","url_meta":{"origin":8027,"position":3},"title":"Tips for PowerShell Gallery Success","author":"Jeffery Hicks","date":"April 13, 2022","format":false,"excerpt":"New on the blog: Tips for #PowerShell Gallery Success","rel":"","context":"In &quot;Best Practices&quot;","block_context":{"text":"Best Practices","link":"https:\/\/jdhitsolutions.com\/blog\/category\/best-practices\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/04\/PowerShell_Hero_small.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/04\/PowerShell_Hero_small.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2022\/04\/PowerShell_Hero_small.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":6371,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6371\/making-the-leap-to-powershell-core\/","url_meta":{"origin":8027,"position":4},"title":"Making the Leap to PowerShell Core","author":"Jeffery Hicks","date":"January 9, 2019","format":false,"excerpt":"For years I have spent most of my time in a Windows PowerShell prompt. I have actually taken it as a badge of honor that I've been able to manage my day and all of my work from a PowerShell prompt. I also have created practically all of my content\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\/2019\/01\/image_thumb-11.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-11.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-11.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-11.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":817,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-v2-0\/817\/module-mania\/","url_meta":{"origin":8027,"position":5},"title":"Module Mania","author":"Jeffery Hicks","date":"August 12, 2010","format":false,"excerpt":"More and more, you're seeing members of the Windows PowerShell community package their contributions into modules, myself included. Although you'll probably still see a lot of individual functions because it is often easier to demonstrate or educate. I received a comment on my Weather module that I thought merited a\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2010\/08\/get-command-module-300x224.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8027","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=8027"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8027\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}