Condition
The matching is used to dynamically control the configuration, but the configuration itself may need to be different depending on the situation.
A condition is an option that can be specified on any configuration parameter. Thus, all parameters in the configuration (except conditions) can be different depending on conditions.
Available conditions
version
A common condition is based on the version of the operating system.
It will be specified with the real version number, and you may add the character +
or -
to specify:
- +
-
This version or later.
- -
-
This version or earlier.
[Condition]
01={W10} 10.0
02={W8+} 6.2+
03={W7-} 6.1-
file
A common condition will be based on the calling application. It is specified with file name, file name without extension, or full file path. Each condition can be a list of files separated with semicolon.
[Condition]
01={NetiD} netid
02={NetiD} netid.exe
03={NetiD} %ProgramFiles%\Net iD\Client\netid.exe
04={Browser} iexplore;firefox;safari
match
Use the match functionality to set the condition. You can use all matching conditions that do not use tokens or certificates. See Match for more information.
[Match]
X={MATCH-NAME} AAA=BBB (1) (2)
1 | AAA and BBB can be a variable or a static value. See Variables. |
2 | Use any of the operators described in section Matching operators. |
[Condition]
X={COND-NAME} match:AAA=BBB (1) (2)
1 | AAA and BBB can be a variable or a static value. See Variables. |
2 | Use any of the operators described in section Matching operators. |
A condition named THEME-DARK matches a theme setting in the registry.
[Condition]
X={THEME-DARK} match:{registry:HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize\SystemUsesLightTheme}=0
[Service Taskbar]
IconColor=2|{THEME-DARK}||1|*
Re-read the configuration:
$ netid.exe -service refresh
Change the theme on a Windows computer:
-
On the Windows desktop, right-click and select Personalize.
-
In the left menu, click Colors.
-
In the Choose your color list, click Light or Dark.
mode
A more complex condition is that a parameter should be different depending on execution mode, or that some other file exists.
The full list of execution modes:
-
mode:32-bit
-
mode:64-bit
-
mode:client
-
mode:communication:wts current
-
mode:communication:ica current
-
mode:exist:<path>
-
mode:exist-32:<path>
-
mode:exist-64:<path>
-
mode:safe-location
-
mode:sandbox
-
mode:server
-
mode:service-system
-
mode:service-user
-
mode:setup
-
mode:terminal-server
-
mode:unsafe-location
-
mode:user-admin
-
mode:user-normal
-
mode:user-system
-
mode:userinterface
-
mode:winstation-type:<type>
-
mode:wts-protocol-rdp
-
mode:wts-protocol-ica
-
mode:wfapi-protocol-rdp
-
mode:wfapi-protocol-ica
[Condition]
01={Citrix-TS} mode:winstation-type:ICA
02={Microsoft-TS} mode:winstation-type:RDP
list
It is possible to combine multiple named conditions:
-
a list of conditions that any should be fulfilled, a
or
condition -
a list of conditions that all should be fulfilled, a
and
condition.
[Condition]
01={32-bit} mode:32-bit
02={TS} mode:terminal-server
03={TS-with-32} {TS} and {32-bit}
04={TS-or-32} {TS} or {32-bit}
If both and
and or
condition is part of the same named list, and
is checked before or
.
However, it is better to separate to multiple entries to avoid misunderstanding:
and
/or
condition[Condition]
01={32-bit} mode:32-bit
02={TS} mode:terminal-server
03={USER} mode:user-normal
04={TEST} {TS} or {32-bit} and {USER} (1)
[Condition]
01={32-bit} mode:32-bit
02={TS} mode:terminal-server
03={USER} mode:user-normal
04={TMP} {32-bit} and {USER} (2)
05={TEST} {TS} or {TMP} (3)
1 | and /or condition where and is checked first. |
2 | arguments in the and condition. |
3 | arguments in the or condition. |