Hoping someone can help me out with this quick little problem
I'm trying to add text to the end of a text file using a kaseya procedure.It works great except that the text gets added right onto the end of the last character of the text document.I've looked into it and have created a c sharp script that does this but I don't like to have seperate files which I need to rely on. I like to have everything contained in the one kaseya script if possible, avoiding copying files etc. Especially when its such a small thing like a new line, which is holding me back.Is there a way to have the added text appear on a new line without using external vb, c# or ps script files?
I just spent some time trying to figure it out using the existing Write text to file procedure but didn't have any luck.
How about echo.>>>>"c:\path\yourfile.txt" ?
There is a couple of ways you can do it, firstly you can look up the hidden Carriage Return characters as I believe they work alternatively you can use the following method...
Write what you need to a Text file and upload it to the Kaseya server, in your procedure write this text file to the machine then use GET VARIABLE, FILE CONTENT and lets call is say TEXT, then in another step use...
Providing you have the layout and information required in the text file already then this will keep the formatting.
This allows me to make reports like the following...
* Parachute IT, Spybot Search & Destroy, Update, Check & Fix Log.
* UPDATE LOG START
19/03/2012 20:59:22 Downloaded update info file. (http://www.safer-networking.org/updates/spybotsd.ini)
* UPDATE LOG END
* CHECK LOG START
19.03.2012 21:00:10 - ##### check started #####
19.03.2012 21:00:10 - ### Version: 1.6.2
19.03.2012 21:00:10 - ### Date: 19/03/2012 21:00:10
19.03.2012 21:00:17 - ##### checking bots #####
19.03.2012 21:17:52 - found: DoubleClick Tracking cookie (Chrome: Chrome)
19.03.2012 21:17:52 - ##### check finished #####
* CHECK LOG END
* FIX LOG START
--- Report generated: 2012-03-19 21:17 ---
DoubleClick: Tracking cookie (Chrome: Chrome) (Cookie, fixed)
--- Spybot - Search & Destroy version: 1.6.2 (build: 20090126) ---
* FIX LOG END
* Script Author: Stuart Hamilton
Though to accomplish the above I need 5x text files containing the layout so I would write...
1. Text file 1 containing header...
2. Spybot Update Log...
3. Text file 2 containing next formatting...
4. Spybot Check Log...
5. Text file 3 containing next formatting...
6. Spybot Fix Log...
7. Text file with final footer etc.
Granted this is long and drawn out but it does accomplish the task.
Thanks Ben. This trick worked for me.