• Skip to primary navigation
  • Skip to main content
  • Skip to footer

Stephanos Constantinou Blog

PowerShell Scripting

  • Home
  • Blogs
    • PowerShell Tutorials
    • PowerShell Scripts
    • PowerShell Modules
      • Modules Cmdlets
    • Software Reviews
  • About
  • Contact
You are here: Home / PowerShell Tutorials / PowerShell PackageManagement

PowerShell PackageManagement

18/09/2018 by Stephanos 2 Comments

PowerShell PackageManagement

In this tutorial we will see about PowerShell PackageManagement and how we are able to use it.

What is PackageManagement

PackageManagement is also known as OneGet. PackageManagement has been introduced in Windows PowerShell 5.0. PackageManagement comes with Windows 10 and Windows Server 2016. It is a unified interface to package management systems and aims to make Software Discovery, Installation and Inventory (SDII) work via a common set of cmdlets (and eventually a set of APIs). Regardless of the installation technology underneath, users can use these common cmdlets to install/uninstall packages, add/remove/query package repositories, and query a system for the software installed.

PackageManagement works with:

  • Package providers
  • Package sources
  • Packages

Below is the architecture of PackageManagement exactly as provided in project site:

PowerShell PackageManagement - Architecture

[adinserter name=”In Article”]

PackageManagement Terms

  • Package manager – Software package management system. In PackageManagement terms, this is a package provider.
  • Package provider – PackageManagement term for a package manager. Examples can include Windows Installer, Chocolatey, and others.
  • Package source – A URL, local folder, or network shared folder that you configure package providers to use as a repository.
  • Package –  A piece of software that a package provider manages, and that is stored in a specific package source.

Requirments

  • Windows 10, Windows Server 2016, or down-level Windows OS + WMF5
  • Linux or Mac with the PowerShellCore

What you can do with PackageManagement

  • Manage a list of software repositories in which packages can be searched, acquired, and installed
  • Search and filter your repositories to find the packages you need
  • Seamlessly install and uninstall packages from one or more repositories with a single PowerShell command

Now lets see the the cmdlets that PackageManagement provides you, in order to manage software on our systems.

[adinserter name=”In Article”]

PackageManagement cmdlets

We are able to see the commands that are included in PackageManagement by using the below:

Code:

Get-Command -Module PackageManagement

Output:

PowerShell PackageManagement - Commands

Commands List:

  • Find-Package – Finds software packages in available package sources.

PowerShell PackageManagement - Find-Package

  • Find-PackageProvider – Returns a list of Package Management package providers available for installation.

PowerShell PackageManagement - Find-PackageProvider

[adinserter name=”In Article”]

  • Get-Package – Returns a list of all software packages that have been installed by using Package Management.

PowerShell PackageManagement - Get-Package

  • Get-PackageProvider – Returns a list of package providers that are connected to Package Management.

PowerShell PackageManagement - Get-PackageProvider

  • Get-PackageSource – Gets a list of package sources that are registered for a package provider.

PowerShell PackageManagement - Get-PackageSource

  • Import-PackageProvider – Adds Package Management package providers to the current session.
  • Install-Package – Installs one or more software packages.
  • Install-PackageProvider – Installs one or more Package Management package providers.

PowerShell PackageManagement - Install-PackageProvider

  • Register-PackageSource – Adds a package source for a specified package provider.
  • Save-Package – Saves packages to the local computer without installing them.
  • Set-PackageSource – Replaces a package source for a specified package provider.
  • Uninstall-Package – Uninstalls one or more software packages.
  • Unregister-PackageSource  – Removes a registered package source.

[adinserter name=”In Article”]

Install PackageManagement

From PowerShell 5.0 and later, PacakgeManagement is included. You may have to update the module. From the screenshot above we can see that the version that I have installed is 1.1.7.2. Currently the latest stable version is 1.1.7.2. PackageManagement 1.2.0-preview is also available if you would like to install it.

Code:

Install-Module PackageManagement

If you already have PackageManagement installed and you want to update your current installation to the latest one, then you need to use -Force parameter. If you do not use -Force parameter, it will give you an error that module is already installed.

Code:

Install-Module PackageManagement -Force

[adinserter name=”In Article”]

Trusted and Untrusted Sources

As you can see in the screenshot of Get-PackageSource above, the sources are not trusted. When you are trying to install as package from an untrusted source, it will ask you to confirm every time you install a package. If you want not to confirm every time you can set the source as trusted. You can do it by using the below:

Set-PackageSource -Name <sourcename> -Trusted

Output:

PowerShell PackageManagement - Set-PackageSource

If you want to set a trusted source as untrusted, then you will need to use the below:

Code:

Set-PackageSource -Name <sourcename> -Trusted:$false

Output:

PowerShell PackageManagement - Set-PackageSource-Untrusted

The above tutorial is a basic information about PackageManagement that can help you manage software packages on computers and servers. It would be good to check it further in order to understand better what you are able to do with it. In related links section you are able to find links with a lot of information related to PackageManagement.

I hope the tutorial about PackageManagement is helpful.

Please let me know your comments and thoughts.

You feedback is appreciated.

[adinserter name=”In Article”]

Related Links

  • PowerShell Tutorials
  • PowerShell Scripts
  • about_PackageManagement | Microsoft Docs
  • PackageManagement project
  • Find-Package – Microsoft Docs
  • Find-PackageProvider – Microsoft Docs
  • Get-Package – Microsoft Docs
  • Get-PackageProvider – Microsoft Docs
  • Get-PackageSource – Microsoft Docs
  • Import-PackageProvider – Microsoft Docs
  • Install-Package – Microsoft Docs
  • Install-PackageProvider – Microsoft Docs
  • Register-PackageSource – Microsoft Docs
  • Save-Package – Microsoft Docs
  • Set-PackageSource – Microsoft Docs
  • Uninstall-Package – Microsoft Docs
  • Unregister-PackageSource – Microsoft Docs

[adinserter name=”Matched-Content”]

Summary
PowerShell PackageManagement
Article Name
PowerShell PackageManagement
Description
PowerShell PackageManagement. In this tutorial you will find information about PowerShell PackageManagement and its use. Stephanos Constantinou Blog
Author
Stephanos
Publisher Name
Stephanos Constantinou Blog
Publisher Logo
Stephanos Constantinou Blog

Filed Under: PowerShell Tutorials Tagged With: Find-Package, Find-PackageProvider, Get-Command, Get-Package, Get-PackageProvider, Get-PackageSource, Import-PackageProvider, Install-Package, Install-PackageProvider, Register-PackageSource, Save-Package, Set-PackageSource, Uninstall-Package, Unregister-PackageSource

Reader Interactions

Comments

  1. Yves Rosius says

    14/10/2018 at 10:58

    Hi Stephanos

    great write-up! I keep bumping into your blogs when searching for PowerShell related articles 🙂

    Recently, I wrote an article about package management too. If you want you can check it out here:
    https://yvez.be/2018/09/30/3-easy-ways-to-manage-windows-applications-through-command-line/

    It’s cool to see Microsoft is unifying all these package sources in 1 simple to manage toolkit!

    Cheers
    Yves

    Reply
    • Stephanos says

      16/10/2018 at 10:36

      Hello Yves,

      Thank you for your comments. I have checked your article also. Nice write-up too.
      For sure, unifying all these package sources, is a good thing for usability.

      Thanks
      Stephanos

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Footer

Recent Posts

  • ICS Cube Product Review 26/04/2019
  • PowerShell Module SysInfo v1.2.0 15/03/2019
  • PowerShell Module SysInfo v1.1.2 13/11/2018
  • PowerShell Module SysInfo 24/10/2018
  • Get-VoltageProbe 24/10/2018
  • Get-VideoController 24/10/2018
  • Get-USBController 24/10/2018
  • Get-TrackPoint 24/10/2018
  • Get-TrackBall 24/10/2018
  • Get-TouchScreen 24/10/2018
Planet PowerShell

Categories

  • Modules Cmdlets (57)
  • PowerShell Modules (5)
  • PowerShell Scripts (38)
  • PowerShell Tutorials (35)
  • Software Reviews (2)

Archives

  • April 2019 (1)
  • March 2019 (1)
  • November 2018 (1)
  • October 2018 (56)
  • September 2018 (13)
  • August 2018 (9)
  • July 2018 (6)
  • June 2018 (8)
  • May 2018 (7)
  • April 2018 (9)
  • March 2018 (4)
  • February 2018 (6)
  • January 2018 (12)
  • December 2017 (4)
Top 10 PowerShell 2018

Blogroll

  • Planet PowerShell
  • Reddit – PowerShell
  • PowerShell Magazine
  • PowerShell.org
  • PowerShell Team Blog
  • Hey, Scripting Guy! Blog
  • Mike F Robbins
  • PowerShell Explained with Kevin Marquette
  • Mike Kanakos – Network Admin
  • The Lonely Administrator
  • AskME4Tech
PowerShell Blogs Sysadmin Blogs Banners for Top 20 Programming Blogs

© 2023 · Stephanos Constantinou Blog

  • Home
  • Blogs
  • About
  • Contact