This commit is contained in:
Virtuworks 2013-03-04 22:15:42 -05:00
commit 0a404d49c1
10 changed files with 197 additions and 21 deletions

View file

@ -2132,6 +2132,7 @@ namespace WebsitePanel.EnterpriseServer
catch(Exception ex) catch(Exception ex)
{ {
TaskManager.WriteError(ex); TaskManager.WriteError(ex);
res.IsSuccess = false;
} }
return res; return res;
} }

View file

@ -33,6 +33,7 @@ using System.Collections;
using System.Diagnostics; using System.Diagnostics;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Data.SqlClient;
namespace WebsitePanel.EnterpriseServer namespace WebsitePanel.EnterpriseServer
{ {
@ -145,8 +146,23 @@ namespace WebsitePanel.EnterpriseServer
schedule.ScheduleInfo.LastRun = DateTime.Now; schedule.ScheduleInfo.LastRun = DateTime.Now;
// update schedule // update schedule
SchedulerController.UpdateSchedule(schedule.ScheduleInfo); int MAX_RETRY_COUNT = 10;
int counter = 0;
while (counter < MAX_RETRY_COUNT)
{
try
{
SchedulerController.UpdateSchedule(schedule.ScheduleInfo);
break;
}
catch (SqlException)
{
System.Threading.Thread.Sleep(1000);
}
counter++;
}
{
// skip execution if the current task is still running // skip execution if the current task is still running
scheduledTasks = TaskManager.GetScheduledTasks(); scheduledTasks = TaskManager.GetScheduledTasks();
if (!scheduledTasks.ContainsKey(schedule.ScheduleInfo.ScheduleId)) if (!scheduledTasks.ContainsKey(schedule.ScheduleInfo.ScheduleId))
@ -161,7 +177,7 @@ namespace WebsitePanel.EnterpriseServer
{ {
TaskManager.WriteError(string.Format("RunSchedule Error : {0}", Ex.Message)); TaskManager.WriteError(string.Format("RunSchedule Error : {0}", Ex.Message));
} }
catch (Exception) catch(Exception)
{ {
} }
} }

View file

@ -150,8 +150,8 @@ namespace WebsitePanel.EnterpriseServer
{ {
// ERROR // ERROR
WriteLogRecord(2, ex.Message, ex.StackTrace); WriteLogRecord(2, ex.Message, ex.StackTrace);
return new Exception(String.Format("Error executing '{0}' task on '{1}' {2}", return new Exception((TopTask != null) ? String.Format("Error executing '{0}' task on '{1}' {2}",
TopTask.TaskName, TopTask.ItemName, TopTask.Source), ex); TopTask.TaskName, TopTask.ItemName, TopTask.Source) : String.Format("Error executing task"), ex);
} }
public static void WriteError(Exception ex, string text, params string[] textParameters) public static void WriteError(Exception ex, string text, params string[] textParameters)
@ -182,12 +182,15 @@ namespace WebsitePanel.EnterpriseServer
logRecord.TextParameters = textParameters; logRecord.TextParameters = textParameters;
logRecord.TextIdent = TasksStack.Count - 1; logRecord.TextIdent = TasksStack.Count - 1;
logRecord.ExceptionStackTrace = stackTrace; logRecord.ExceptionStackTrace = stackTrace;
RootTask.LogRecords.Add(logRecord); if (RootTask != null)
RootTask.LastLogRecord = logRecord; {
RootTask.LogRecords.Add(logRecord);
RootTask.LastLogRecord = logRecord;
// change entire task severity // change entire task severity
if (severity > RootTask.Severity) if (severity > RootTask.Severity)
RootTask.Severity = severity; RootTask.Severity = severity;
}
} }
public static void CompleteTask() public static void CompleteTask()

View file

