Download , Copy and Recurse File for Automatic Groups

(imported topic written by mbp911)

I am trying to create a task that will download a file, copy it to a folder and read the file for the existance of the machine name and then create a registry key based on its finding.

I have had success within the fixlet debugger, but the deployment of the task will give me a Relevance substitution error in the client log and the task will show a “Invalid action content: the action script contains a syntax error” error. However, if I split the task into 2 different actions, it is successful. 1 Task

download and copy

, 2 Task

Recurse and Set Key

.

Orginally I thought maybe it was a timing issue and placed a “pause while not exist file”, but that proved unsuccessful as well. I am about ready to lose my mind with this very simple task and seek some help. Any insight is appreciated.

Action Script

download http://Servername:52311/Uploads/STORES/Packages/Tiers/nordictiers.txt

//Create Packages Folder

if {not exists folder “c:\packages”}

waithidden cmd.exe /C mkdir c:\packages

else

endif

//copy file

copy “__Download\nordictiers.txt” “C:\packages\nordictiers.txt”

//determine if machine is in file and assign tier

if{(exists preceding texts of firsts “,” of lines whose (it contains hostname as lowercase) of file “C:\packages\nordictiers.txt”)}

parameter “TR” = “{(following text of first “-” of following texts of firsts “,” of lines whose (it contains hostname as lowercase) of file “C:\packages\nordictiers.txt”)}”

regset "

HKEY_LOCAL_MACHINE\Software\BigFix\Patch

" “Tier”="{(parameter “TR” of action)}"

else

regset "

HKEY_LOCAL_MACHINE\Software\BigFix\Patch

" “Tier”=“5”

endif

nordictier.txt File format

pc123,Tier-1

pc456,Tier-2

(imported comment written by SystemAdmin)

I am not sure why this doesn’t work either…

The actionscript looks good. I ran it on my Action Debugger and it behaved as expected. Does it run any lines of the action at all on the client, or just fails outright?

One theory is that the action had some hidden invalid high or low bit character, which might be displayed as a space. This happens to me in a projects at about once a year.

(imported comment written by mbp911)

It fails on the following line

if{(exists preceding texts of firsts “,” of lines whose (it contains hostname as lowercase) of file “C:\packages\nordictiers.txt”)}

When I check the directory for the file on the client, it does not exists, and so I would expect this. However, when i break this action out no problem. It’s as if the action is trying to proceed before the copy executes. That is why I attempted to insert a pause while command but to no avail.

(imported comment written by mbp911)

I have found that adding a conditional if file exists statement after the copy file statement seems to have corrected the problem. This is bothersome as it appears there is some timing issues within the processing of actions that contain a move or copy command that have dependent actions on the existance of the file.