diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs index 0d0a3b6d..8c9556d9 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/HostedSolution/OrganizationController.cs @@ -2132,6 +2132,7 @@ namespace WebsitePanel.EnterpriseServer catch(Exception ex) { TaskManager.WriteError(ex); + res.IsSuccess = false; } return res; } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Scheduling/Scheduler.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Scheduling/Scheduler.cs index 61ac1666..0b6f5523 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Scheduling/Scheduler.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Scheduling/Scheduler.cs @@ -33,6 +33,7 @@ using System.Collections; using System.Diagnostics; using System.Collections.Generic; using System.Text; +using System.Data.SqlClient; namespace WebsitePanel.EnterpriseServer { @@ -145,8 +146,23 @@ namespace WebsitePanel.EnterpriseServer schedule.ScheduleInfo.LastRun = DateTime.Now; // 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 scheduledTasks = TaskManager.GetScheduledTasks(); if (!scheduledTasks.ContainsKey(schedule.ScheduleInfo.ScheduleId)) @@ -161,7 +177,7 @@ namespace WebsitePanel.EnterpriseServer { TaskManager.WriteError(string.Format("RunSchedule Error : {0}", Ex.Message)); } - catch (Exception) + catch(Exception) { } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Tasks/TaskManager.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Tasks/TaskManager.cs index e7b3c904..f69cb478 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Tasks/TaskManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Code/Tasks/TaskManager.cs @@ -150,8 +150,8 @@ namespace WebsitePanel.EnterpriseServer { // ERROR WriteLogRecord(2, ex.Message, ex.StackTrace); - return new Exception(String.Format("Error executing '{0}' task on '{1}' {2}", - TopTask.TaskName, TopTask.ItemName, TopTask.Source), ex); + return new Exception((TopTask != null) ? String.Format("Error executing '{0}' task on '{1}' {2}", + TopTask.TaskName, TopTask.ItemName, TopTask.Source) : String.Format("Error executing task"), ex); } public static void WriteError(Exception ex, string text, params string[] textParameters) @@ -182,12 +182,15 @@ namespace WebsitePanel.EnterpriseServer logRecord.TextParameters = textParameters; logRecord.TextIdent = TasksStack.Count - 1; logRecord.ExceptionStackTrace = stackTrace; - RootTask.LogRecords.Add(logRecord); - RootTask.LastLogRecord = logRecord; + if (RootTask != null) + { + RootTask.LogRecords.Add(logRecord); + RootTask.LastLogRecord = logRecord; - // change entire task severity - if (severity > RootTask.Severity) - RootTask.Severity = severity; + // change entire task severity + if (severity > RootTask.Severity) + RootTask.Severity = severity; + } } public static void CompleteTask() diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Global.asax.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Global.asax.cs index a1dc2caa..64282fa2 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Global.asax.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Global.asax.cs @@ -46,7 +46,12 @@ namespace WebsitePanel.EnterpriseServer 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) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config index 99362901..3766094f 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/Web.config @@ -18,9 +18,6 @@ - - - diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs index a932dae7..5e35cf33 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.HostedSolution.Exchange2013/Exchange2013.cs @@ -1934,13 +1934,22 @@ namespace WebsitePanel.Providers.HostedSolution if (enabledLitigationHold) { - cmd.Parameters.Add("LitigationHoldEnabled", true); cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace)); cmd.Parameters.Add("RecoverableItemsWarningQuota", ConvertKBToUnlimited(recoverabelItemsWarning)); } 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 cmd = new Command("Set-CASMailbox"); cmd.Parameters.Add("Identity", id); @@ -2267,7 +2276,7 @@ namespace WebsitePanel.Providers.HostedSolution info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName"); info.HideFromAddressBook = (bool)GetPSObjectProperty(mailbox, "HiddenFromAddressListsEnabled"); - info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled"); + Command cmd = new Command("Get-User"); cmd.Parameters.Add("Identity", accountName); @@ -2298,6 +2307,18 @@ namespace WebsitePanel.Providers.HostedSolution info.WebPage = (string)GetPSObjectProperty(user, "WebPage"); 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 { @@ -2478,8 +2499,6 @@ namespace WebsitePanel.Providers.HostedSolution info.KeepDeletedItemsDays = ConvertEnhancedTimeSpanToDays((EnhancedTimeSpan)GetPSObjectProperty(mailbox, "RetainDeletedItemsFor")); - info.EnableLitigationHold = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled"); - info.RecoverabelItemsSpace = ConvertUnlimitedToKB((Unlimited)GetPSObjectProperty(mailbox, "RecoverableItemsQuota")); info.RecoverabelItemsWarning = @@ -2497,6 +2516,18 @@ namespace WebsitePanel.Providers.HostedSolution info.EnablePOP = (bool)GetPSObjectProperty(mailbox, "PopEnabled"); 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 cmd = new Command("Get-MailboxStatistics"); cmd.Parameters.Add("Identity", accountName); @@ -2558,9 +2589,7 @@ namespace WebsitePanel.Providers.HostedSolution cmd.Parameters.Add("MaxSendSize", ConvertKBToUnlimited(maxSendMessageSizeKB)); cmd.Parameters.Add("MaxReceiveSize", ConvertKBToUnlimited(maxReceiveMessageSizeKB)); - cmd.Parameters.Add("LitigationHoldEnabled", enabledLitigationHold); cmd.Parameters.Add("RecoverableItemsQuota", ConvertKBToUnlimited(recoverabelItemsSpace)); - cmd.Parameters.Add("RetentionUrl", litigationHoldUrl); cmd.Parameters.Add("RetentionComment", litigationHoldMsg); @@ -2568,6 +2597,16 @@ namespace WebsitePanel.Providers.HostedSolution ExecuteShellCommand(runSpace, cmd); + //LitigationHold + cmd = new Command("Get-MailboxSearch"); + cmd.Parameters.Add("Identity", accountName); + Collection 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 cmd = new Command("Set-CASMailbox"); cmd.Parameters.Add("Identity", accountName); @@ -2943,7 +2982,6 @@ namespace WebsitePanel.Providers.HostedSolution string path = AddADPrefix(dn); DirectoryEntry entry = GetADObject(path); info.Enabled = !(bool)entry.InvokeGet("AccountDisabled"); - info.LitigationHoldEnabled = (bool)GetPSObjectProperty(mailbox, "LitigationHoldEnabled"); info.DisplayName = (string)GetPSObjectProperty(mailbox, "DisplayName"); SmtpAddress smtpAddress = (SmtpAddress)GetPSObjectProperty(mailbox, "PrimarySmtpAddress"); @@ -2953,6 +2991,7 @@ namespace WebsitePanel.Providers.HostedSolution info.MaxSize = ConvertUnlimitedToBytes((Unlimited)GetPSObjectProperty(mailbox, "ProhibitSendReceiveQuota")); DateTime? whenCreated = (DateTime?)GetPSObjectProperty(mailbox, "WhenCreated"); info.AccountCreated = ConvertNullableToDateTime(whenCreated); + //Client Access Command cmd = new Command("Get-CASMailbox"); cmd.Parameters.Add("Identity", id); @@ -2965,6 +3004,17 @@ namespace WebsitePanel.Providers.HostedSolution info.POPEnabled = (bool)GetPSObjectProperty(mailbox, "PopEnabled"); 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 cmd = new Command("Get-MailboxStatistics"); cmd.Parameters.Add("Identity", id); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/Exchange_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/Exchange_Settings.ascx.resx index c2df5d53..8ed90f04 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/Exchange_Settings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/Exchange_Settings.ascx.resx @@ -192,4 +192,10 @@ Database Availability Group: + + e.g. http://server.domain.com/PowerShell + + + Powershell URL: + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx index 48636a4d..be0220cb 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx @@ -1,6 +1,25 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Exchange_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.Exchange2010_Settings" %> + + + + + + + + + + +
+ + +
+ + + +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx.cs index 944b4d94..51a9393b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx.cs @@ -91,6 +91,8 @@ namespace WebsitePanel.Portal.ProviderControls txtStorageGroup.Text = ""; locMailboxDAG.Visible = false; + + powershellUrl1.Visible = powershellUrl2.Visible = false; break; case EXCHANGE2010SP2_PROVIDER_ID: @@ -101,6 +103,7 @@ namespace WebsitePanel.Portal.ProviderControls txtStorageGroup.Text = ""; locMailboxDatabase.Visible = false; + powershellUrl1.Visible = powershellUrl2.Visible = false; break; case EXCHANGE2013_PROVIDER_ID: @@ -111,6 +114,7 @@ namespace WebsitePanel.Portal.ProviderControls txtStorageGroup.Text = ""; locMailboxDatabase.Visible = false; + powershellUrl1.Visible = powershellUrl2.Visible = true; break; default: @@ -147,6 +151,7 @@ namespace WebsitePanel.Portal.ProviderControls txtActiveSyncServer.Text = settings["ActiveSyncServer"]; txtOABServer.Text = settings["OABServer"]; txtPublicFolderServer.Text = settings["PublicFolderServer"]; + txtPowerShellUrl.Text = settings["PowerShellUrl"]; UpdateHubTransportsGrid(); UpdateClientAccessGrid(); @@ -173,6 +178,7 @@ namespace WebsitePanel.Portal.ProviderControls settings["PublicFolderServer"] = txtPublicFolderServer.Text; settings["StorageGroup"] = txtStorageGroup.Text; + settings["PowerShellUrl"] = txtPowerShellUrl.Text; } public void BindExchangeServices(DropDownList ddl, bool isHubservice) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx.designer.cs index 771c7fb0..bc155a48 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/Exchange_Settings.ascx.designer.cs @@ -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. + //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -12,6 +40,51 @@ namespace WebsitePanel.Portal.ProviderControls { public partial class Exchange2010_Settings { + /// + /// powershellUrl1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow powershellUrl1; + + /// + /// lblFileServiceInfo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblFileServiceInfo; + + /// + /// powershellUrl2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow powershellUrl2; + + /// + /// loclocPowerShellUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize loclocPowerShellUrl; + + /// + /// txtPowerShellUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtPowerShellUrl; + /// /// storageGroup control. ///