Monday, April 28, 2014

Installing software package by PowerShell 5.0 in Windows Server 2012 R2

Microsoft announced Windows Management Framework 5.0 preview (WMF 5.0) for Windows Server 2012 R2 and Windows 8.1. One of the features is "OneGet" module. "OneGet" is similar to a feature "YUM" or "APT" in Linux. Using "OneGet", administrators can perform PowerShell to download and install software packages from internet repository. In this preview version, all source packages are from "Chocolatey".

To use cmdlets to download and install package, make sure the operating systems are supported. At this moment, Windows Management Framework 5.0 Preview supported Windows 8.1 Pro, Windows 8.1 Enterprise and Windows Server 2012 R2. Microsoft also listed the application which are supported WMF 5.0.
  • Microsoft Exchange Server 2013 Service Pack 1
  • Microsoft Exchange Server 2010 Service Pack 3 with Update Rollup 5
  • Microsoft SharePoint Server 2013 Service Pack 1
  • Microsoft SharePoint 2013 with the February 2014 Cumulative Update

This is the preview version. Administrators shouldn't test it in production environment.

Lab environment
  • 1 Windows Server 2012 R2 with update 1
Prerequisite
  • Download Windows Management Framework 5.0 Preview and then save as C drive in a Windows Server

Download link

Lab
1. On a  Windows Server, log in as administrator.
2. Navigate to C drive.
3. Double-click "Windows8.1-KB2894868-x64" to install Windows Management Framework 5.0 64 bit version.


4. Launch "PowerShell" as administrator.
5. Perform "Get-Command -Module OneGet' to get commands related to OneGet module.


Like "Yum" or "APT", administrators can add or remove the package repository by performing "Add-PackageSource" and "Remove-PackageSource". Administrators can perform "Get-PackageSource" to get the other package repositories sites from Internet. At this moment, there is only one repository, "Chocolatey".


5. Perform "Find-Package" to find all packages from the repository.


At this moment, there are almost 1800 software packages on the repository

6. Perform "Install-Package 7zip" to download and install "7zip".



"Install-Package" automatically download and install the dependency package of the software which you want to install.

7. Perform "Get-Package" to check which package were installed by "OneGet" PowerShell module.


8. Perform "Uninstall-Package 7zip" to uninstall 7zip package.


To get more details of "OneGet" module, please read this article PowerShell - Playing with the new OneGet module (v5 preview) is written by Francois-Xavier Cat.

For more information

This posting is provided “AS IS” with no warranties, and confers no rights!

No comments:

Post a Comment