Tag: PackageManagement

Updated PowerShellGet and PackageManagment

Update PowerShellGet and PackageManagement

Since I am just setting up a new work machine, I wanted to share some information how you can update PowerShellGet and PackageManagement to the latest version. This will give you the usual bug fixes and performance enhancements. Since you don’t get the latest version in Windows PowerShell nor PowerShell Core, you will need to update it manually.

PowerShellGet is a PowerShell module with commands for discovering, installing, updating and publishing the PowerShell artifacts like Modules, DSC Resources, Role Capabilities and Scripts. For example you use PowerShellGet to install the Azure PowerShell module, or other modules.

PowerShellGet module is also integrated with the PackageManagement module as a provider, users can also use the PowerShell PackageManagement cmdlets for discovering, installing and updating the PowerShell artifacts like Modules and Scripts.

(source: GitHub)

How to update PowerShellGet and PackageManagement

Updating to the latest version of PowerShellGet and the PackageManagement module is simple. Since both modules are part of the PowerShell Gallery, you can update them using a couple of simple commands.

You can find both modules in the PowerShell Gallery:

First lets check which versions of the modules you have available. If you use Update-Module, it will automatically load PowerShellGet and PackageManagement and list them as loaded PowerShell modules. Of course you can also use Get-Module -ListAvailable.

PowerShell Modules PowerShellGet and PackageManagement

As you can see, In my default installation, I got PowerShellGet version 1.6.7 and PackageManagement 1.1.7.2. If you have a look at PSGallery, you will see that these are pretty old versions and that there are newer available.

To get the latest version from PowerShell Gallery, you should first install the latest Nuget provider. You will need to run PowerShell as an Administrator for all  the following commands.

If you run PowerShell 5.0 or newer, you can install the latest PowerShellGet using the following command. PowerShell 5.0 is included in Windows 10, Windows Server 2016, Windows Server 2019, any system with WMF 5.0 and 5.1 or a system running PowerShell 6.

Two quick tips, first of, you will need to set the execution policy to RemoteSigned to allow the new module to run. Secondly in some cases you will need to use the -AllowClobber parameter to install the updated version of the module.

You can then use Update-Module to get newer versions:

Updated PowerShellGet and PackageManagment

After that you will see the latest versions of PowerShellGet and PackageMangement available

If you run older versions of PowerShell you can check out the full documention on the PowerShell Docs. I hope this blog post helps you to update PowerShellGet and benefit from the latest versions. If you have any questions, please let me know in the comments.



PowerShell PackageManagement Add PackageSource

How to install SysInternals using PowerShell Package Management

I already made a post in April 2014 where Microsoft announced the first preview of the Windows Management Framework 5.0. At this time the Windows Management Framework V5 Preview came with a module called OneGet, which allowed you to install and manage packages. In the latest versions the name from OneGet changed to PackageManagement. With Windows 10 you can now make use of this module. This helps you to install software and features really easy. This can also be used to install Sysinternals using PowerShell.

The Sysinternals web site was created in 1996 by Mark Russinovich to host his advanced system utilities and technical information. Whether you’re an IT Pro or a developer, you’ll find the utilities to help you manage, troubleshoot and diagnose your Windows systems and applications.

Packagemanagement PowerShell Commands

By default you get the PowerShell Gallery as source for Packages, first thing you can do is add the chocolatey Repository to your Package Sources:

After you have added Chocolatey you can search for the Packages you want to use. In my case I want to install SysInternals using the following command:

After you found your Package you can also install this Package using the following command:

PowerShell PackageManagement Add PackageSource

After Package Manager is finished downloading and unpacking the zip file you can find it here:

SysInternals

So if you like Sysinternals and PowerShell as much as I do, this is the way to go and helps you to get started very quickly.