@ -46,7 +46,12 @@ namespace WebsitePanel.EnterpriseServer
protected void Application_Start(object sender, EventArgs e) protected void Application_Start(object sender, EventArgs e)
{ {
Scheduler.Start(); if (ConfigurationManager.AppSettings["WebsitePanel.DistableScheduler"] != null)
if (Boolean.Parse(ConfigurationManager.AppSettings["WebsitePanel.DistableScheduler"]) == false)
{
if (Scheduler.nextSchedule == null)
Scheduler.Start();
}
} }
protected void Application_End(object sender, EventArgs e) protected void Application_End(object sender, EventArgs e)

View file

@ -18,9 +18,6 @@
<!-- Maximum waiting time when sending request to the remote server <!-- Maximum waiting time when sending request to the remote server
The value is in seconds. "-1" - infinite. --> The value is in seconds. "-1" - infinite. -->
<add key="WebsitePanel.EnterpriseServer.ServerRequestTimeout" value="3600" /> <add key="WebsitePanel.EnterpriseServer.ServerRequestTimeout" value="3600" />
<!-- Alternative connection string, pulls the value from registry -->
<add key="WebsitePanel.AltConnectionString" value="ConnectionString" />
<add key="WebsitePanel.AltCryptoKey" value="CryptoKey" />
</appSettings> </appSettings>
<system.web> <system.web>
<!-- Disable any authentication --> <!-- Disable any authentication -->

View file

