📜 ⬆️ ⬇️

Install, configure and use WPKG

More recently, I watched as IT experts everywhere tried to implement open source software, while management resisted and demanded the use of Microsoft products. Unlicensed products, but nonetheless. Now, I increasingly see the opposite: management requires the introduction of open source software, and IT departments beat out budget expansion for purchasing licenses. The reasons for the changed views of the management are clear - these are regular police raids that do not allow the use of the stolen, and the successful introduction of open source software in other companies, and the ability to save a lot of money. I am talking now, first of all, about the popular Microsoft Office replacement with Outlook'om bundled on OpenOffice.org and Mozilla Thunderbird.

But what is the reason for the decline in interest in open source software from IT specialists? Accompanying. If the management at the meeting hour for the hour before the end of the working day made a decision that requires changing the software settings on all workstations by the next morning, in a homogeneous MS software environment, the admin simply needs to launch the “Manage Group Policy Management” snap-in, make a few clicks and go home. Software not from Microsoft is usually not configured by politicians ... And the admin "ran" over a hundred workstations. At home, the mother / wife / children / dog again in the corner shat (underline the necessary). Or, for example, the Thunderbird update. WSUS does not download, it does not spread across workstations and will not install itself. This is updated every month.

Well, if the admin likes to reinvent the wheel. Even better if you can. Then, under all non-updated and non-customizable crutches are being built and it is all shaky, but worth it. Until the admin quits. Then usually with a crash crashes.
')
It's great when there is a fighter. Young and with strong legs. The routine task is written to the fighter, and the fighter performs it, replacing both the GPO, WSUS, and many other useful pieces.

These are not our methods. We want a rational use of labor resources, standardization of infrastructure and transparent IT business processes. Therefore, the settings and updates will be distributed centrally. Using WPKG. It is strange that on Habré there was not a single article about him.


WPKG is a WSH script, a set of xml configuration files and a client service that periodically executes this very script. You can do without the client part, but I will describe a typical solution.

The implementation object is a company with three offices and 112 workstations. Of these, 6 are running 64-bit Windows 7, 4 are running Windows XP, 63 are running Windows Vista and the rest are running Windows 7. Every office has a server with WSUS on board - SRV-1, SRV-2, SRV -3. That's right next to WSUS, and we will be building WPKG.

First of all, we create a WPKG directory and a corresponding WPKG $ network folder with read access for everyone on each server. Download wpkg.org/files/stable/1.3.x/wpkg-1.3.0-bin.zip and unpack it into the above directories. In the same directories, I created software and client subdirectories. The first is for software distributions that we will install and update - UltraVNC, Thunderbird and OpenOffice. The second for the WPKG client side.

WPKG Client

The client part of WPKG is a Windows service that starts every time the computer boots and executes wpkg.js from the network folder specified in the settings. Everything is very simple.

Download the client installation package from here and put it in the appropriate directory - client. There you also need to put the client configuration file - settings.xml. But first you need to do it. To do this, you need to install the client, run C: \ Program Files \ wpkg \ wpkginst.exe, fill in the fields and click the “Export settings” button.

image

I got something like this:
<? xml version = "1.0" encoding = "UTF-8" ?>
<configuration >
<file > \\ SRV-1 \ WPKG $ \ wpkg.js </ file >
<net-use-machine-account > YES </ net-use-machine-account >
<exec-user > SYSTEM </ exec-user >
<exec-password />
<parameters > / synchronize / nonotify / quiet </ parameters >
<silent > YES </ silent >
<pre-action />
<post-action />
<show-GUI > NO </ show-GUI >
<logon-delay > 0 </ logon-delay >
<logon-message-title > WPKG Software Deployment </ logon-message-title >
<logon-message-logo-picture />
<logon-message-1 > WPKG is installing applications and applying settings ... </ logon-message-1 >
<logon-message-2 > Please wait, don’t restart or power off your computer ... </ logon-message-2 >
<script-variable name = "SOFTWARE" > \\ SRV-1 \ WPKG $ \ software </ script-variable >
<priority > normal </ priority >
<stop-service-after-done > NO </ stop-service-after-done >
<laptop-mode > NO </ laptop-mode >
<server-connecting-method > standard </ server-connecting-method >
<server-connecting-ip />
<server-connecting-timeout > 3 </ server-connecting-timeout >
<server-connecting-script-timeout > 3 </ server-connecting-script-timeout >
<server-connecting-script-file />
<log-file />
<run-on-shutdown > NO </ run-on-shutdown >
<shutdown-delay > 10 </ shutdown-delay >
<logon-interrupt-password > OJzMGd0PqAMI2Vc = </ logon-interrupt-password >
<repeat-count-on-failure > 0 </ repeat-count-on-failure >
</ configuration >


The parameters are interesting here - file and script-variable. The first one indicates what the client part should run. The second is the client variable, which in our case stores the path to the software repository. It will come in handy later when writing a configuration for a WPKG server. In the meantime, you need to create two more copies of the configuration for SRV-2 and SRV-3 and correct the file and script-variable parameters in them accordingly.

We will install client part on workstations through GPO . In order for the client to be installed with our settings, you will have to create a transformation of the installation package and add the line SETTINGSFILE with the value \\ SRV-1 \ WPKG $ \ client \ settings.xml to the Properties table. This can be done with Orca . Naturally, for each server you need to make your transformation file and put it there, in the client directory.

Distributions

Prepare a set of distributions. In the software directory, I created the following directory structure:
image

Thunderbird

In the Thunderbird directory, I created two more subdirectories - configuration and extensions. We put Thunderbird Setup 9.0.1.exe in the root. In the configuration files all.js and autoconf.cfg (you can read about it here ). Thunderbird extensions in extensions should be put unpacked. You can unpack xpi by the archiver, but I did not bother and just copied the folders from my profile - C: \ Users \% USERNAME% \ AppData \ Roaming \ Thunderbird \ Profiles \ abc1defg.default \ extensions.

Openoffice

Run the OpenOffice installation, wait for the installer to unzip the files in software \ Std \ all \ OpenOffice, finish the installation. Orca will again come in handy to wean the installation package to require running setup.exe. Open openofficeorg33.msi, find the LaunchCondition table and delete the row containing the SETUP_USED condition in it.

VNC

In the software \ Std \ x86 \ VNC we put the 32-bit version of the distribution kit, in x64, respectively, 64-bit. In both catalogs we put uvnc.inf and ultravnc.ini. The first one can be obtained by running the installation with the / saveinf key, but it is primitive:

[Setup]
Lang=en
Dir=C:\Program Files\UltraVNC
Group=UltraVNC
NoIcons=0
SetupType=server_silent
Components=ultravnc_server_s
Tasks=installservice,startservice


The second is the result of setting up an already installed UltraVNC, you can take it in C: \ Program Files \ UltraVNC.

WPKG server

Now it remains to configure WPKG itself. There are three main files for this: host.xml, profiles.xml and packages.xml, describing who to install, what to install and how to install.

When launched on the client side, WPKG searches for the name of the workstation on which it is running in the hosts.xml file. The name supports regular expressions. In my case, the file contains the names of 64-bit workstations and the template for all the others.

<host name = "WKS-088" profile-id = "StdX64" />
<host name = ". +" profile-id = "StdX86" />


Having found the name of the workstation in host.xml, WPKG gets the name of the installation profile for this workstation. Profile descriptions are stored in profiles.xml. The profile lists packages for installation and dependencies on other profiles. For example: Profile for the workstation WKS-088 - StdX64. StdX64 depends on Std profile. Therefore, first all packages from the Std profile will be installed on the WKS-088, and then only from StdX64.

<profile id = "Std" >
<package package-id = "Thunderbird" />
<package package-id = "Lightning" />
<package package-id = "MinTrayR" />
<package package-id = "OpenOffice" />
</ profile >

<profile id = "StdX64" >
<depends profile-id = "Std" />
<package package-id = "VNCx64" />
</ profile >


Packages are described in packages.xml. Each package is a set of instructions for checking whether the software is installed, for installing the software, for updating the software, and for uninstalling the software. Take for example the Lightning package, which describes the installation of an extension for Thunderbird:

<package
id = "Lightning"
name = "Lightning"
revision = "2012.01.10"
reboot = "false"
priority = "0" >

<variable name = "version" value = "1.1" />

<depends package-id = "Thunderbird" />

<check type = "file" condition = "exists" path = "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103} \ install.rdf" />

<install cmd = '% COMSPEC% / C xcopy / Q / I / E / Y / V / Z "% SOFTWARE% \ Std \ all \ Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103}" "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103} "' />

<upgrade cmd = '% COMSPEC% / C xcopy / Q / I / E / Y / V / Z "% SOFTWARE% \ Std \ all \ Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103}" "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103} "' />

<remove cmd = '% COMSPEC% / C rmdir / S / Q "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103}"' />
</ package >


