Problem editing a text file

(imported topic written by B7TN_Pete_Ladesic)

Guys,

Ive pulled some ideas off here to edit a line within a text file but after the task completes i some how lose access to the file and cannot verify if it was changed. I could use some help on this one. Ill post my details below…

Thanks in advance for your help!

within the file “C:\WINDOWS\entrust.ini” i want to change the following line from

RoamSearchBase=ou=people,ou=headquarters,ou=do,o=u.s.

to

RoamSearchBase=ou=do,o=u.s.

// store the file location

parameter “filename” = “C:\WINDOWS\entrust.ini”

// iterate through the file replacing lines as necessary

appendfile {concatenation “%0d%0a” of ( if (it starts with “RoamSearchBase”) then "RoamSearchBase=ou=do,o=u.s. " else it as string) of lines of file (parameter “filename”)}

// backup the old file (first delete any old backup files)

delete “{parameter “filename”}.bak”

move “{parameter “filename”}” “{parameter “filename”}.bak”

// replace with the new file

move __appendfile “{parameter “filename”}”

(imported comment written by jessewk)

I don’t understand what you mean by “i lose access to the file”. Does the file not get created?

Everything looks ok to me.

(imported comment written by B7TN_Pete_Ladesic)

FYI

After logging in with admin rights i can view the file and see that it was successfully changed. However, i am still faced with the problem that under my non priveledged account the file is now unuseable by the application (Entrust). Why would i lose access to the file after a bigfix task was run on it?

Thanks again

(imported comment written by jessewk)

You didn’t actually edit the file. Instead, you created a new file and moved the old one. Since the client runs in the SYSTEM context any new files it writes out will have corresponding permissions and non-privileged accounts won’t have access.

You’ll need to change the permissions on the file after you write it out. Here are some ideas/examples how you can do that: http://forum.bigfix.com/viewtopic.php?id=820

Jesse

(imported comment written by B7TN_Pete_Ladesic)

Thanks!!! After applying the new ACL to the file its working great.