- How to add holidays to the Exchange calendar with PowerShell - Wed, Apr 23 2014
- How to change the domain name in Exchange Server 2010 - Tue, Apr 8 2014
- How to enable Unsolicited Remote Assistance in Windows 7 / 8 - Tue, Oct 1 2013
The great thing about WPKG is that it doesn’t require any infrastructure other than an SMB network share, oh, and it’s free! To follow this introductory tutorial to WPKG, head over to the download page to get the latest version of WPKG, unzip the file and copy hosts.xml, packages.xml, profiles.xml and wpkg.js to C:\WPKG or a location of your choice. You should also share this folder, as you will need to access it over the network.
WPKG configuration files
The wpkg.js file is the main engine of WPKG. It first looks through the various XML configuration files, and then runs any required commands to install, upgrade or remove software from your client systems.
So-called profiles are defined in profiles.xml. A profile basically contains a list of software packages that will be installed on the remote system.
In hosts.xml you can assign computers to a WPKG profile. For example, you could assign all hosts that belong to accounting to the finance profile.
Finally, packages.xml contains information about all the available software packages that you can manage with WPKG. Each package definition should include a "check" to determine if the software is installed or not, a set of installation commands, a set of upgrade commands, and finally commands to remove the software.
If you take a look at the files you have copied to your WPKG folder, it should be relatively easy to gain an understanding of the way the WPKG configuration works: A host is allocated to a profile, and a profile then refers to packages which contain information about the way how the software has to be installed.
To keep this example easy, we will just deploy a single application( 7-Zip) to our clients. Download the 32-bit MSI and then save it to C:\WPKG\Software\7-zip\7z920.msi.
WPKG sample configuration
First, open profiles.xml. Take note of how the example profiles define dependencies. The "other" profile section includes the openoffice package and refers to the software packages in the "default section". The definition of default packages is useful for deploying a base set of applications to all workstations.
<?xml version="1.0" encoding="UTF-8"?> <profiles> <profile id="default"> <package package-id="firefox" /> <package package-id="thunderbird" /> </profile> <profile id="custom"> <depends profile-id="default" /> <package package-id="openoffice" /> </profile> <profile id="administration"> <depends profile-id="default" /> <package package-id="openoffice" /> <package package-id="acrobat7" /> </profile> <profile id="other"> <depends profile-id="default" /> <package package-id="openoffice" /> </profile> </profiles>
Remove the example configuration from profiles.xml, and insert this very basic profile, containing just one package:
<?xml version="1.0" encoding="UTF-8"?> <profiles> <profile id="default"> <package package-id="7-zip" /> </profile> </profiles>
The example hosts.xml file adds any unknown/unmatched clients to the "other profile", so we don’t need to edit this file for now, although you probably will want to do that later when you’re getting more adventurous with WPKG.
Packages.xml also contains examples, which you should remove and replace with a simple configuration containing just one package. In a common WPKG setup, you would have multiple packages listed here. Replace packages.xml with the following configuration:
<?xml version="1.0" encoding="UTF-8"?> <packages> <package id="7-zip" name="7-Zip" revision="9.20" reboot="false" priority="1"> <check type='uninstall' condition='exists' path='7-Zip 9.20' /> <install cmd='msiexec /qn /norestart /i "\\SERVER\WPKG\Software\7-Zip\7z920.msi" REBOOT=ReallySupress' /> <upgrade cmd='msiexec /qn /norestart /i "\\SERVER\WPKG\Software\7-Zip\7z920.msi" REBOOT=ReallySupress' /> <remove cmd='msiexec /qn /norestart /x "\\SERVER\WPKG\Software\7-Zip\7z920.msi"' /> </package> </packages>
I will quickly outline what’s going on in this file, as the packages.xml is certainly the most complex configuration aspect of WPKG. You can find the full documentation for packages.xml at WPKG.org.
Package id - The ID of the package, must be unique and match the package-id that you used in profiles.xml so that WPKG can create the link between the two.
Package name – This is just a friendly name that is displayed while the software is being installed.
Package revision - I usually use the software version, although you can just use an incrementing number – if you increase the revision number, WPKG will run the upgrade commands for the package.
Package reboot - Some packages might require an immediate reboot, in this case you should set reboot to "true". In our example the package won’t require a reboot, so I’ve left it at "false".
Package priority – Defines the order in which packages will be installed by WPKG. The higher this number is, the higher the priority of the package is (5 will be installed before 1).
Check – This section defines how WPKG will verify whether the package is installed on the client. There are a number of different checks that can be performed. In my example, I am just checking for a certain entry in the "Add/Remove programs" control panel applet. You can combine multiple checks if required.
Install – This is the command used to install the software for the first time. For automated software deployment, it is important that this command runs without any user intervention (unattended installation). It can sometimes take a bit of time to find out the required command line arguments for unattended installation. WPKG wiki and appdeploy.com are great resources if you are searching for command line parameters of well-known installers. Luckily the 7-Zip installer comes as a Microsoft Installer package (MSI) . You can use "/qn2" for quite (unattended installs). As you probably already guessed, "/i stands for "install". You can see the full list of command line arguments for MSI installers by running "msiexec /?" If you add multiple install commands, WPKG will run them sequentially.
Upgrade – Upgrades work the same way as installations, however this command is only executed when the revision number of the package is increased.
Remove – If a package has been removed from a profile, but is still present on the system, WPKG will run the remove command(s) to uninstall application from the system. This takes the same options and format as the install and upgrade commands.
If there are any syntax errors in your XML files, WPKG will not process the configuration. It is often helpful open the files in Internet Explorer as this will highlight syntax errors.
In my next article, I will show you how to set up the WPKG client WPKG-GP.