Indianrock (8/24/2013)
Saving to files with timestamp in the name. The request was to keep error log entries ( other than backup/logon messages ) for a year. I could use the xp_ReadErrorLog approach to write to a table, but thought I'd try powershell.
Although there are certainly some great benefits to using PowerShell for certain things, I tend to stay within the confines of SQL Server if it can be done there. A lot of people will disagree with it but I have several WMI "collectors" of data written in PowerShell that I call from T-SQL using xp_CmdShell. People will also disagree with this just because I use xp_CmdShell but we have the system very well locked down and we have no under-privileged users that have been proxied out to use it directly.
--Jeff Moden
Change is inevitable... Change for the better is not.