How do you tie a Relevance to a specific action?

(imported topic written by Rocachino)

Hi. I have not been formally trained on the product so excuse my ignorance on the subject and/or the coding. I’ve just been given a task to create a fixlet which will do the following:

  1. Verify OS is NT,Win2k or WinXP Workstation only.

  2. Verify the existence of a file

a. If Found

i. Verify it’s the correct version

  1. Version Matches

a. Run File

  1. Version Doesn’t Match

a. Download it

b. Run File

b. If Not Found

i. download it

ii. Run File

This is what I have so far:

Relevance:

  1. ((name of operating system = “Win2000” OR name of operating system = “WinXP” OR name of operating system = “Win2003”) AND (value “ProductType” of key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions” of registry = “WinNT”))

  2. (if (exists file ("{pathname of system folder}\temp\App.exe")) then (version of file ("{pathname of system folder}\temp\App.exe") as string) else (“0.00.0.0”)) < (version of file ("\Server\share\App.exe"))

Action:

  1. copy ("\Server\share\App.exe” “{pathname of system folder}\temp\App.exe”

  2. wait "{pathname of system folder}\temp\App.exe

Q: How do you tie a Relevance to a specific action? Is there a better method or am I completely lost on how this works? :slight_smile:

Thanks

(imported comment written by BenKus)

Hey Rocachino,

First, the network shares present a problem here for two reasons:

  1. The BES Client runs as SYSTEM account and will only have access to Null Sesssion Shares.

  2. If you query network files in relevance, you will cause quite a lot of load on your file servers because the BES agents will periodically check these files. If your deployment is large, this can be quite a lot of traffic (and if I am not mistaken, you are working with a very large deployment of over 100,000 computers? If so, you definitely want to be careful about the network shares.)

Also, the “{}” syntax is only necessary if you are trying to embed relevance in actions. It is not necessary in the regular relevance.

So to adjust your code:

Relevance:

((name of operating system = “Win2000” OR name of operating system = “WinXP” OR name of operating system = “Win2003”) AND (value “ProductType” of key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions” of registry = “WinNT”))

Since your Fixlet should be relevant on all computers (with the right OS), you can remove the specific relevant and your action will deal with the different possibilities using the “IF” syntax (which only works with BES 6.0+ Clients).

Action:

IF {(not exists file “App.exe” of folder “temp” of system folder) OR (version of file “App.exe” of folder “temp” of system folder != “x.x.x.x”)}
download http://someserver/app.exe
copy “__download\App.exe” "{pathname of system folder}\temp\App.exe"
ENDIF

wait “{pathname of system folder}\temp\App.exe”

Notice that I changed the copy from the share to a download command from a server. This is a much better practice and it solves the problems I mentioned above. You must also put the specific version “x.x.x.x” into the action. If this file changes, you will need to update the file.

Hope that helps,

Ben

(imported comment written by Rocachino)

Excellent! Thank you.

(imported comment written by Rocachino)

You mentioned the “IF” syntax only works with BES 6.0+ Clients. Is there a solution for previous versions of the client? 6.0 has not been fully deployed in our environment.

Thanks

(imported comment written by jessewk)

In 5.1, you can fake an if with relevance substitution. You cannot do relevance substituion for the action command, but you can do relevance substitution in the action command

arguments

. You could build a script that does nothing except run and then quit and build it with appendfile. Then add a ‘wait’ command and use relevance substitution to selectively run either your script that does nothing or your command that does something. Here’s a pseudo action example that will stop some services if the script to do so exists:

download …
continue if …
appendfile
move __appendfile DoNothing.cmd
wait {if (exists file “ShutdownServices.cmd” of windows folder) then pathname of file “ShutdownServices.cmd -commandlineargs” of system folder else pathname of client folder of site “BESSupport” & “\RunQuiet.exe DoNothing.cmd”}