@ -1934,13 +1934,22 @@ namespace WebsitePanel.Providers.HostedSolution
if (enabledLitigationHold) if (enabledLitigationHold)
{ {
cmd.Parameters.Add("LitigationHoldEnabled", true);
cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace)); cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace));
cmd.Parameters.Add("RecoverableItemsWarningQuota", ConvertKBToUnlimited(recoverabelItemsWarning)); cmd.Parameters.Add("RecoverableItemsWarningQuota", ConvertKBToUnlimited(recoverabelItemsWarning));
} }
ExecuteShellCommand(runSpace, cmd); ExecuteShellCommand(runSpace, cmd);
//Litigation Hold
if (enabledLitigationHold)
{
cmd = new Command("New-MailboxSearch");
cmd.Parameters.Add("Name", upn);
cmd.Parameters.Add("InPlaceHoldEnabled", enabledLitigationHold);
cmd.Parameters.Add("SourceMailboxes", upn);
ExecuteShellCommand(runSpace, cmd);
}
//Client Access //Client Access
cmd = new Command("Set-CASMailbox"); cmd = new Command("Set-CASMailbox");
cmd.Parameters.Add("Identity", id); cmd.Parameters.Add("Identity", id);
@ -2267,7 +2276,7 @@ namespace WebsitePanel.Providers.HostedSolution
info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName"); info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName");
info.HideFromAddressBook = (bool)GetPSObjectProperty(mailbox, "HiddenFromAddressListsEnabled"); info.HideFromAddressBook = (bool)GetPSObjectProperty(mailbox, "HiddenFromAddressListsEnabled");
info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled");
Command cmd = new Command("Get-User"); Command cmd = new Command("Get-User");
cmd.Parameters.Add("Identity", accountName); cmd.Parameters.Add("Identity", accountName);
@ -2298,6 +2307,18 @@ namespace WebsitePanel.Providers.HostedSolution
info.WebPage = (string)GetPSObjectProperty(user, "WebPage"); info.WebPage = (string)GetPSObjectProperty(user, "WebPage");
info.Notes = (string)GetPSObjectProperty(user, "Notes"); info.Notes = (string)GetPSObjectProperty(user, "Notes");
//Litigation Hold
info.EnableLitigationHold = false;
cmd = new Command("Get-MailboxSearch");
cmd.Parameters.Add("Identity", accountName);
result = ExecuteShellCommand(runSpace, cmd);
if ((result != null) & (result.Count > 0))
{
mailbox = result[0];
info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "InPlaceHoldEnabled");
}
} }
finally finally
{ {
@ -2478,8 +2499,6 @@ namespace WebsitePanel.Providers.HostedSolution
info.KeepDeletedItemsDays = info.KeepDeletedItemsDays =
ConvertEnhancedTimeSpanToDays((EnhancedTimeSpan)GetPSObjectProperty(mailbox, "RetainDeletedItemsFor")); ConvertEnhancedTimeSpanToDays((EnhancedTimeSpan)GetPSObjectProperty(mailbox, "RetainDeletedItemsFor"));
info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled");
info.RecoverabelItemsSpace = info.RecoverabelItemsSpace =
ConvertUnlimitedToKB((Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "RecoverableItemsQuota")); ConvertUnlimitedToKB((Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "RecoverableItemsQuota"));
info.RecoverabelItemsWarning = info.RecoverabelItemsWarning =
@ -2497,6 +2516,18 @@ namespace WebsitePanel.Providers.HostedSolution
info.EnablePOP = (bool)GetPSObjectProperty(mailbox, "PopEnabled"); info.EnablePOP = (bool)GetPSObjectProperty(mailbox, "PopEnabled");
info.EnableIMAP = (bool)GetPSObjectProperty(mailbox, "ImapEnabled"); info.EnableIMAP = (bool)GetPSObjectProperty(mailbox, "ImapEnabled");
//Litigation Hold
info.EnableLitigationHold = false;
cmd = new Command("Get-MailboxSearch");
cmd.Parameters.Add("Identity", accountName);
result = ExecuteShellCommand(runSpace, cmd);
if ((result != null) & (result.Count > 0))
{
mailbox = result[0];
info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "InPlaceHoldEnabled");
}
//Statistics //Statistics
cmd = new Command("Get-MailboxStatistics"); cmd = new Command("Get-MailboxStatistics");
cmd.Parameters.Add("Identity", accountName); cmd.Parameters.Add("Identity", accountName);
@ -2558,9 +2589,7 @@ namespace WebsitePanel.Providers.HostedSolution
cmd.Parameters.Add("MaxSendSize", ConvertKBToUnlimited(maxSendMessageSizeKB)); cmd.Parameters.Add("MaxSendSize", ConvertKBToUnlimited(maxSendMessageSizeKB));
cmd.Parameters.Add("MaxReceiveSize", ConvertKBToUnlimited(maxReceiveMessageSizeKB)); cmd.Parameters.Add("MaxReceiveSize", ConvertKBToUnlimited(maxReceiveMessageSizeKB));
cmd.Parameters.Add("LitigationHoldEnabled", enabledLitigationHold);
cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace)); cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace));
cmd.Parameters.Add("RetentionUrl", litigationHoldUrl); cmd.Parameters.Add("RetentionUrl", litigationHoldUrl);
cmd.Parameters.Add("RetentionComment", litigationHoldMsg); cmd.Parameters.Add("RetentionComment", litigationHoldMsg);
@ -2568,6 +2597,16 @@ namespace WebsitePanel.Providers.HostedSolution
ExecuteShellCommand(runSpace, cmd); ExecuteShellCommand(runSpace, cmd);
//LitigationHold
cmd = new Command("Get-MailboxSearch");
cmd.Parameters.Add("Identity", accountName);
Collection<PSObject> result = ExecuteShellCommand(runSpace, cmd);
cmd = new Command((result == null) || (result.Count == 0) ? "New-MailboxSearch" : "Set-MailboxSearch");
cmd.Parameters.Add((result == null) || (result.Count == 0) ? "Name" : "Identity", accountName);
cmd.Parameters.Add("InPlaceHoldEnabled", enabledLitigationHold);
cmd.Parameters.Add("SourceMailboxes", accountName);
ExecuteShellCommand(runSpace, cmd);
//Client Access //Client Access
cmd = new Command("Set-CASMailbox"); cmd = new Command("Set-CASMailbox");
cmd.Parameters.Add("Identity", accountName); cmd.Parameters.Add("Identity", accountName);
@ -2943,7 +2982,6 @@ namespace WebsitePanel.Providers.HostedSolution
string path = AddADPrefix(dn); string path = AddADPrefix(dn);
DirectoryEntry entry = GetADObject(path); DirectoryEntry entry = GetADObject(path);
info.Enabled = !(bool)entry.InvokeGet("AccountDisabled"); info.Enabled = !(bool)entry.InvokeGet("AccountDisabled");
info.LitigationHoldEnabled = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled");
info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName"); info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName");
SmtpAddress smtpAddress = (SmtpAddress)GetPSObjectProperty(mailbox, "PrimarySmtpAddress"); SmtpAddress smtpAddress = (SmtpAddress)GetPSObjectProperty(mailbox, "PrimarySmtpAddress");
@ -2953,6 +2991,7 @@ namespace WebsitePanel.Providers.HostedSolution
info.MaxSize = ConvertUnlimitedToBytes((Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "ProhibitSendReceiveQuota")); info.MaxSize = ConvertUnlimitedToBytes((Unlimited<ByteQuantifiedSize>)GetPSObjectProperty(mailbox, "ProhibitSendReceiveQuota"));
DateTime? whenCreated = (DateTime?)GetPSObjectProperty(mailbox, "WhenCreated"); DateTime? whenCreated = (DateTime?)GetPSObjectProperty(mailbox, "WhenCreated");
info.AccountCreated = ConvertNullableToDateTime(whenCreated); info.AccountCreated = ConvertNullableToDateTime(whenCreated);
//Client Access //Client Access
Command cmd = new Command("Get-CASMailbox"); Command cmd = new Command("Get-CASMailbox");
cmd.Parameters.Add("Identity", id); cmd.Parameters.Add("Identity", id);
@ -2965,6 +3004,17 @@ namespace WebsitePanel.Providers.HostedSolution
info.POPEnabled = (bool)GetPSObjectProperty(mailbox, "PopEnabled"); info.POPEnabled = (bool)GetPSObjectProperty(mailbox, "PopEnabled");
info.IMAPEnabled = (bool)GetPSObjectProperty(mailbox, "ImapEnabled"); info.IMAPEnabled = (bool)GetPSObjectProperty(mailbox, "ImapEnabled");
//Litigation Hold
info.LitigationHoldEnabled = false;
cmd = new Command("Get-MailboxSearch");
cmd.Parameters.Add("Identity", id);
result = ExecuteShellCommand(runSpace, cmd);
if ((result != null) & (result.Count > 0))
{
mailbox = result[0];
info.LitigationHoldEnabled = (bool)GetPSObjectProperty(mailbox, "InPlaceHoldEnabled");
}
//Statistics //Statistics
cmd = new Command("Get-MailboxStatistics"); cmd = new Command("Get-MailboxStatistics");
cmd.Parameters.Add("Identity", id); cmd.Parameters.Add("Identity", id);

