共用方式為


Introducing PackageManagement in Windows 10

In Windows 10 we are launching a new PackageManagement feature (formerly referred to as OneGet) that enables ITPros or DevOps to automate software discovery, installation, and inventory (SDII), locally or remotely, no matter what the installer technology is and where the software is located. 

So why are we implementing PackageManagement? In the Linux world, people are familiar with package managers such as Apt-Get, YUM, RPM, etc, for different Linux distros. In the Windows world, however, there are quite a few installer technologies, each having their own way to install software, such as MSI, MSU, APPX, and the list goes on and on. This creates a challenge for ITPros and DevOps and a need for a tool to automate the software deployment experience. PackageManagement is aimed at solving this problem. Let’s first have a glance at the architecture.

 

Architecture

PackageManagement is essentially a Package Management Aggregator. It creates a unified and consistent PowerShell interface for users and provides a plug-in model at the back end that different installer technologies or package managers can plug-in as providers, using PackageManagement APIs. Each provider further manages one or multiple package sources (repositories) where software packages are stored.

Regardless of the installation technology underneath, users can use these common cmdlets to install/uninstall packages, add/remove/query package repositories, which we call Package Sources, and query a system for the software installed.

 

 What’s in the box?

In the box, we will have

  • PackageManagement Core component,

  • a PowerShell module to provide cmdlets, and

  • a key set of providers. 

That’s it, all other providers can be installed on the fly. This allows for a small footprint while not losing agility to dynamically bootstrap package providers and install packages from those providers.

The key set of providers coming in the box are:

  • a Bootstrap provider (the provider that knows where to get more providers from)
  • an MSI provider for handling MSI files
  • an MSU provider for handling Microsoft update files
  • an Programs provider (Add/Remove programs) for providing inventory data of anything that registered itself with Add/Remove programs
  • PowerShellGet -- for accessing PowerShell modules.

 

Quick Start

Let’s explore what PackageManagement can offer you. A handy Get-Command is a good start.

You can see that we provide three levels of management, i.e. provider, package source, and package. The cmdlets are pretty much self-explained. We are particularly interested at the Package level operations, so let’s explore further on the SDII operations.

Discover Packages

This will look at all package sources for the provider PSModule and return all the versions matching the package name.

Install Packages

Once you find the package, you can simply specify the version without specifying a package source and PackageManagement will install that version of package from the correct package source.

Inventory

You can specify the –provider parameter at Cmdlet get-package to check what’s installed in the local machine. There is a special provider Programs included. With –IncludeWindowsInstaller option, it returns a superset of packages comparing to the Add-and-Remove Program, which only lists those ‘volunteering’ registered MSI packages.

 

Where to get it for down-level platforms

Besides Win10, PackageManagement is available for down level platforms in a few ways:

  • It is included in the Windows Management Frameworks 5.0 (WMF 5.0) Preview that supports back to Windows 7 and Windows Server 2008 R2. WMF 5.0 also contains PowerShell 5.0, DSC, and other components. 

  • For users who only want PackageManagement, we will soon release a stable version of just PackageManagement and PowerShellGet provider as a MSI package, and plan to refresh it frequently.

PackageManagement is also an open source project at https://github.com/OneGet. You can check out the latest news and code from there.

Comments

  • Anonymous
    January 01, 2003
    Why so long and unfriendly for non-english speakers name? What was wrong with OneGet?
  • Anonymous
    April 28, 2015
    nice
    thanks
  • Anonymous
    April 28, 2015
    Has the download been pulled?
  • Anonymous
    April 29, 2015
    Is there any way to use this without PowerShell? I typically avoid PowerShell because it never "just works" - there is always some configuration to do in order to be able to do normal things like executing scripts (e.g. Set-ExecutionPolicy).
  • Anonymous
    April 29, 2015
    The comment has been removed
  • Anonymous
    April 29, 2015
    Count on MS to not do it right.

    And with Linux, Docker, and Mezos, things are getting very interesting on the Big Data side of stuff. MS tech is just tiring to work against, having little of the 'cool toys'. They only reason they are relevant on the business side is because of Office, Exchange, and Sharepoint. And even that is just... boring.

    -- Linux user/dev for last 14 years, O365 / Shibboleth integrator
  • Anonymous
    April 29, 2015
    Nevermind, I just have no idea what I'm doing with Powershell.

    /hurp derp
  • Anonymous
    April 29, 2015
    @WayneB

    PowerShell was a badly implemented afterthought that Microsoft bolted on a GUI. No wonder it's for the dogs.

    And frankly, what do you expect? Even if you're a professional, crummy tools make for bad results.
  • Anonymous
    April 29, 2015
    @Ted : It will likely work like Chocolatey or the *nix repos; mods have full control and monitoring of the repos. What happens in the Enterprise is a local repo that gets copies from other repos, as per your software admin(s).

    @WayneB : If the ExecutionPolicy is your only problem, set it via GPO. Or double up with psexec to set the policy then run the script, and reset the policy back if you're worried about security.
  • Anonymous
    April 29, 2015
    The comment has been removed
  • Anonymous
    April 29, 2015
    @Josh, you must be talking about Powershell v1.0. Try anything after that, as it's MUCH better. Version 2 was when it became a fully-fledged shell, just as useful as bash (this is coming from a 15-year linux admin).
  • Anonymous
    April 29, 2015
    The comment has been removed
  • Anonymous
    April 29, 2015
    The comment has been removed
  • Anonymous
    April 29, 2015
    Is there an 'update' or 'upgrade' part yet for upgrading installed packages?
  • Anonymous
    April 30, 2015
    are there any plans to get w10 package manager to handle dependencies, like apt and yum?
  • Anonymous
    April 30, 2015
    The comment has been removed
  • Anonymous
    April 30, 2015
    WMF 5.0 installs don't seem to be working for 2008
  • Anonymous
    April 30, 2015
    LOL at all the seriously ignorant comments here. Astounding actually.
  • Anonymous
    May 12, 2015
    I just installed Build 10074. I added the Chocolatey provider and I can find packages, but I can't actually install anything. For example:

    PS C:Windowssystem32> find-package stylecop

    Name Version Source Summary
    ---- ------- ------ -------
    stylecop 4.7 chocolatey StyleCop

    However, trying to do install-package stylecop returns almost instantly with no errors. However, looking in Add/Remove Programs, StyleCop is not there. What gives?
  • Anonymous
    May 18, 2015
    sweet :)
  • Anonymous
    May 27, 2015
    Hi ExitedButConfused. I ran this from an admin shell:
    Find-Package google-chrome-x64 | Install-Package -Verbose -Force

    And that worked out just fine! Hope it works for you
  • Anonymous
    June 02, 2015
    The comment has been removed
  • Anonymous
    June 12, 2015
    Christopher Warner - check out my helper for getting WMF 5 onto Server 2008 R2 and Windows 7:http://www.csi-windows.com/blog/all/74-powershell/445-getting-powershell-5-april-preview-5010105-running-windows-7-and-server-2008-r2-some-assembly-required
  • Anonymous
    August 04, 2015
    Apt-Get for Windows - OneGet and Chocolatey on Windows 10
  • Anonymous
    August 05, 2015
    The comment has been removed
  • Anonymous
    August 06, 2015
    Does this actually work on Windows 10 yet? It just seems to download the package files but only downloads them to c:Chocolatey directory.

    Does this happen for everyone or just me??
  • Anonymous
    August 06, 2015
    Let me be more precise...I typed: install-package vlc

    returns with:
    The packages come from a package source that is not marked as trusted.
    Are you sure you want to install softwae from 'chocolatey'? I select yes and then
    it pauses for about 3 seconds and then returns...

    Name version source summary
    --------- ---------- --------- -------------
    vlc 2.2.1.20150630 chocolatey VLC Media Player

    But doesn't actually install it. It downloads it to c:/Chocolatey/lib/vlc.2.2.1.20150630

    There's a directory 'tools' and a file named vlc.2.2.1.20150630.nupkg
    Inside 'tools' is 'chocolateyInstall.ps1'

    I don't think it's downloading the actual program or installing it. Is that happening for everyone or just me?
  • Anonymous
    August 06, 2015
    Nevermind...I got it to work...first you have to enable scripts bypass with: Set-ExecutionPolicy Bypass

    Then it installed everything fine.
  • Anonymous
    September 28, 2015
    I-Like-Typing-Camel-Case-And-Dashes-Just-To-Make-Sure-Its-Really-Awesome!
  • Anonymous
    November 19, 2015
    Introduce Windows Server Apps (WSAs), based on APPX, to package and install an application on Nano Server.
  • Anonymous
    November 19, 2015
    Hands on Packaging and Installing WSAs to Nano Server.
  • Anonymous
    February 15, 2016
    On my two Windows 10 environments I find that C:Program FilesPackageManagement contains just one empty folder: ProviderAssemblies. And I'm out of luck installing it today due to this error message from PowerShell:

    NuGet-anycpu.exe is required to continue.
    PowerShellGet requires NuGet-anycpu.exe to interact with NuGet based galleries. NuGet-anycpu.exe must be available in 'C:Program
    FilesPackageManagementProviderAssemblies' or 'C:Usersdavid-nobleAppDataLocalPackageManagementProviderAssemblies'. For more
    information about NuGet provider, see http://OneGet.org/NuGet.html. Do you want PowerShellGet to download NuGet-anycpu.exe now?
    [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
    WARNING: Unable to download the list of available providers. Check your internet connection.
    WARNING: Unable to find package provider 'NuGet'.
    Install-NuGetClientBinaries : NuGet-anycpu.exe is required to interact with NuGet based galleries. Please ensure that NuGet-anycpu.exe is
    available under 'C:Program FilesPackageManagementProviderAssemblies' or
    'C:Usersdavid-nobleAppDataLocalPackageManagementProviderAssemblies'.
    At C:Program FilesWindowsPowerShellModulesPowerShellGetPSGet.psm1:946 char:9
    + Install-NuGetClientBinaries
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Install-NuGetClientBinaries], InvalidOperationException
    + FullyQualifiedErrorId : CouldNotInstallNuGetBinaries,Install-NuGetClientBinaries

    WARNING: Unable to download the list of available providers. Check your internet connection.
    WARNING: Unable to find module provider 'NuGet'.
    WARNING: The specified PackageManagement provider 'NuGet' is not available.
    PackageManagementInstall-Package : No match was found for the specified search criteria and module name 'NTFSSecurity'.
    At C:Program FilesWindowsPowerShellModulesPowerShellGetPSGet.psm1:993 char:21
    + ... $null = PackageManagementInstall-Package @PSBoundParameters
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

    Others on the internet report similar problems, but there's no solution for me today. Let me know when OneGet can actually get anything by default on Windows 10.
  • Anonymous
    February 26, 2016
    PS C:UsersJosh> Import-Module PackageManagement
    Import-Module : The specified module 'PackageManagement' was not loaded because no valid module file was found in any
    module directory.

    Was this removed after RTM?