File String Change

Hi Team,

I am trying to replace the string in .INI file with below method, action successfully completed and string been changed. But File permission revoked, all user revoke only administrator kept the same.

// Enter your action script here

// Enter your action script here
delete __appendfile
parameter “filename” = “D:\IBM\ITM\TMAITM6_x64\KNTCMA.INI”
action parameter query “backup_date” with description “Please specify the date backup for KNTCMA.INI” with default date “9999”

appendfile {concatenation “%0d%0a” of ( if (it starts with “KDC_FAMILIES=@Protocol@”) then (“KDC_FAMILIES=IP.SPIPE EPHEMERAL:Y HTTP_CONSOLE:N HTTP_SERVER:N PORT:3660 IP use:n SNA use:n IP.PIPE use:n”) else it as string) of lines of file (parameter “filename”)}

// backup the old file KNTCMA.INI
move “{parameter “filename”}” “{parameter “filename”}_{parameter “backup_date”}”

// replace with the new file
move __appendfile “{parameter “filename”}”

//Restart ITM OS Agent service
delete __appendfile
if {name of operating system starts with “Win”}
delete __appendfile
appendfile net stop KNTCMA_Primary
appendfile net start KNTCMA_Primary
delete restartRelay.bat
move __appendfile KNTCMA_Primary.bat
waithidden KNTCMA_Primary.bat
delete KNTCMA_Primary.bat

Afraid I haven’t time for a long response so here’s a short one.

Use ‘copy’ instead of ‘move’

Thanks Jason, Can you suggest me the modification on which line number.

Well your printout doesn’t have line numbers. But all the ‘move’ statements could be ‘copy’ instead.


Hi Jason, Tested with the same. Still permissions revoked, any other method.

Hi Jason, I break this code of section and seems strange.

BigFix copy command, unable to preserve the file permission:

// Enter your action script here

action parameter query “File_Name_Full_Path” with description "Please specify the file and full path"
action parameter query “Backup_Date” with description “Please specify the date backup for KNTCMA.INI” with default date “9999”
// backup the old file KNTCMA.INI
copy “{parameter “File_Name_Full_Path”}” “{parameter “File_Name_Full_Path”}_{parameter “Backup_Date”}”

“move” retains the permissions on the original file. Since you are creating the file under __BESData the permissions are for Administrators only.

“Copy” creates a new copy of the file, and it inherits whatever permission is defined for files on the target directory.

If the file needs some special custom permissions that is not the default for new files on the target directory, you’d need to reapply you special permissions after creating the new file. You can do that with cacls.exe or icacls.exe or a number of other Windows command line utilities.