View file

@ -192,4 +192,10 @@
<data name="locMailboxDAG.Text" xml:space="preserve"> <data name="locMailboxDAG.Text" xml:space="preserve">
<value>Database Availability Group:</value> <value>Database Availability Group:</value>
</data> </data>
<data name="lblPowerShellUrl.Text" xml:space="preserve">
<value>e.g. http://server.domain.com/PowerShell</value>
</data>
<data name="locPowerShellUrl.Text" xml:space="preserve">
<value>Powershell URL:</value>
</data>
</root> </root>

View file

@ -1,6 +1,25 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Exchange_Settings.ascx.cs" <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Exchange_Settings.ascx.cs"
Inherits="WebsitePanel.Portal.ProviderControls.Exchange2010_Settings" %> Inherits="WebsitePanel.Portal.ProviderControls.Exchange2010_Settings" %>
<table cellpadding="3" cellspacing="0" width="100%"> <table cellpadding="3" cellspacing="0" width="100%">
<tr runat="server" id="powershellUrl1" width="200" nowrap>
<td class="SubHead">
</td>
<td>
<asp:Label runat="server" ID="lblFileServiceInfo" meta:resourcekey="lblPowerShellUrl" Text="e.g. http://server.domain.com/PowerShell" Font-Italic="true"></asp:Label>
</td>
</tr>
<tr runat="server" id="powershellUrl2" width="200" nowrap>
<td class="SubHead">
<asp:Localize ID="loclocPowerShellUrl" runat="server" meta:resourcekey="locPowerShellUrl"
Text="Powershell URL:"></asp:Localize>
</td>
<td>
<asp:TextBox ID="txtPowerShellUrl" runat="server" Width="400px"></asp:TextBox>
</td>
</tr>
<tr runat="server" id="storageGroup"> <tr runat="server" id="storageGroup">
<td class="SubHead" width="200" nowrap> <td class="SubHead" width="200" nowrap>
<asp:Localize ID="locStorageGroup" runat="server" meta:resourcekey="locStorageGroup" Text="Storage Group Name:"></asp:Localize> <asp:Localize ID="locStorageGroup" runat="server" meta:resourcekey="locStorageGroup" Text="Storage Group Name:"></asp:Localize>

