• Hi Anthony,

    I tested this powershell script, and it's working amazingly well. The only problem that I am facing now, is that my boss is looking for something which needs to be more generic rather than a hard coded solution. For example, if we have 15 instances on a 2 node windows cluster, then we don't have to change the value in this line IF ($param.Count -gt 5) {sendmail} (like changing the value from 5 to 6 etc). Now, I need to take this through parameters, not manually stating the value. For e.g: this could be something like this

    if (nSQLNode > round(nSQL/nNode)) {sendmail}

    where nNode = total # of nodes in a windows cluster -- for e.g if it's a 2 node cluster, we are only interested in getting the count, not the node name. I know there is something cluster node to view the name of the nodes, but we just need the count

    nSQL = total # of SQL instances in the cluster --same applies here...we need count

    nSQLNode = # of Sql instances in any of the node.

    round() is a math function to round the decimal number.

    I know for sure, this can be implemented in powershell, but I don't know how I can get the count using cmdlets for each of these parameters. Can we take the parameter value using t-sql code, and incorporate it in powershell, and run it through windows task scheduler. Is that possible?

    I believe rest of the script will remain same.I don't have an idea whether we have anything called round() as a powershell function, but I do know there is something for e.g

    $param = [System.Math]::Round().

    Pls. provide your valuable inputs on how can programmatically get the counts.

    Regards,

    Faisal