Generally the way to do this type of activity is to create an action that reads the lines of the files, changes the appropriate line(s) and then re-write the files… for a particularly complicated example, see here: http://forum.bigfix.com/viewtopic.php?id=1483
Here is my shot at an action that would do this… I didn’t test it at all so be careful and test well:
// store the file location
parameter “filename” = “C:\Program Files\Cisco Systems\VPN Client\PROFILES\USA primary.pcf”
// iterate through the file replacing lines as necessary
appendfile {concatenation “%0d%0a” of ( if (it starts with “Username=”) then (preceding text of first “Username=” of it) & “Username=” & (name of current user) else it ) 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”}”
Thanks for the reply. I had looked at the more complicated example before making my post and I couldn’t figure out how to modify it for my own use. One other question. Can I substitute
(name of current user)
with
(if exists current user then name of current user else ((value “DefaultUserName” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon” of registry) as string))