{"id":30667,"date":"2022-07-22T20:18:40","date_gmt":"2022-07-22T20:18:40","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=30667"},"modified":"2022-12-23T05:52:18","modified_gmt":"2022-12-23T05:52:18","slug":"what-is-powershellget-and-how-to-install-powershellget-3-0","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/what-is-powershellget-and-how-to-install-powershellget-3-0\/","title":{"rendered":"What is PowerShellGet and How to Install PowerShellGet 3.0"},"content":{"rendered":"\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>PowerShellGet is a PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like Modules, Scripts, and DSC Resources. PowerShellGet require PowerShell 5.0 or higher.<\/p>\n\n\n\n<p>PowerShellGet is the module that provides the ability to install, update, and locate modules and scripts in repositories like the PowerShell Gallery. The previous version of this module includes cmdlets like Install-Module, Find-Module and Save-Module.<\/p>\n\n\n\n<p>PowerShell 6.0 shipped with version 1.6.0 of&nbsp;<strong>PowerShellGet<\/strong>. PowerShell 7.0 shipped with version 2.2.3 of&nbsp;<strong>PowerShellGet<\/strong>. The current supported version of&nbsp;<strong>PowerShellGet<\/strong>&nbsp;is 2.2.5.<\/p>\n\n\n\n<p>If you are running PowerShell 6 or higher, you have a usable version of&nbsp;<strong>PowerShellGet<\/strong>. If you are running Windows PowerShell 5.1, you must install a newer version.<\/p>\n\n\n\n<p>Official Documents &#8211; <a href=\"https:\/\/github.com\/PowerShell\/PowerShellGet\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/github.com\/PowerShell\/PowerShellGet<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What\u2019s new in PowerShellGet v3?<\/h2>\n\n\n\n<p>PowerShellGet v3 is a completely rewritten implementation of the module. It provides more generic PSResource cmdlets rather than Install-Module or Save-Script. The new version is intended to improve the maintainability of the codebase which in turn should help address issues with the previous version of the module.<\/p>\n\n\n\n<p><strong>Managing Resources with PowerShellGet v3<\/strong><\/p>\n\n\n\n<p>The cmdlet names have changed in PowerShellGet v3. Instead of Install-Module, you will use Install-PSResource. It\u2019s actually the same cmdlet for all resources such as scripts and DSC resources.<\/p>\n\n\n\n<p>$ Install-PSResource -Name Universal<br>The Install-PSResource cmdlet supports similar parameters to Install-Module but have slightly different names and meanings.<\/p>\n\n\n\n<p>For example, -AllowClobber was optional in Install-Module but is now the default for Install-PSResource. You can use -NoClobber to change this behavior.<\/p>\n\n\n\n<p>$ Install-PSResource -Name dbatools -Version &#8216;1.1.41&#8217; -NoClobber<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to install PowerShellGet?<\/h2>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Copy and Paste the following command to install PowerShellGet using Powershell <span class=\"hljs-keyword\">with<\/span> admin mode.\n\n$ Install-Module -Name PowerShellGet -Force\n$ Get-Command Install-Module\n\nUpdate the PowerShellGet <span class=\"hljs-built_in\">module<\/span> to the latest version by running the following command:\n$ Update-Module PowerShellGet -Force\n$ Get-Command Install-Module\n\nClose Powershell command line and open again <span class=\"hljs-keyword\">with<\/span> following commands...\n$ Get-Command Install-Module\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"222\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/07\/image-8-1024x222.png\" alt=\"\" class=\"wp-image-30668\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/07\/image-8-1024x222.png 1024w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/07\/image-8-300x65.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/07\/image-8-768x167.png 768w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/07\/image-8.png 1153w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>To install this preview release side-by-side with your existing PowerShellGet version, open any PowerShell console and run:<\/p>\n\n\n\n<p><strong>$ Install-Module PowerShellGet -Force -AllowPrerelease<\/strong><\/p>\n\n\n\n<p>To register the PSGallery run the command:<\/p>\n\n\n\n<p><strong>$ Register-PSResourceRepository -PSGallery<\/strong><\/p>\n\n\n\n<p><br>If you run the command Get-Command -Module PowerShellGet you will get a good picture of the side-by-side cmdlet interfaces.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1023\" height=\"973\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/07\/image-9.png\" alt=\"\" class=\"wp-image-30677\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/07\/image-9.png 1023w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/07\/image-9-300x285.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/07\/image-9-768x730.png 768w\" sizes=\"auto, (max-width: 1023px) 100vw, 1023px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">After installing PowerShellGet<\/h2>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">After you have installed the <span class=\"hljs-keyword\">new<\/span> version <span class=\"hljs-keyword\">of<\/span> PowerShellGet, you should open a <span class=\"hljs-keyword\">new<\/span> PowerShell session. PowerShell automatically loads the newest version <span class=\"hljs-keyword\">of<\/span> the <span class=\"hljs-built_in\">module<\/span> when you use a PowerShellGet cmdlet.\n\nWe also recommend that you register the PowerShell Gallery <span class=\"hljs-keyword\">as<\/span> a trusted repository. Use the following command:\n\n$ <span class=\"hljs-built_in\">Set<\/span>-PSRepository -Name PSGallery -InstallationPolicy Trusted\n\n\nPowerShellGet is the <span class=\"hljs-built_in\">module<\/span> that provides the ability to install, update, and locate modules and scripts <span class=\"hljs-keyword\">in<\/span> repositories like the PowerShell Gallery. The previous version <span class=\"hljs-keyword\">of<\/span> <span class=\"hljs-keyword\">this<\/span> <span class=\"hljs-built_in\">module<\/span> includes cmdlets like Install-Module, Find-Module and Save-Module.\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id=\"table-of-implemented-parameters-in-this-release\">Table of Implemented Parameters in this Release<a href=\"https:\/\/devblogs.microsoft.com\/powershell\/powershellget-3-0-preview-1\/#table-of-implemented-parameters-in-this-release\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Cmdlet<\/td><td>Implemented parameters<\/td><td>Not implemented<\/td><\/tr><tr><td>Install-PSResource<\/td><td>-Name-Version-Prerelease-Repository-Credential-Scope-Reinstall<\/td><td>-InputObject-DestinationPath [partially implemented]-NoClobber-IgnoreDifferentPublisher-TrustRepository-Force [there hasn\u2019t been a need for force yet since the things you would force aren\u2019t implemented]-Quiet-AcceptLicense-PassThru<\/td><\/tr><tr><td>Update-PSResource<\/td><td>-Name-Version-Prerelease-Credential-Repository [Update should be discovering the repository from the xml metadata instead of from user input, this will be fixed in future releases]<\/td><td>-InputObject-UpdateTo-Force-Quiet-AcceptLicense-PassThru&nbsp;<\/td><\/tr><tr><td>Find-PSResource<\/td><td>-Name-Type-Version\u2013 Prerelease-ModuleName-Tags-Repository-Credential-IncludeDependencies<\/td><td>[Nothing]<\/td><\/tr><tr><td>Uninstall-PSResource<\/td><td>-Name-Version-PrereleaseOnly<\/td><td>[Nothing]<\/td><\/tr><tr><td>Save-PSResource<\/td><td>-Name-Version-Prerelease-Repository-Credential-AsNupkg-Path<\/td><td>-AcceptLicense<\/td><\/tr><tr><td>Get-PSResource<\/td><td>-Name-Version<\/td><td>-Prerelease<\/td><\/tr><tr><td>Register-PSResourceRepository<\/td><td>-Name-URL-PSGallery-Credential [credential persistence has not been implemented yet so this parameter is not currently being passed to anything]-Trusted-Priority<\/td><td>-Repositories-Proxy[for any proxies other than the default proxy]-ProxyCredential[see above regarding -Proxy]&nbsp;<\/td><\/tr><tr><td>Unregister-PSResourceRepository<\/td><td>-Name<\/td><td>[Nothing]<\/td><\/tr><tr><td>Get-PSResourceRepository<\/td><td>-Name-URL-Credential-Trusted-Priority<\/td><td>-Repositories-Proxy [for any proxies other than the default proxy]-ProxyCredential [see above regarding -Proxy]&nbsp;<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>PowerShellGet is a PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like Modules, Scripts, and DSC Resources. PowerShellGet require PowerShell 5.0 or higher. PowerShellGet is&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-30667","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/30667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=30667"}],"version-history":[{"count":6,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/30667\/revisions"}],"predecessor-version":[{"id":30679,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/30667\/revisions\/30679"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=30667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=30667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=30667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}