View file

@ -91,6 +91,8 @@ namespace WebsitePanel.Portal.ProviderControls
txtStorageGroup.Text = ""; txtStorageGroup.Text = "";
locMailboxDAG.Visible = false; locMailboxDAG.Visible = false;
powershellUrl1.Visible = powershellUrl2.Visible = false;
break; break;
case EXCHANGE2010SP2_PROVIDER_ID: case EXCHANGE2010SP2_PROVIDER_ID:
@ -101,6 +103,7 @@ namespace WebsitePanel.Portal.ProviderControls
txtStorageGroup.Text = ""; txtStorageGroup.Text = "";
locMailboxDatabase.Visible = false; locMailboxDatabase.Visible = false;
powershellUrl1.Visible = powershellUrl2.Visible = false;
break; break;
case EXCHANGE2013_PROVIDER_ID: case EXCHANGE2013_PROVIDER_ID:
@ -111,6 +114,7 @@ namespace WebsitePanel.Portal.ProviderControls
txtStorageGroup.Text = ""; txtStorageGroup.Text = "";
locMailboxDatabase.Visible = false; locMailboxDatabase.Visible = false;
powershellUrl1.Visible = powershellUrl2.Visible = true;
break; break;
default: default:
@ -147,6 +151,7 @@ namespace WebsitePanel.Portal.ProviderControls
txtActiveSyncServer.Text = settings["ActiveSyncServer"]; txtActiveSyncServer.Text = settings["ActiveSyncServer"];
txtOABServer.Text = settings["OABServer"]; txtOABServer.Text = settings["OABServer"];
txtPublicFolderServer.Text = settings["PublicFolderServer"]; txtPublicFolderServer.Text = settings["PublicFolderServer"];
txtPowerShellUrl.Text = settings["PowerShellUrl"];
UpdateHubTransportsGrid(); UpdateHubTransportsGrid();
UpdateClientAccessGrid(); UpdateClientAccessGrid();
@ -173,6 +178,7 @@ namespace WebsitePanel.Portal.ProviderControls
settings["PublicFolderServer"] = txtPublicFolderServer.Text; settings["PublicFolderServer"] = txtPublicFolderServer.Text;
settings["StorageGroup"] = txtStorageGroup.Text; settings["StorageGroup"] = txtStorageGroup.Text;
settings["PowerShellUrl"] = txtPowerShellUrl.Text;
} }
public void BindExchangeServices(DropDownList ddl, bool isHubservice) public void BindExchangeServices(DropDownList ddl, bool isHubservice)

View file

@ -1,3 +1,31 @@
// Copyright (c) 2012, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -12,6 +40,51 @@ namespace WebsitePanel.Portal.ProviderControls {
public partial class Exchange2010_Settings { public partial class Exchange2010_Settings {
/// <summary>
/// powershellUrl1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow powershellUrl1;
/// <summary>
/// lblFileServiceInfo control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblFileServiceInfo;
/// <summary>
/// powershellUrl2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow powershellUrl2;
/// <summary>
/// loclocPowerShellUrl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize loclocPowerShellUrl;
/// <summary>
/// txtPowerShellUrl control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPowerShellUrl;
/// <summary> /// <summary>
/// storageGroup control. /// storageGroup control.
/// </summary> /// </summary>