Write a value into existing INI file

Solved

Hi,

does anyone know a way/script to write into an existing ini file?

I tried several things regarding javascript but i'm not familar with javascript, so i don't know where the Problem is.

The file is located in the /sdcard/ folder and we are working with 15.5.1 and the latest agent versions.

3 years ago
Android Scripting
ANSWERS
RS
Rafael Schäfer
3 years ago

Got it now:

var ini = require('ini');
var iniFile = new mobicontrol.io.File('/path/Ininame.ini');
var config = ini.parse(iniFile.readText());
config.Sectionname= { Keyname: 'Value' };
iniFile.writeText(ini.stringify(config));
mobicontrol.agent.checkIn();
Solution
D
DJMOD@SOTI
3 years ago

Hi Rafael,

Thanks for requesting a response from SOTI Support Staff, Also thank you very much for sharing the resolution for the issue, It will definitely help other customers with similar issue.