(imported topic written by BenKus)
Hi everybody,
We recently were helping a customer with changing an ini file in a Fixlet and I thought I would share with you all what we found:
There is a nifty ini manipulation tool at: http://home.mnet-online.de/horst.muc/wbat32.htm#inifile that will help out a lot. But BigFix cannot redistribute this file (we asked but they said no) so you will need to download the zip file and place it on your server in the wwwrootbes subfolder of your BES Server directory (or on any other webserver).
Here is how you might use it… Imagine that you wanted to change a file “C:test.ini”… Make a new Fixlet:
Relevance:
exists file “C:\test.ini”
(alternate relevance to check to see if the values set in the action exist or not):
(exists file “C:\test.ini”) AND ((key “NewItem” of section “TestSection” of file “C:\test.ini” != “some relevance3”) OR (key “ItemNeedingChanging” of section “TestSection” of file “C:\test.ini” != “ChangedValue”) OR (exists key “ItemNeedingDeleting” of section “TestSection” of file “C:\test.ini”) OR (exists section “TestSectionToRemove” of file “C:\test.ini”))
Action:
// download the ini tool (assumes it has been put locally on the BES Server in the wwwrootbes folder… change the download link as necessary
prefetch inifile.exe sha1:c55da2e08037b234d58a419c4117f3640898b3c5 size:9216 http://127.0.0.1:52311/download/temp/inifile.exe
// store the file locally as a “utility” so the agent doesn’t need to re-download it every time it runs the application
utility __download\inifile.exe
// Run ini files commands:
// add an item/value (for example, set a relevance expression)
wait __download\inifile.exe “C:\test.ini” TestSection NewItem={“some relevance” & (1+2) as string}
// change a value
wait __download\inifile.exe “C:\test.ini” TestSection ItemNeedingChanging=ChangedValue
// delete an item
wait __download\inifile.exe “C:\test.ini” TestSection ItemNeedingDeleting=
// clear an item
wait __download\inifile.exe “C:\test.ini” TestSection ItemNeedingClearing==
// remove a section
wait __download\inifile.exe “C:\test.ini” TestSectionToRemove /remove
WARNING: I never tested this. Please test yourself and let me know what you find…
Hope that helps someone.
Ben