using Sqlpsx functions on a production sql box

  • 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.

    http://sqlpsx.codeplex.com/releases/view/25394

  • Where are you trying to "save off the SQL Error logs" to? A table or a file?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • 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.

  • 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


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • 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)

    $hell your Experience !!![/url]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply