Extended host attribute matching
Contents
Supported host attributes
!!! This requires WPKG 1.2 or higher !!!
Below find a table of supported host attributes.
Attribute | Description | Example content collected by WPKG |
---|---|---|
hostname | the name of the host | hostname="satellite" |
os | the operating system | os="microsoft windows 7 home premium, , sp1, 6.1.7601" |
architecture | the processor architecture | architecture="x64" |
ipaddresses | all active IP addresses | ipaddresses="10.0.0.2,192.168.56.1" |
domainname | the domain the host belongs to | domainname="wpkg.org" |
groups | all groups the host belongs to | groups="design,office" |
lcid | the language of the operating system | lcid="c07" |
Where to use them
Below find a table of where you can use these attributes.
File | Node | Example |
---|---|---|
hosts.xml | host | <host name="..." profile-id="..." os="..." ... /> |
variable | <variable name="..." value="..." os="..." ... /> | |
profiles.xml | package | <package package-id="..." os="..." ... /> |
variable | <variable name="..." value="..." os="..." ... /> | |
packages.xml | variable | <variable name="..." value="..." os="..." ... /> |
depends | <depends package-id="..." os="..." ... /> | |
include | <include package-id="..." os="..." ... /> | |
chain | <chainpackage-id="..." os="..." ... /> | |
download | <download url="..." target="..." os="..." ... /> | |
install | <install cmd="..." os="..." ... /> | |
upgrade | <upgrade cmd="..." os="..." ... /> | |
downgrade | <downgrade cmd="..." os="..." ... /> | |
remove | <remove cmd="..." os="..." ... /> |
Detailed descriptions
All attributes are matched using regular expressions. The collected information is added to the <wpkg/> node of the wpkg.xml file, which allows reporting tools to apply the extended matching too.
To learn about the regular expression syntax used in WPKG, visit the Regular Expression Syntax topic at MSDN
hostname
This contains the name of the system, which is also contained in the Windows environment variable %COMPUTERNAME%.
Example usage:
<host hostname="^VM\-.+$" profile-id="VirtualMachines" />
os
This contains the full description of the operations system, which consists of the following parts:
- OS-caption
- OS-description
- CSD-version (usually the service pack)
- OS-version
Known descriptions:
(Please help to maintain this table)
OS String | Match Pattern |
---|---|
microsoft windows 2000 professional, , sp4, 5.0.2195 | os="professional.+5\.0\.\d{4}" |
microsoft windows 2000 server, , sp4, 5.0.2195 | os="server.+5\.0\.\d{4}" |
microsoft windows xp professional, , sp3, 5.1.2600 | os="professional.+5\.1\.\d{4}" |
microsoft(r) windows(r) xp professional x64 edition, , sp2, 5.2.3790 | os="professional.+5\.2\.\d{4}" architecture="x64" |
microsoft(r) windows(r) server 2003, standard edition, , sp2, 5.2.3790 | os="server.+standard.+5\.2\.\d{4}" |
microsoft(r) windows(r) server 2003 web edition, , sp2, 5.2.3790 | os="server.+web.+5\.2\.\d{4}" |
microsoft(r) windows(r) server 2003 enterprise x64 edition, , sp2, 5.2.3790 | os="server.+enterprise.+5\.2\.\d{4}" architecture="x64" |
microsoft(r) windows(r) server 2003 standard edition, r2, sp2, 5.2.3790 | os="server.+standard.+r2.+5\.2\.\d{4}" |
microsoft(r) windows(r) server 2003 standard x64 edition, r2, sp2, 5.2.3790 | os="server.+standard.+r2.+5\.2\.\d{4}" architecture="x64" |
microsoft(r) windows(r) server 2003 enterprise edition, r2, sp2, 5.2.3790 | os="server.+enterprise.+r2.+5\.2\.\d{4}" |
microsoft® windows vista™ home premium, , sp2, 6.0.6002 | os="premium.+6\.0\.\d{4}" |
microsoft® windows server® 2008 standard, , sp2, 6.0.6002 | os="server.+standard.+6\.0\.\d{4}" |
microsoft® windows® storage server 2008 standard, , sp2, 6.0.6002 | os="storage.+standard.+6\.0\.\d{4}" |
microsoft windows 7 home premium, , sp1, 6.1.7601 | os="premium.+6\.1\.\d{4}" |
microsoft windows 7 professional, , sp1, 6.1.7601 | os="professional.+6\.1\.\d{4}" |
microsoft windows 7 enterprise, , , 6.1.7600 | os="enterprise.+6\.1\.\d{4}" |
microsoft windows 7 ultimate, , , 6.1.7600 | os="ultimate.+6\.1\.\d{4}" |
microsoft windows server 2008 r2 standard, , sp1, 6.1.7601 | os="server.+standard.+6\.1\.\d{4}" |
microsoft windows server 2008 r2 enterprise, , sp1, 6.1.7601 | os="server.+enterprise.+6\.1\.\d{4}" |
microsoft windows 8 enterprise, , , 6.2.9200 | os="enterprise.+6\.2\.\d{4}" |
microsoft windows 8.1, , , 6.3.9600 | os="6\.3\.\d{4}" |
microsoft windows server 2012 standard, , , 6.2.9200 | os="server.+standard.+6\.2\.\d{4}" |
microsoft windows developer preview, , , 6.2.8102 | os="developer.+preview.+6\.2\.\d{4}" |
microsoft windows 10 enterprise, , , 10.0.10586 | os="10\.0\.\d{5}" |
microsoft windows server 2016 standard, , , 10.0.14393 | os="server.+standard.+10\.0\.\d{5}" |
microsoft windows server 2016 datacenter, , , 10.0.14393 | os="server.+datacenter.+10\.0\.\d{5}" |
The last entry is for testing the current release of Windows 8, "microsoft windows developer preview", version 6.2.8102, is the version of 'Windows 8' that was publicly released 13/09/2011, and anything before this is a version that was unofficially distributed.
Example usage:
<profile id="DesktopPC">
<!-- install Adobe Reader 9 only on Windows 2000 -->
<package package-id="AdobeReader9" os="5\.0\.\d{4}"/>
<!-- install Adobe Reader 10 only on Windows XP and higher -->
<package package-id="AdobeReader10" os="(5\.[1-2]|6\.\d)\.\d{4}"/>
</profile>
architecture
This contains the processor architecture of the current operating system.
Below find a table of possible values.
Value | Description |
---|---|
x86 | Intel x86 compatible 32-bit architecture |
x64 | AMD64 compatible 64-bit architecture |
ia64 | Itanium compatible 64-bit architecture |
Notice that a 32-bit Windows version installed on a 64-bit capable CPU is still flagged as 32-bit.
Example usage:
<!-- set destination folder based on architecture -->
<variable name="PKG_DEST" value="%ProgramFiles%\Mozilla Firefox" architecture="x86"/>
<variable name="PKG_DEST" value="%ProgramFiles(x86)%\Mozilla Firefox" architecture="x64"/>
If you are creative with your usage of variables then you can use them to dramatically simplify your packages.
Simplify your packages:
<!-- set destination folder based on architecture -->
<variable architecture="x86" name="PROGFILES" value="%PROGRAMFILES%" />
<variable architecture="x64" name="PROGFILES" value="%PROGRAMFILES(X86)%" />
<!-- BEFORE -->
<check type="logical" condition="or">
<check type="file" architecture="x86" condition="versiongreaterorequal" path="%PROGRAMFILES%\Common Files\microsoft shared\OFFICE15\MSO.DLL" value="15.0.4420.1017" />
<check type="file" architecture="x64" condition="versiongreaterorequal" path="%PROGRAMFILES(X86)%\Common Files\microsoft shared\OFFICE15\MSO.DLL" value="15.0.4420.1017" />
</check>
<!-- AFTER --> <!-- Now you don't have to use a conditional check statement!!! -->
<check type="file" condition="versiongreaterorequal" path="%PROGFILES%\Common Files\microsoft shared\OFFICE15\MSO.DLL" value="15.0.4420.1017" />
ipaddresses
This contains all currently active IP addresses of the system or an empty string, if no network adapter is currently active.
Example usage:
<host ipaddresses="^10\.0\.0\.[0-9]+$" profile-id="ExternalHosts" />
domainname
This contains the name of the domain the system belongs to or an empty string, if it is not a domain member.
Example usage:
<host domainname="wpkg.org" profile-id="WpkgHosts" />
groups
This contains the names of all groups the system belongs to or an empty string, if it is not a member of any group.
Example usage:
<host groups="office" profile-id="OfficeHosts" />
lcid
This contains the language identifier of the operating system, for a list of possible values visit Locale IDs Assigned by Microsoft.
Example usage:
<!-- default language is English -->
<variable name="PKG_LANGUAGE" value="en-us"/>
<!-- overwrite default language for German systems -->
<variable name="PKG_LANGUAGE" value="de" lcid="407,c07,1407,1007,807"/>
<!-- overwrite default language for Dutch systems -->
<variable name="PKG_LANGUAGE" value="nl" lcid="813,413"/>