1) A SQL Linked Server connection to Active Directory - this allows us to lookup the email address of the AD user who put the machine into maintenance mode. In our company we make use of a centralised server details page (with MM integration). If this page is used to put the machine into maintenance mode, another "service" account is used, but the username is stored in the comments section as follows: DOMAIN\USER: Comments
2) SQL Mail will need to be setup.
3) There is another portion to this - a Web Service which receives the request to extend the maintenance mode. You may choose to omit this portion but it's nice functionality to have. This is in C#.
SQL Code:
DECLARE @now datetime;
DECLARE @LocalGMTOffset int;
DECLARE @MMWindowAlertThresholdPerc int;
DECLARE @startPos int;
DECLARE @endPos int;
DECLARE @userName varchar(200);
DECLARE @sql nvarchar(4000);
DECLARE @AD varchar(200);
DECLARE @WebServer varchar(200);
DECLARE @actionAccount varchar(200);
SET @LocalGMTOffset = +2
SET @MMWindowAlertThresholdPerc = 75;
SET @NOW = dateadd(hour,(@LocalGMTOffset * -1),getdate());
litOutput.Text = pcDisplayName + " has already been taken out of maintenance mode. Starting a new maintenance mode window for " + extendHours + " hours." +
"
Scheduled end time is: " + scheduledEndTime.AddHours(gmtOffset).ToString();
}
catch(Exception Ex)
{
litOutput.Text = "Encountered an error placing machine into maintenance mode. System Center has been notified.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
HI Guys
I have bee studing the code from this guys here, I want to implement a similar reminder email,
Can anyone help to make sence of it?
I dont know where to start.
h**p://syscenterstuff.blogspot.com/2010/02/maintenance-mode-reminder-emails.html
1) A SQL Linked Server connection to Active Directory - this allows us to lookup the email address of the AD user who put the machine into maintenance mode. In our company we make use of a centralised server details page (with MM integration). If this page is used to put the machine into maintenance mode, another "service" account is used, but the username is stored in the comments section as follows: DOMAIN\USER: Comments
2) SQL Mail will need to be setup.
3) There is another portion to this - a Web Service which receives the request to extend the maintenance mode. You may choose to omit this portion but it's nice functionality to have. This is in C#.
SQL Code:
---------------------------
C# Web Service Code:
And that's it... this works nicely once it's setup. It may take you a while to get all the components right - if you need help give me a shout.
Share this post
Link to post
Share on other sites