August 23, 2013 at 6:05 pm
There is a very handy cmdlet called Get-sqlerrorlog that I'd like to use but everyone is very strict about installing anything on a production sql server. I want to use it to save off the sql error logs ( specific entries ). I wish there was a way to "embed" the function in the powershell sql agent job so it wasn't dependent on something installed on the server.
August 24, 2013 at 5:03 pm
Where are you trying to "save off the SQL Error logs" to? A table or a file?
--Jeff Moden
Change is inevitable... Change for the better is not.
August 24, 2013 at 5:08 pm
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.
August 25, 2013 at 2:23 pm
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.
August 26, 2013 at 12:47 am
Just a comment, you are not installing anything. it is a open source library, you can check the code and it is only copy and paste the modules It is not intrusive.. It is the same that you copy the code and create your Get-SQLErrorLogMine and paste the code in there and say "I did it. Lets try it and publish in production if it is ok". (not correct to do that of ocurse, but just to exemplify that it is not like you install an application or something like that)
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply