Loop Capability in Fixlets?

(imported topic written by rkneal91)

I’m trying to decide if it’s best to do something using Fixlet action script or by writing a vbs or batch file using the Fixlet scripting then just running this batch file

what i am trying to do is this

every 15 minutes we want to

  1. get all the files from c:\log*.log

  2. use the {computer id} and {computer name} to prefix each file so know what endpoint logs are coming from

example: 1029432-DROPXXX-Logfilename

  1. write a batch file with sftp “put” commands to send the files back to the BES server to a specific directory

having trouble finding ability to do any looping or for loop once we get all the files from the c:\log directory.

in a dos script i could do this to create my sftp script file with one command

for /f %%a IN (‘dir /b c:\log*.log’) do echo put %%a computerid-computername.%%a >>run.bat

then run the batch file with winscp and use the -speed command to limit the bandwidth

in bigfix can use the DOS command and do the same thing, but not sure how to pass it the computerid and computername parameters.

is there any looping or for loops in fixlets? or since i’m going to have to run a batch file anyway with sftp commands, should i just do it using dos or vbs script then just run it.

the upload archive manager was given as hint to use in another post we did, but we are going to have to do more things than just send these files (kickoff backups, change management, pull down script files from BES server, etc) so thought would be best to use winscp with controlled bandwidth and controlled firewall ports (port 22) then to use the upload manager.

maybe i am over thinking this and there is easier way.

thanks

(imported comment written by NoahSalzman)

There are a whole bunch of ways to do this. The simplest is probably to put your FOR command in an Action Script and use Relevance to substitute the variables.

waithidden cmd.exe /C for /f %a IN ('dir /b c:\log\*.log') do echo put %a {"computerid" & "-" & computer name}.%a >> run.bat

Related example:

http://forum.bigfix.com/viewtopic.php?pid=11957#p11957

I’m not sure what you want for Computer ID, so you would need to drop some Relevance in that spot otherwise you will get the text string “comptuerid” in each line of your batch file.