The package has a header containing the package ID, name, revision and priority. The package identifier is used in the WPKG configuration, to associate the package with a profile and specify dependencies between packages. The package name is used to display messages in the Windows event log. WPKG processes packets in the order of priority specified. Priority is not recommended, it is better to use dependencies. You can use several formats to specify the package revision: simple number format - 1, 2, 3, etc., format with dots - 1.1, 2.1.4, 3.200.3987, etc., alphanumeric format - 1.2RC1, 1.5 I32, 2.73M24, 1.65.b, etc., but I decided to use the date in the format - YYYY.MM.DD. In my opinion, this is easier and more reliable. WPKG compares the list of packages for this profile with the list from its last launch. If a new package appears in the list, the package check instructions are executed in sequence. If none of them found the installed application, then install instructions are also executed sequentially. If the package has disappeared from the list, then the remove statements are executed. If the revision has changed, the upgrade instructions are executed sequentially.

Packages, like profiles, may depend on each other. This dependency is defined by the depends directive. In our example, the Lightning package will not be installed until Thunderbird is installed.

The instructions contain variables framed with percent signs (%). These can be system environment variables, WPKG client-side variables (for example, the variable% SOFTWARE% was defined by us in settings.xml) and the variables described in the configuration files. The latter are described by the variable directive.

Full working system configuration files:

host.xml

<? xml version = "1.0" encoding = "UTF-8" ?>

<hosts: wpkg xmlns: hosts = " www.wpkg.org/hosts" xmlns: wpkg = " www.wpkg.org/wpkg"
xmlns: xsi = " www.w3.org/2001/XMLSchema-instance"
xsi: schemaLocation = " www.wpkg.org/hosts xsd / hosts.xsd" >

<host name = "WKS-088" profile-id = "StdX64" />
<host name = "WKS-109" profile-id = "StdX64" />
<host name = "WKS-112" profile-id = "StdX64" />
<host name = "WKS-114" profile-id = "StdX64" />
<host name = "WKS-115" profile-id = "StdX64" />
<host name = "WKS-121" profile-id = "StdX64" />

<host name = ". +" profile-id = "StdX86" />

</ hosts: wpkg >

Download

profiles.xml

<? xml version = "1.0" encoding = "UTF-8" ?>
<profiles: profiles xmlns: profiles = " www.wpkg.org/profiles"
xmlns: wpkg = " www.wpkg.org/wpkg" xmlns: xsi = " www.w3.org/2001/XMLSchema-instance"
xsi: schemaLocation = " www.wpkg.org/profiles xsd / profiles.xsd" >
<profile id = "Std" >
<package package-id = "Thunderbird" />
<package package-id = "Lightning" />
<package package-id = "MinTrayR" />
<package package-id = "OpenOffice" />
</ profile >

<profile id = "StdX86" >
<depends profile-id = "Std" />
<package package-id = "VNCx86" />
</ profile >

<profile id = "StdX64" >
<depends profile-id = "Std" />
<package package-id = "VNCx64" />
</ profile >
</ profiles: profiles >

Download

packages.xml

<? xml version = "1.0" encoding = "UTF-8" ?>
<packages: packages xmlns: packages = " www.wpkg.org/packages"
xmlns: wpkg = " www.wpkg.org/wpkg" xmlns: xsi = " www.w3.org/2001/XMLSchema-instance"
xsi: schemaLocation = " www.wpkg.org/packages xsd / packages.xsd" >

<package
id = "Thunderbird"
name = "Mozilla Thunderbird"
revision = "2012.01.10"
reboot = "false"
priority = "0" >

<variable name = "version" value = "9.0.1" />
<variable name = "architecture" value = "x86" />
<variable name = "locale" value = "en" />

<check type = "uninstall" condition = "exists" path = "Mozilla Thunderbird% version% (% architecture%% locale%)" />

<install cmd = '"% SOFTWARE% \ Std \ all \ Thunderbird \ Thunderbird Setup% version% .exe" -ms' />

<install cmd = '% COMSPEC% / C copy / v / y / z% SOFTWARE% \ Std \ all \ Thunderbird \ configuration \ all.js "% PROGRAMFILES% \ Mozilla Thunderbird \ defaults \ pref \"' />
<install cmd = '% COMSPEC% / C copy / v / y / z% SOFTWARE% \ Std \ all \ Thunderbird \ configuration \ autoconf.cfg "% PROGRAMFILES% \ Mozilla Thunderbird \"' />

<upgrade cmd = 'taskkill / F / IM thunderbird.exe' >
<exit code = "0" />
<exit code = "128" />
</ upgrade >

<upgrade cmd = '"% SOFTWARE% \ thunderbird \ Thunderbird Setup% version% .exe" -ms' />

<upgrade cmd = '% COMSPEC% / C copy / v / y / z% SOFTWARE% \ Std \ all \ Thunderbird \ configuration \ all.js "% PROGRAMFILES% \ Mozilla Thunderbird \ defaults \ pref \"' />
<upgrade cmd = '% COMSPEC% / C copy / v / y / z% SOFTWARE% \ Std \ all \ Thunderbird \ configuration \ autoconf.cfg "% PROGRAMFILES% \ Mozilla Thunderbird \"' />

<remove cmd = 'taskkill / f / im thunderbird.exe' >
<exit code = "0" />
<exit code = "128" />
</ remove >

<remove cmd = '% COMSPEC% / C if exist "% PROGRAMFILES% \ Mozilla Thunderbird \ uninstall \ helper.exe" "% PROGRAMFILES% \ Mozilla Thunderbird \ uninstall \ helper.exe" -ms' />
</ package >

<package
id = "Lightning"
name = "Lightning"
revision = "2012.01.10"
reboot = "false"
priority = "0" >

<variable name = "version" value = "1.1" />

<depends package-id = "Thunderbird" />

<check type = "file" condition = "exists" path = "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103} \ install.rdf" />

<install cmd = '% COMSPEC% / C xcopy / Q / I / E / Y / V / Z "% SOFTWARE% \ Std \ all \ Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103}" "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103} "' />

<upgrade cmd = '% COMSPEC% / C xcopy / Q / I / E / Y / V / Z "% SOFTWARE% \ Std \ all \ Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103}" "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103} "' />

<remove cmd = '% COMSPEC% / C rmdir / S / Q "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ {e2fda1a4-762b-4020-b5ad-a41df1933103}"' />
</ package >

<package
id = "MinTrayR"
name = "MinimizeToTray revived"
revision = "2012.01.10"
reboot = "false"
priority = "0" >

<variable name = "version" value = "1.0" />

<depends package-id = "Thunderbird" />

<check type = "file" condition = "exists" path = "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ mintrayr@tn123.ath.cx \ install.rdf" />

<install cmd = '% COMSPEC% / C xcopy / Q / I / E / Y / V / Z "% SOFTWARE% \ Std \ all \ Thunderbird \ extensions \ mintrayr@tn123.ath.cx" "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ mintrayr@tn123.ath.cx "' />

<upgrade cmd = '% COMSPEC% / C xcopy / Q / I / E / Y / V / Z "% SOFTWARE% \ Std \ all \ Thunderbird \ extensions \ mintrayr@tn123.ath.cx" "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ mintrayr@tn123.ath.cx "' />

<remove cmd = '% COMSPEC% / C rmdir / S / Q "% PROGRAMFILES% \ Mozilla Thunderbird \ extensions \ mintrayr@tn123.ath.cx"' />
</ package >

<package
id = "OpenOffice"
name = "OpenOffice.org 3.3"
revision = "2012.01.11"
reboot = "false"
priority = "0" >

<variable name = "version" value = "3.3.9567.500" />
<variable name = "code" value = "{4218E1CD-CDB6-448C-8036-2871403BDE57}" />

<check type = "file" condition = "versionequalto" path = "% PROGRAMFILES% \ OpenOffice.org 3 \ program \ soffice.exe" value = "% version%" />

<install cmd = '% COMSPEC% / C if exist "% PROGRAMFILES% \ OpenOffice.org 3 \ program \ soffice.exe" msiexec / qn / x% code%' />
<install cmd = 'msiexec / qn / i "% SOFTWARE% \ Std \ all \ OpenOffice \ openofficeorg33.msi" ALLUSERS = 1 ADDLOCAL = ALL REMOVE = gm_o_Quickstart, gm_o_Onlineupdate' />
<install cmd = '% COMSPEC% / C copy / v / y / z% SOFTWARE% \ Std \ all \ OpenOffice \ bootstrap.ini "% PROGRAMFILES% \ OpenOffice.org 3 \ program \"' />

<upgrade cmd = 'msiexec / qn / i "% SOFTWARE% \ Std \ all \ OpenOffice \ openofficeorg33.msi" ALLUSERS = 1 ADDLOCAL = ALL REMOVE = gm_o_Quickstart, gm_o_Onlineupdate' />
<upgrade cmd = '% COMSPEC% / C copy / v / y / z% SOFTWARE% \ Std \ all \ OpenOffice \ bootstrap.ini "% PROGRAMFILES% \ OpenOffice.org 3 \ program \"' />

