Last modified by Jannis Klein on 2024/08/13 08:19

Hide last authors
Jannis Klein 1.1 1 {{aagon.priorisierung}}
2 160
3 {{/aagon.priorisierung}}
4
5 {{aagon.floatingbox/}}
6
Sabrina V. 2.1 7 = Initial situation =
Jannis Klein 1.1 8
Sabrina V. 2.1 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.
Jannis Klein 1.1 10
Sabrina V. 2.1 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.
Jannis Klein 1.1 12
Sabrina V. 2.1 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.
Jannis Klein 1.1 14
Sabrina V. 2.1 15 = Checking for running programs and processes =
Jannis Klein 1.1 16
Sabrina V. 2.1 17 == Select a Script ==
Jannis Klein 1.1 18
Sabrina V. 2.1 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.
Jannis Klein 1.1 21
Sabrina V. 2.1 22 == Setting and editing a Command //Set project variable// ==
Jannis Klein 1.1 23
Sabrina V. 2.1 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.
Jannis Klein 1.1 30
31 {{aagon.infobox}}
Sabrina V. 2.1 32 This step is optional if you have not already created the variable.
Jannis Klein 1.1 33 {{/aagon.infobox}}
34
Sabrina V. 2.1 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//.
Jannis Klein 1.1 37
38 {{figure}}
39 (% style="text-align:center" %)
40 [[image:65_Use Case Client Command_Auf laufende Prozesse Variableneinstellungen vornehmen.png]]
41
42 {{figureCaption}}
Sabrina V. 2.1 43 Making variable settings
Jannis Klein 1.1 44 {{/figureCaption}}
45 {{/figure}}
46
Sabrina V. 2.1 47 == Set and edit Command //Set project variable// ==
Jannis Klein 1.1 48
Sabrina V. 2.1 49 1. Select the //Set project variable// Command again.
50 1. Double click the Command and open the //General// tab.
51 1. Enter the name in the description field, e.g. Set project variable //SOFTWARE_EXE to „firefox.exe“//.
52 1. Switch to the //Details// tab.
53 1. Optional: Create a new variable under //Actions//. Name it "SOFTWARE_EXE" and click the plus icon. Click //OK //to complete this step.
Jannis Klein 1.1 54
55 {{aagon.infobox}}
Sabrina V. 2.1 56 This step is optional if you have not already created the variable.
Jannis Klein 1.1 57 {{/aagon.infobox}}
58
Sabrina V. 2.1 59 6. Enter the process name in the Single line text box.
Jannis Klein 1.1 60
61 {{aagon.infobox}}
Sabrina V. 2.1 62 You can query the name of the process using Task Manager by opening the running processes and displaying the name on the //Details// tab.
Jannis Klein 1.1 63 {{/aagon.infobox}}
64
Sabrina V. 2.1 65 Enter the text „firefox.exe“.
66 7. Click //OK//.
Jannis Klein 1.1 67
68 {{figure}}
69 (% style="text-align:center" %)
70 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen_Variableneinstellungen vornehmen.png]]
71
72 {{figureCaption}}
Sabrina V. 2.1 73 Setting variables
Jannis Klein 1.1 74 {{/figureCaption}}
75 {{/figure}}
76
77 {{aagon.warnungsbox}}
Sabrina V. 2.1 78 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.
Jannis Klein 1.1 79 {{/aagon.warnungsbox}}
80
Sabrina V. 2.1 81 == Insert and customise //Get process ID// Command ==
Jannis Klein 1.1 82
Sabrina V. 2.1 83 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.
Jannis Klein 1.1 84
Sabrina V. 2.1 85 1. Select the //Process and Shell// > //Get Process ID// Command.
86 1. Double click to open the Command.
87 1. Under //Process / Target variable//, enable the //... with process// option by clicking the button.
88 1. Insert the appropriate variable ~(%SOFTWARE_EXE%). This variable is used to check that Mozilla Firefox is running.
Jannis Klein 1.1 89
90 {{aagon.warnungsbox}}
Sabrina V. 2.1 91 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.
Jannis Klein 1.1 92 {{/aagon.warnungsbox}}
93
94 {{aagon.infobox}}
Sabrina V. 2.1 95 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.
Jannis Klein 1.1 96 {{/aagon.infobox}}
97
Sabrina V. 2.1 98 5. Under //Save results in//, click on the icon to the right of the variable name.
99 6. Open Project Variables from the drop down menu at the top.
100 7. Enter the name "CHECK_EXE" under the actions and click on the plus icon.
101 Click //OK// to complete this step.
Jannis Klein 1.1 102
103 {{figure}}
104 (% style="text-align:center" %)
105 [[image:65_Use Case Client Commands_Variable auswählen.png]]
106
107 {{figureCaption}}
Sabrina V. 2.1 108 Select variable
Jannis Klein 1.1 109 {{/figureCaption}}
110 {{/figure}}
111
112 {{aagon.infobox}}
Sabrina V. 2.1 113 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.
Jannis Klein 1.1 114 {{/aagon.infobox}}
115
Sabrina V. 2.1 116 8. The result will be stored in the CHECK_EXE variable.
117 9. Then click //OK//.
Jannis Klein 1.1 118
119 {{figure}}
120 (% style="text-align:center" %)
121 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen Get process ID_484.png]]
122
123 {{figureCaption}}
124 Get process ID
125 {{/figureCaption}}
126 {{/figure}}
127
Sabrina V. 2.1 128 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.
Jannis Klein 1.1 129
Sabrina V. 2.1 130 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.
Jannis Klein 1.1 131
132 {{aagon.warnungsbox}}
Sabrina V. 2.1 133 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.
Jannis Klein 1.1 134 {{/aagon.warnungsbox}}
135
136 {{figure}}
137 (% style="text-align:center" %)
138 [[image:65_Use Case_Client Commands_Auf laufende Prozesse überprüfen_Durchlauf des CCs_1275.png]]
139
140 {{figureCaption}}
Sabrina V. 2.1 141 Running the client commands to check for running processes
Jannis Klein 1.1 142 {{/figureCaption}}
143 {{/figure}}
144
Sabrina V. 2.1 145 == Command //If ... Then// insert and customise ==
Jannis Klein 1.1 146
Sabrina V. 2.1 147 1. In the Command List, select the //Flow Control// > //If ...// Command.
148 1. Double click on the Command to open it and switch to the //General// tab.
149 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.
150 1. Switch to the //Details// tab.
151 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.
152 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.
153 1. Insert the number 0 as value 2. This is the value used as the condition for the operator.
154 1. Click //OK// to complete the Command.
Jannis Klein 1.1 155
156 {{figure}}
157 (% style="text-align:center" %)
158 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen If ... then.png||alt="65_Use Case Client Commands_Variable auswählen.png"]]
159
160 {{figureCaption}}
161 If ... Then Command
162 {{/figureCaption}}
163 {{/figure}}
164
Sabrina V. 2.1 165 If the process is running, the row is completed as the condition is met. If the process is not running, the line is skipped.
Jannis Klein 1.1 166
Sabrina V. 2.1 167 == Optional: Set and edit Command //Dialogs// ==
Jannis Klein 1.1 168
Sabrina V. 2.1 169 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.
Jannis Klein 1.1 170
Sabrina V. 2.1 171 1. Select the //Dialogs// > //Dialogs// Command from the Command List.
172 1. Open the Command by double clicking on it and open the //Message Settings// tab.
173 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%//.
174 1. Insert the message for the Clients to be displayed when the program is still open.
Jannis Klein 1.1 175
176 {{aagon.infobox}}
Sabrina V. 2.1 177 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.
178
179 This will use the logged-in user name as the salutation.
Jannis Klein 1.1 180 {{/aagon.infobox}}
181
Sabrina V. 2.1 182 Optional: Change the //message type// and/or available buttons and custom captions.
Jannis Klein 1.1 183
184 {{aagon.infobox}}
Sabrina V. 2.1 185 If you want to see the message text before completing the command, you can do this by clicking the //Preview// button.
Jannis Klein 1.1 186 {{/aagon.infobox}}
187
Sabrina V. 2.1 188 5. Click //OK//.
Jannis Klein 1.1 189
190 {{figure}}
191 (% style="text-align:center" %)
192 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen Dialog eingeben.png]]
193
194 {{figureCaption}}
Sabrina V. 2.1 195 Enter a dialog
Jannis Klein 1.1 196 {{/figureCaption}}
197 {{/figure}}
198
Sabrina V. 2.1 199 == Inserting and customising the //Else //Command ==
Jannis Klein 1.1 200
Sabrina V. 2.1 201 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.
Jannis Klein 1.1 202
Sabrina V. 2.1 203 1. Navigate back to the Command List and select the //Flow Control// > //Else// Command.
Jannis Klein 1.1 204
205 {{aagon.infobox}}
Sabrina V. 2.1 206 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.
Jannis Klein 1.1 207 {{/aagon.infobox}}
208
Sabrina V. 2.1 209 2. Open the Command by double clicking it.
210 3. Optional: Add a comment in case the Else block should be executed.
211 4. Click //OK//.
Jannis Klein 1.1 212
213 {{figure}}
214 (% style="text-align:center" %)
215 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen_Else_476.png]]
216
217 {{figureCaption}}
Sabrina V. 2.1 218 Else Command
Jannis Klein 1.1 219 {{/figureCaption}}
220 {{/figure}}
221
Sabrina V. 2.1 222 == Inserting and editing an //Exit script //Command ==
Jannis Klein 1.1 223
Sabrina V. 2.1 224 1. Select //Flow Control// > //Exit script// from the Command List.
225 1. Insert the block below the Else Command so that it is indented.
226 1. Double click on the Command to open it.
227 1. Select the //OK// condition in the //Details// tab. This will mark the script as successful.
Jannis Klein 1.1 228
229 {{aagon.infobox}}
Sabrina V. 2.1 230 If the script fails at this point, you will need to select //Error// from the drop down menu.
Jannis Klein 1.1 231 {{/aagon.infobox}}
232
Sabrina V. 2.1 233 5. Enter a reason why the Client Commands were successful.
234 6. Click //OK// to close the Command.
Jannis Klein 1.1 235
236 {{figure}}
237 (% style="text-align:center" %)
238 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen_Skript beenden_484.png]]
239
240 {{figureCaption}}
Sabrina V. 2.1 241 Exit Script
Jannis Klein 1.1 242 {{/figureCaption}}
243 {{/figure}}
244
Sabrina V. 2.1 245 Your Client Script should now consist of a total of seven blocks. Save the Client Command.
Jannis Klein 1.1 246
247 {{figure}}
248 (% style="text-align:center" %)
249 [[image:65_Use Case Client Commands_Auf laufende Prozesse überprüfen.png]]
250
251 {{figureCaption}}
Sabrina V. 2.1 252 Client Command Editor: Checking for running processes
Jannis Klein 1.1 253 {{/figureCaption}}
254 {{/figure}}
255
Sabrina V. 2.1 256 == Running the Client Command through the phases ==
Jannis Klein 1.1 257
Sabrina V. 2.1 258 Finally, the client command must be run through the [[Test>>doc:ACMP.65.ACMP-Solutions.Client Commands.Client Command testen.WebHome]], [[Synchronise>>doc:ACMP.65.ACMP-Solutions.Client Commands.Client Command synchronisieren.WebHome]], [[Release>>doc:ACMP.65.ACMP-Solutions.Client Commands.Client Command freigeben.WebHome]] and [[Execute>>doc:ACMP.65.ACMP-Solutions.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.
© Aagon GmbH 2025
Besuchen Sie unsere neue Aagon-Community