Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20396

Re: Display the primary server in a Microsoft SQL Server cluster

$
0
0

I don't mind sharing.   Just too bad I cannot remember what installation I actually put that on to get the exact code 

 

But, few minutes on notepad, something like this should work out as a starting point.  Should be pretty straight forward to add in additional service checks.

 

$target1 = "<primary IP address>"

$target2 = "<secondary IP address>"

$targetapp1 = (get-service -ComputerName $target1 -name 'MSSQLSERVER').Status;

$targetapp2 = (get-service -ComputerName $target2 -name 'MSSQLSERVER').Status;

 

if ($targetapp1 -eq 'Running')

{write "Statistic.appstatus: 0";

write "Message.appstatus: $targetapp1";}

 

elseif ($targetapp2 -eq 'Running')

{write "Statistic.appstatus: 1";

write "Message.appstatus: $targetapp2";}

 

else

{write "Statistic.appstatus: 2";

write "Message.appstatus: $targetapp1";}

 

exit (0);


Viewing all articles
Browse latest Browse all 20396

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>