Script is failing

Hi there,

trying to run the following but it seems to only perform the first part and then fails on the other two parts of renaming the files. I also have three paths where these files exist. Is there a way to look in the path and perform the steps in C:\IBM\WIncollect, or C:\Program Files (x86)\IBM\WinCollect\ or C:\Program Files\IBM\WinCollect\

waithidden net stop WinCollect
parameter “filename” = "C:\IBM\Wincollect\Config\Console.PEM"
move “{parameter “filename”}” “{parameter “filename”}.bak”

parameter “filename” = "C:\IBM\Wincollect\logs\Wincollect_System.log"
move “{parameter “filename”}” “{parameter “filename”}.old”

parameter “filename” = "C:\IBM\Wincollect\logs\Wincollect_Code.log"
move “{parameter “filename”}” "{parameter “filename”}.tmp"
waithidden net start Wincollect

Thanks

Nanosn,

I believe your issue here is that parameters cannot be set twice within an action. See: ftp://public.dhe.ibm.com/software/tivoli/IEM/9.2/Platform/Action_Guide.pdf

You can’t reset a parameter that already has a value. When this occurs, the client
will abort the action at the line that is attempting to reset the parameter. Any
errors that result from evaluating the expression will be handled by making the
named parameter become undefined.

Youll want to use a different parameter name each time (not just “filename”)

1 Like

Also note that if you MOVE a file in BigFix and the “destination” file is all ready there, that action will fail. In your example above

waithidden net stop WinCollect
parameter “filename” = "C:\IBM\Wincollect\Config\Console.PEM"
move “{parameter “filename”}” "{parameter “filename”}.bak

Would work the FIRST time because “filename.bak” does not exist. Then next time you run this, filename.bak will be present and your MOVE will fail. So…

waithidden net stop WinCollect
parameter “filename” = "C:\IBM\Wincollect\Config\Console.PEM"
delete "{parameter “filename”}.bak <-- delete this, if it does NOT exist, no error is thrown
move “{parameter “filename”}” "{parameter “filename”}.bak

1 Like