Powershell scripts to take SQL SERVER HEALTH CHECK

  • Hi all,

    I am new to DBA.

    I need a sql server powershell scripts to take the health check and mail through the database mail.

    Disk space and last backup status.

    CPU Utilization.

    RAM Utilization

    Blocking details

    Deadlock details

    SQL Server Wait types

    Top Queries

    a. By CPU

    b. By Duration

    c. By I/O

    Index information

    a. Index fragmentation

    b. Missing indexes

    c. Un-used indexes

    Database growth history..

    Please help on this

  • If you google: sql server health check script with powershell

    That will give you quite a few examples of different Posh scripts to get you started.

    Sue

  • Thank you for the reply. It is showing many scripts , but it is showing errors. Since i am new to powershell, i can't resolve it.

    If you have any working scripts related to this. Please share it ASAP.

    Thanks

    NM

  • naren.ece2012 (8/11/2016)


    Thank you for the reply. It is showing many scripts , but it is showing errors. Since i am new to powershell, i can't resolve it.

    If you have any working scripts related to this. Please share it ASAP.

    It's probably of very little value to you if you can't enhance the script, can't troubleshoot it, etc. No one will have a script that has everything exactly how you want for this using the exact environment you have and executing how ever you execute it.

    Powershell is a great tool to learn and using it for monitoring is a great idea. What you really want to do is find the script closest to what you are looking for and then start learning powershell by getting it to work in your environment.

    To get started in powershell, you can start by reading the stairways series here:

    http://www.sqlservercentral.com/stairway/91327/

    You'd really want to go through that to at least get things setup and configured to be able to run powershell scripts and understand the environment a bit.

    And then when you get comfortable with some of the basics, there is a Powershell forum here as well if/when you get stuck along the way to post powershell questions:

    http://www.sqlservercentral.com/stairway/91327/

    Hope that helps -

    Sue

  • Duh...sorry about that. Pasted the same link to the stairway article instead of the forum.

    This is the Posh forum:

    http://www.sqlservercentral.com/Forums/Forum1351-1.aspx

    Sue

  • You don't need Powershell for this. Google for Brent Ozar's "sp_Blitz" and Adam Machanic's "sp_WhoIsActive".

    Just remember... if you can't write it, you might not be able to maintain it.

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

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

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