Hi All,
With this 'BIG' script I'm writing - I'd like to be able to schedule the script to run, log the output to a file and then email the file to the Admin at the end.
At the moment I've been able to run the script manually - sending data out of the Std-out with 'write-host'. However - how am I best to write to a log file??
Can I just write-host "test test" > logfile.log?? - if so - how can I append consistently to this log.
And Once I have it - how can I grab the contents in as a string to send as email??
I've done elements like this in the past with VB6 (I know, I know - thats just how old I am!). Creating a log object - init-ing the object creates the log, sending a method of "Add Entry" with the Text to add and the Object then writes with the current date/time followed by the string etc. Is this sort of Obj Orientated code possible here?? Would be nice and easy to port the Logging object/functions between scripts if called as a remote function (see answers from Hal and Luc in my previous post).
Thanks, as always, in anticipation.
TG