Action script to create a client setting

Hi all.
I am trying to create a task with type of action script which:
running cmd command to find the version of installed redis server and output the value to a file.
then, use the if statement to check if the created file contains any lines and then,
create a new client setting with the content of the output file.
I am struggling with the creation of the setting as it does not being created.

Take a look at the action script-

action uses wow64 redirection false
wait “C:\Windows\system32\cmd.exe” /c “c:\redis\redis-server.exe --version > c:\redis-version.txt”
if{exists lines whose (it contains “Redis server”) of file “c:\redis-version.txt”}
setting “Redis Version”=“line of file “c:\redis-version.txt”” on “{now}” for client
endif

delete “c:\redis-version.txt”

I think you are only interested in the version of the stated application, and if so, is there no method to check it without running a command? such as the version of the executable, the registry path, the file containing version information, and so on, if you can find such way you can avoid the whole exercise you are doing & simply create RP based on detection criteria.

And if command execution is the only means to acquire the version, you do not need to specify the client option; instead, use the Retrieved Property to fetch the version from the file directly from the console.

if not windows of operating system then "N/A" else if exists file "c:\redis-version.txt" AND size of file "c:\redis-version.txt" != 0 then lines of file "c:\redis-version.txt" as string else "None"

However, if you still want to go with client setting then try changing the following:

setting "Redis Version"="{lines of file "c:\redis-version.txt"}" on "{now}" for client

3 Likes

Thanks alot for your fast reply.
The check is available only by running the command line.
The action script is now working with your advice for the setting line.

the script looks like this:

action uses wow64 redirection false
wait “C:\Windows\system32\cmd.exe” /c “c:\redis\redis-server.exe --version > c:\redis-version.txt” if{exists lines whose (it contains “Redis server”) of file “c:\redis-version.txt”}
setting “Redis Version”=“{lines of file “c:\redis-version.txt”}” on “{now}” for client
endif
delete “c:\redis-version.txt”

Thansk again

2 Likes