<remove cmd = 'msiexec / qn / x% code%' />
</ package >

<package id = "VNCx86" name = "Ultra VNC (x86)" revision = "2012.01.11" priority = "0" >
<variable name = "version" value = "1.0.9.6" />

<check type = "file" condition = "versionequalto" path = "% PROGRAMFILES% \ UltraVNC \ winvnc.exe" value = "% version%" />

<install cmd = '% SOFTWARE% \ Std \ x86 \ vnc \ UltraVNC_1.0.9.6.1_Setup.exe / verysilent /loadinf="%SOFTWARE%\Std\x86\vnc\uvnc.inf "' />
<install cmd = '% COMSPEC% / c copy / Y% SOFTWARE% \ Std \ x86 \ vnc \ ultravnc.ini "% PROGRAMFILES% \ UltraVNC \"' />

<upgrade cmd = 'net stop uvnc_service' >
<exit code = '0' />
<exit code = '2' />
</ upgrade >
<upgrade cmd = 'sc delete uvnc_service' />
<upgrade cmd = '% SOFTWARE% \ Std \ x86 \ vnc \ UltraVNC_1.0.9.6.1_Setup.exe / verysilent /loadinf="%SOFTWARE%\Std\x86\vnc\uvnc.inf "' />
<upgrade cmd = '% COMSPEC% / c copy / Y% SOFTWARE% \ Std \ x86 \ vnc \ ultravnc.ini "% PROGRAMFILES% \ UltraVNC \"' />

<remove cmd = 'net stop uvnc_service' >
<exit code = '0' />
<exit code = '2' />
</ remove >
<remove cmd = 'sc delete uvnc_service' />
<remove cmd = '"% PROGRAMFILES% \ UltraVNC \ unins000.exe" / verysilent / norestart' />
<remove cmd = '% COMSPEC% / c rmdir / S / Q "% PROGRAMFILES% \ UltraVNC"' />
</ package >

<package id = "VNCx64" name = "Ultra VNC (x64)" revision = "2012.01.11" priority = "0" >
<variable name = "version" value = "1.0.9.6" />

<check type = "file" condition = "versionequalto" path = "% PROGRAMFILES% \ UltraVNC \ winvnc.exe" value = "% version%" />

<install cmd = '% SOFTWARE% \ Std \ x64 \ vnc \ UltraVNC_1.0.9.6.1_x64_Setup.exe / verysilent / downloadinf = "%SOFTWARE%\Std\x64\vnc\uvnc.inf "' />
<install cmd = '% COMSPEC% / c copy / Y% SOFTWARE% \ Std \ x64 \ vnc \ ultravnc.ini "% PROGRAMFILES% \ UltraVNC \"' />

<upgrade cmd = 'net stop uvnc_service' >
<exit code = '0' />
<exit code = '2' />
</ upgrade >
<upgrade cmd = 'sc delete uvnc_service' />
<upgrade cmd = '% SOFTWARE% \ Std \ x64 \ vnc \ UltraVNC_1.0.9.6.1_x64_Setup.exe / verysilent / downloadinf = "%SOFTWARE%\Std\x64\vnc\uvnc.inf "' />
<upgrade cmd = '% COMSPEC% / c copy / Y% SOFTWARE% \ Std \ x64 \ vnc \ ultravnc.ini "% PROGRAMFILES% \ UltraVNC \"' />

<remove cmd = 'net stop uvnc_service' >
<exit code = '0' />
<exit code = '2' />
</ remove >
<remove cmd = 'sc delete uvnc_service' />
<remove cmd = '"% PROGRAMFILES% \ UltraVNC \ unins000.exe" / verysilent / norestart' />
<remove cmd = '% COMSPEC% / c rmdir / S / Q "% PROGRAMFILES% \ UltraVNC"' />
</ package >
</ packages: packages >

Download

All the packages were taken by me from the site wpkg.org . But they are easy and self-write.

Also easily diagnosed and solved problems, in case of their occurrence. While running, WPKG logs events in the Windows event log and logs to% SYSTEMROOT% \ System32 \ wpkg.xml

The system administrator only needs to download the latest software versions to the software directory on time and monitor the correct operation of the packages.

Source: https://habr.com/ru/post/136314/


All Articles