Last modified by Sabrina V. on 2025/11/27 12:33

Show last authors
1 {{aagon.priorisierung}}
2 160
3 {{/aagon.priorisierung}}
4
5 {{aagon.floatingbox/}}
6
7 = Initial situation =
8
9 Sometimes it is unavoidable that you have to update software or programs that affect all or some of the Clients in your organisation, even during normal working hours. In this case, it is useful to be able to check, for example, whether a particular program is currently being actively used or not, in order to get an overview of how quickly certain updates can be deployed.
10
11 This Client Command is needed for software distribution, for example. It checks whether a particular process belonging to a programme that is to be updated is still running. The user can be informed that the program and the associated process should be closed in order to perform such an update. It does not matter whether you are checking Microsoft Word or an Internet browser. In what follows, the Command is designed to be generic, so that you can quickly adapt it specifically for other programs. For this reason, the following use case uses variables (system variables) that require very little customisation and make certain components of the script more flexible and variable.
12
13 This use case shows how you can specifically check on the clients whether a particular program or process is running. Mozilla Firefox is used as an example. You will also gain an insight into how to use variables universally.
14
15 = Checking for running programs and processes =
16
17 == Select a Script ==
18
19 1. Navigate to the //Client Commands// > //Create// module.
20 1. Click //Add// on the ribbon bar. The Client Command Editor will open and you will need to decide whether it is a Console or Client Script. In this case select Client Script.
21
22 == Setting and editing a Command //Set project variable// ==
23
24 1. First select the //Variables// > //Set Project Variable// Command from the Command List.
25 1. Double click on the Command and select the //General// tab.
26 1. Enter a name under the description of the action. In this example, "Set project variable SOFTWARE_NAME to 'Mozilla Firefox'" is inserted.
27 1. Switch to the //Details// tab.
28 1. Under the variable settings, click on the icon next to the variable name.
29 1. Optional: Create a new variable under //Actions//. Name it "SOFTWARE_NAME" and click on the plus icon. Then click the //OK// button to complete the step.
30
31 {{aagon.infobox}}
32 This step is optional if you have not already created the variable.
33 {{/aagon.infobox}}
34
35 7. Enter the name of the software in the //One line text// box. In this example it is „Mozilla Firefox“.
36 8. Click //OK//.
37
38 {{figure}}
39 [[image:65_Use Case Client Command_Auf laufende Prozesse Variableneinstellungen vornehmen.png||data-xwiki-image-style-alignment="center"]]
40
41 {{figureCaption}}
42 Making variable settings
43 {{/figureCaption}}
44 {{/figure}}
45
46 == Set and edit Command //Set project variable// ==
47
48 1. Select the //Set project variable// Command again.
49 1. Double click the Command and open the //General// tab.
50 1. Enter the name in the description field, e.g. Set project variable //SOFTWARE_EXE to „firefox.exe“//.
51 1. Switch to the //Details// tab.
52 1. Optional: Create a new variable under //Actions//. Name it "SOFTWARE_EXE" and click the plus icon. Click //OK //to complete this step.
53
54 {{aagon.infobox}}
55 This step is optional if you have not already created the variable.
56 {{/aagon.infobox}}
57
58 6. Enter the process name in the Single line text box.
59
60 {{aagon.infobox}}
61 You can query the name of the process using Task Manager by opening the running processes and displaying the name on the //Details// tab.
62 {{/aagon.infobox}}
63
64 Enter the text „firefox.exe“.
65 7. Click //OK//.
66
67 {{figure}}
68 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen_Variableneinstellungen vornehmen.png||data-xwiki-image-style-alignment="center"]]
69
70 {{figureCaption}}
71 Setting variables
72 {{/figureCaption}}
73 {{/figure}}
74
75 {{aagon.warnungsbox}}
76 With the two Set project variable Commands you have entered two values that you need to check a specific process. In this case you have entered the name of the software (Mozilla Firefox) and the name of the executable file (firefox.exe). If, at a later date, you want to check the whole Command for a different program, you only need to change the first two lines.
77 {{/aagon.warnungsbox}}
78
79 == Insert and customise //Get process ID// Command ==
80
81 This Command allows you to determine the current process ID of the running process or program. This makes it possible to check, in the ongoing structure of the application example, whether the particular process or program is actively running on a Client or not.
82
83 1. Select the //Process and Shell// > //Get Process ID// Command.
84 1. Double click to open the Command.
85 1. Under //Process / Target variable//, enable the //... with process// option by clicking the button.
86 1. Insert the appropriate variable ~(%SOFTWARE_EXE%). This variable is used to check that Mozilla Firefox is running.
87
88 {{aagon.warnungsbox}}
89 To avoid typing errors, we recommend that you do not enter the variables manually. Instead, either insert them using the icon in the //... with process// line, or press the CTRL + Spacebar combination in the field. This will open the list of variables and you can select the appropriate one.
90 {{/aagon.warnungsbox}}
91
92 {{aagon.infobox}}
93 The firefox.exe is not explicitly entered here in order to make the Client Commands as variable as possible for other checks.  This will allow you to easily change the entries from line 1 and line 2 after the Command is complete and check for other processes by entering a different program there.
94 {{/aagon.infobox}}
95
96 5. Under //Save results in//, click on the icon to the right of the variable name.
97 6. Open Project Variables from the drop down menu at the top.
98 7. Enter the name "CHECK_EXE" under the actions and click on the plus icon.
99 Click //OK// to complete this step.
100
101 {{figure}}
102 [[image:65_Use Case Client Commands_Variable auswählen.png||data-xwiki-image-style-alignment="center"]]
103
104 {{figureCaption}}
105 Select variable
106 {{/figureCaption}}
107 {{/figure}}
108
109 {{aagon.infobox}}
110 You are free to choose any variable name. However, it is recommended that you choose names that are appropriate to the topic so that you can understand exactly what a variable does later in the process.
111 {{/aagon.infobox}}
112
113 8. The result will be stored in the CHECK_EXE variable.
114 9. Then click //OK//.
115
116 {{figure}}
117 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen Get process ID_484.png||data-xwiki-image-style-alignment="center"]]
118
119 {{figureCaption}}
120 Get process ID
121 {{/figureCaption}}
122 {{/figure}}
123
124 You have now added your first Commands to the Client Script. At this point you can check on your computer to see if the Command works. To do this, click the //Start// button on the quick selection bar or press the F9 key combination. This will run the first three Commands.
125
126 Now open the //Run Log// in the lower pane where all the logs of the Client Script are stored. Depending on whether you have the Mozilla Firefox browser open or not, you will see a different value. This is explained by the variable name "CHECK_EXE". If the variable is 0, the programme is not open. If the variable is >0, the program is open and running in the background. In the graphic shown here, the variable is set to 0, so the program is not open.
127
128 {{aagon.warnungsbox}}
129 If the process ID is not running (and therefore 0), the Client Script will encounter an error (see graphic). You should ignore this error by checking the box next to it. This ensures that the 0 is also a valid result in the script and that the Client Command can continue to run. You will then need to check that the value is 0 or greater than 0.
130 {{/aagon.warnungsbox}}
131
132 {{figure}}
133 [[image:65_Use Case_Client Commands_Auf laufende Prozesse überprüfen_Durchlauf des CCs_1275.png||data-xwiki-image-style-alignment="center"]]
134
135 {{figureCaption}}
136 Running the Client Commands to check for running processes
137 {{/figureCaption}}
138 {{/figure}}
139
140 == Command //If ... Then// insert and customise ==
141
142 1. In the Command List, select the //Flow Control// > //If ...// Command.
143 1. Double click on the Command to open it and switch to the //General// tab.
144 1. Under Action description, enter a name that describes the Command. In this example, "If ~(%CHECK_EXE% <> 0) Then - If the process is running ..." is written so that it is clear in the main field which condition is to be fulfilled here.
145 1. Switch to the //Details// tab.
146 1. Insert the values to be checked under the conditions. In value 1, the variable //%CHECK_EXE%// must be entered as this is what is to be checked. The variable in value 1 will then be filled when the programme is executed.
147 1. Select the unequal operator (< >) to check whether the programme or process is running or not. This operator is particularly suitable because the value can always be different and you can therefore include all possibilities.
148 1. Insert the number 0 as value 2. This is the value used as the condition for the operator.
149 1. Click //OK// to complete the Command.
150
151 {{figure}}
152 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen If ... then.png||alt="65_Use Case Client Commands_Variable auswählen.png" data-xwiki-image-style-alignment="center"]]
153
154 {{figureCaption}}
155 If ... Then Command
156 {{/figureCaption}}
157 {{/figure}}
158
159 If the process is running, the row is completed as the condition is met. If the process is not running, the line is skipped.
160
161 == Optional: Set and edit Command //Dialogs// ==
162
163 You can set this Command as optional if you want your Clients to see a dialogue box informing them that the program should be closed. The message can be customised. Note that the Command must be nested under the previous command (If ~(%CHECK_EXE% <> 0) Then) for it to work correctly.
164
165 1. Select the //Dialogs// > //Dialogs// Command from the Command List.
166 1. Open the Command by double clicking on it and open the //Message Settings// tab.
167 1. Enter a suitable title for the message. Again, we recommend that you use the project variables and not the name of the program to keep the whole module variable. For example, you could write //Software Update: %SOFTWARE_NAME%//.
168 1. Insert the message for the Clients to be displayed when the program is still open.
169
170 {{aagon.infobox}}
171 If you want to use a project variable to use the name of the user in the address, you can use the %LOGGEDONUSER_NAME% variable.
172
173 This will use the logged-in user name as the salutation.
174 {{/aagon.infobox}}
175
176 Optional: Change the //message type// and/or available buttons and custom captions.
177
178 {{aagon.infobox}}
179 If you want to see the message text before completing the Command, you can do this by clicking the //Preview// button.
180 {{/aagon.infobox}}
181
182 5. Click //OK//.
183
184 {{figure}}
185 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen Dialog eingeben.png||data-xwiki-image-style-alignment="center"]]
186
187 {{figureCaption}}
188 Enter a dialog
189 {{/figureCaption}}
190 {{/figure}}
191
192 == Inserting and customising the //Else //Command ==
193
194 The //Else// block belongs to the previous //If ... Then// Command. Make sure that the Command is inserted at the same level so that the conditions between //If ... Then// and //Else// are completed.
195
196 1. Navigate back to the Command List and select the //Flow Control// > //Else// Command.
197
198 {{aagon.infobox}}
199 Indent this Command, either using the quick selection bar or the shortcut CTRL + left arrow key, so that it appears on the same level as //If ... Then //Command.
200 {{/aagon.infobox}}
201
202 2. Open the Command by double clicking it.
203 3. Optional: Add a comment in case the Else block should be executed.
204 4. Click //OK//.
205
206 {{figure}}
207 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen_Else_476.png||data-xwiki-image-style-alignment="center"]]
208
209 {{figureCaption}}
210 Else Command
211 {{/figureCaption}}
212 {{/figure}}
213
214 == Inserting and editing an //Exit script //Command ==
215
216 1. Select //Flow Control// > //Exit script// from the Command List.
217 1. Insert the block below the Else Command so that it is indented.
218 1. Double click on the Command to open it.
219 1. Select the //OK// condition in the //Details// tab. This will mark the script as successful.
220
221 {{aagon.infobox}}
222 If the script fails at this point, you will need to select //Error// from the drop down menu.
223 {{/aagon.infobox}}
224
225 5. Enter a reason why the Client Commands were successful.
226 6. Click //OK// to close the Command.
227
228 {{figure}}
229 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen_Skript beenden_484.png||data-xwiki-image-style-alignment="center"]]
230
231 {{figureCaption}}
232 Exit Script
233 {{/figureCaption}}
234 {{/figure}}
235
236 Your Client Script should now consist of a total of seven blocks. Save the Client Command.
237
238 {{figure}}
239 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen.png||data-xwiki-image-style-alignment="center"]]
240
241 {{figureCaption}}
242 Client Command Editor: Checking for running processes
243 {{/figureCaption}}
244 {{/figure}}
245
246 == Running the Client Command through the phases ==
247
248 Finally, the client command must be run through the [[Test>>doc:ACMP.69.ACMP-Solutions.Desktop Automation.Client Commands.Client Command testen.WebHome]], [[Synchronise>>doc:ACMP.69.ACMP-Solutions.Desktop Automation.Client Commands.Client Command synchronisieren.WebHome]], [[Release>>doc:ACMP.69.ACMP-Solutions.Desktop Automation.Client Commands.Client Command freigeben.WebHome]] and [[Execute>>doc:ACMP.69.ACMP-Solutions.Desktop Automation.Client Commands.Client Command ausführen.WebHome]] phases before it can be used. This is the only way to check whether a particular program or process is actively running on a Client.
249
250
© Aagon GmbH 2025
Besuchen Sie unsere Aagon-Community