From 8b3332e3c70fb6c5061c1caa6d4fea80e6d938f5 Mon Sep 17 00:00:00 2001 From: AlexanderTr Date: Fri, 20 Mar 2015 21:24:07 +0300 Subject: [PATCH 01/36] wsp-10323 Convert the VSP provider into one utilizing PowerShell. Step 6 Create\Delete\Export --- .../Helpers/BiosHelper.cs | 8 +- .../Helpers/DvdDriveHelper.cs | 8 +- .../Helpers/HardDriveHelper.cs | 6 +- .../Helpers/NetworkAdapterHelper.cs | 12 +- .../Helpers/SnapshotHelper.cs | 2 +- .../Helpers/VirtualMachineHelper.cs | 10 +- .../HyperV2012R2.cs | 403 ++++-------------- .../PowerShellManager.cs | 73 +--- 8 files changed, 121 insertions(+), 401 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/BiosHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/BiosHelper.cs index 21dafb52..fdb71f50 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/BiosHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/BiosHelper.cs @@ -23,7 +23,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", name); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { info.NumLockEnabled = true; @@ -56,7 +56,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", name); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { info.NumLockEnabled = Convert.ToBoolean(result[0].GetProperty("NumLockEnabled")); @@ -89,7 +89,7 @@ namespace WebsitePanel.Providers.Virtualization else cmd.Parameters.Add("FirstBootDevice", HardDriveHelper.GetPS(powerShell, vm.Name).FirstOrDefault()); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } // for others win and linux else @@ -102,7 +102,7 @@ namespace WebsitePanel.Providers.Virtualization : new[] { "IDE", "CD", "LegacyNetworkAdapter", "Floppy" }; cmd.Parameters.Add("StartupOrder", bootOrder); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/DvdDriveHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/DvdDriveHelper.cs index 012232ee..ce039f0c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/DvdDriveHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/DvdDriveHelper.cs @@ -36,7 +36,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", vmName); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { @@ -57,7 +57,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("ControllerNumber", dvd.ControllerNumber); cmd.Parameters.Add("ControllerLocation", dvd.ControllerLocation); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } public static void Update(PowerShellManager powerShell, VirtualMachine vm, bool dvdDriveShouldBeInstalled) @@ -74,7 +74,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", vmName); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } public static void Remove(PowerShellManager powerShell, string vmName) @@ -87,7 +87,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("ControllerNumber", dvd.ControllerNumber); cmd.Parameters.Add("ControllerLocation", dvd.ControllerLocation); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/HardDriveHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/HardDriveHelper.cs index c8a951d6..b2e90e90 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/HardDriveHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/HardDriveHelper.cs @@ -47,7 +47,7 @@ namespace WebsitePanel.Providers.Virtualization // Command cmd = new Command("Get-VM"); - // Collection result = powerShell.Execute(cmd, false); + // Collection result = powerShell.Execute(cmd, true); // if (result == null || result.Count == 0) // return null; @@ -63,7 +63,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Get-VMHardDiskDrive"); cmd.Parameters.Add("VMName", vmname); - return powerShell.Execute(cmd, false); + return powerShell.Execute(cmd, true); } public static void GetVirtualHardDiskDetail(PowerShellManager powerShell, string path, ref VirtualHardDiskInfo disk) @@ -72,7 +72,7 @@ namespace WebsitePanel.Providers.Virtualization { Command cmd = new Command("Get-VHD"); cmd.Parameters.Add("Path", path); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { disk.DiskFormat = result[0].GetEnum("VhdFormat"); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/NetworkAdapterHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/NetworkAdapterHelper.cs index bd6f9b37..f14f8f97 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/NetworkAdapterHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/NetworkAdapterHelper.cs @@ -26,7 +26,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Get-VMNetworkAdapter"); if (!string.IsNullOrEmpty(vmName)) cmd.Parameters.Add("VMName", vmName); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { foreach (PSObject psAdapter in result) @@ -89,8 +89,9 @@ namespace WebsitePanel.Providers.Virtualization else cmd.Parameters.Add("StaticMacAddress", macAddress); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } + public static void Delete(PowerShellManager powerShell, string vmName, string macAddress) { var networkAdapter = Get(powerShell, vmName, macAddress); @@ -98,12 +99,17 @@ namespace WebsitePanel.Providers.Virtualization if (networkAdapter == null) return; + Delete(powerShell, vmName, networkAdapter); + } + + public static void Delete(PowerShellManager powerShell, string vmName, VirtualMachineNetworkAdapter networkAdapter) + { Command cmd = new Command("Remove-VMNetworkAdapter"); cmd.Parameters.Add("VMName", vmName); cmd.Parameters.Add("Name", networkAdapter.Name); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/SnapshotHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/SnapshotHelper.cs index b5dee5c2..fa738ce0 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/SnapshotHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/SnapshotHelper.cs @@ -66,7 +66,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("Name", snapshot.Name); if (includeChilds) cmd.Parameters.Add("IncludeAllChildSnapshots", true); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs index e7d05288..bd1291a1 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs @@ -21,7 +21,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", name); cmd.Parameters.Add("Name", "HeartBeat"); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { var statusString = result[0].GetProperty("PrimaryOperationalStatus"); @@ -41,7 +41,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", name); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { procs = Convert.ToInt32(result[0].GetProperty("Count")); @@ -58,7 +58,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", name); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { info.DynamicMemoryEnabled = Convert.ToBoolean(result[0].GetProperty("DynamicMemoryEnabled")); @@ -81,7 +81,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("Reserve", Convert.ToInt64(cpuReserveSettings * 1000)); cmd.Parameters.Add("RelativeWeight", cpuWeightSettings); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } public static void UpdateMemory(PowerShellManager powerShell, VirtualMachine vm, long ramMB) @@ -91,7 +91,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", vm.Name); cmd.Parameters.Add("StartupBytes", ramMB * Constants.Size1M); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index 7b1801ea..b8ad22ab 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -163,7 +163,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("Id", vmId); - Collection result = PowerShell.Execute(cmd, false); + Collection result = PowerShell.Execute(cmd, true); if (result != null && result.Count > 0) { vm.Name = result[0].GetProperty("Name").ToString(); @@ -232,7 +232,7 @@ namespace WebsitePanel.Providers.Virtualization { Command cmd = new Command("Get-VM"); - Collection result = PowerShell.Execute(cmd, false); + Collection result = PowerShell.Execute(cmd, true); foreach (PSObject current in result) { VirtualMachine vm = new VirtualMachine @@ -332,8 +332,9 @@ namespace WebsitePanel.Providers.Virtualization // Add new VM Command cmdNew = new Command("New-VM"); cmdNew.Parameters.Add("Name", vm.Name); + cmdNew.Parameters.Add("Generation", vm.Generation > 1 ? vm.Generation : 1); cmdNew.Parameters.Add("VHDPath", vm.VirtualHardDrivePath); - PowerShell.Execute(cmdNew, false); + PowerShell.Execute(cmdNew, true); // Set VM Command cmdSet = new Command("Set-VM"); @@ -350,7 +351,7 @@ namespace WebsitePanel.Providers.Virtualization } if (autoStopAction != AutomaticStopAction.Undefined) cmdSet.Parameters.Add("AutomaticStopAction", autoStopAction.ToString()); - PowerShell.Execute(cmdSet, false); + PowerShell.Execute(cmdSet, true); // Get created machine Id var createdMachine = GetVirtualMachines().FirstOrDefault(m => m.Name == vm.Name); @@ -396,168 +397,6 @@ namespace WebsitePanel.Providers.Virtualization return vm; } - - private void AddVirtualMachineDvdDrive(string vmId, ManagementObject objVM) - { - // load IDE 1 controller - ManagementObject objIDE1 = wmi.GetWmiObject( - "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Emulated IDE Controller'" - + " and InstanceID Like 'Microsoft:{0}%' and Address = 1", vmId); - - // load default hard disk drive - ManagementObject objDefaultDvd = wmi.GetWmiObject( - "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Synthetic DVD Drive'" - + " and InstanceID like '%Default'"); - ManagementObject objDvd = (ManagementObject)objDefaultDvd.Clone(); - objDvd["Parent"] = objIDE1.Path; - objDvd["Address"] = 0; - - // add DVD drive to VM resources - AddVirtualMachineResources(objVM, objDvd); - } - - private void AddNetworkAdapter(ManagementObject objVm, string switchId, string portName, string macAddress, string adapterName, bool legacyAdapter) - { - string nicClassName = GetNetworkAdapterClassName(legacyAdapter); - - string vmId = (string)objVm["Name"]; - - // check if already exists - ManagementObject objNic = wmi.GetWmiObject( - nicClassName, "InstanceID like 'Microsoft:{0}%' and Address = '{1}'", vmId, macAddress); - - if (objNic != null) - return; // exists - exit - - portName = String.Format("{0} - {1}", - portName, (adapterName == EXTERNAL_NETWORK_ADAPTER_NAME) ? "External" : "Private"); - - // Network service - ManagementObject objNetworkSvc = GetVirtualSwitchManagementService(); - - // default NIC - ManagementObject objDefaultNic = wmi.GetWmiObject(nicClassName, "InstanceID like '%Default'"); - - // find switch - ManagementObject objSwitch = wmi.GetWmiObject("msvm_VirtualSwitch", "Name = '{0}'", switchId); - - // create switch port - ManagementBaseObject inParams = objNetworkSvc.GetMethodParameters("CreateSwitchPort"); - inParams["VirtualSwitch"] = objSwitch; - inParams["Name"] = portName; - inParams["FriendlyName"] = portName; - inParams["ScopeOfResidence"] = ""; - - // invoke method - ManagementBaseObject outParams = objNetworkSvc.InvokeMethod("CreateSwitchPort", inParams, null); - - // process output parameters - ReturnCode code = (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); - if (code == ReturnCode.OK) - { - // created port - ManagementObject objPort = wmi.GetWmiObjectByPath((string)outParams["CreatedSwitchPort"]); - - // create NIC - ManagementObject objExtNic = (ManagementObject)objDefaultNic.Clone(); - objExtNic["Connection"] = new string[] { objPort.Path.Path }; - - if (!String.IsNullOrEmpty(macAddress)) - { - objExtNic["StaticMacAddress"] = true; - objExtNic["Address"] = macAddress; - } - else - { - objExtNic["StaticMacAddress"] = false; - } - objExtNic["ElementName"] = adapterName; - - if (!legacyAdapter) - objExtNic["VirtualSystemIdentifiers"] = new string[] { Guid.NewGuid().ToString("B") }; - - // add NIC - ManagementObject objCreatedExtNic = AddVirtualMachineResources(objVm, objExtNic); - } - } - - private string GetNetworkAdapterClassName(bool legacy) - { - return legacy ? "Msvm_EmulatedEthernetPortSettingData" : "Msvm_SyntheticEthernetPortSettingData"; - } - - private ManagementObject AddVirtualMachineResources(ManagementObject objVm, ManagementObject resource) - { - if (resource == null) - return resource; - - // request management service - ManagementObject objVmsvc = GetVirtualSystemManagementService(); - - // add resources - string txtResource = resource.GetText(TextFormat.CimDtd20); - ManagementBaseObject inParams = objVmsvc.GetMethodParameters("AddVirtualSystemResources"); - inParams["TargetSystem"] = objVm; - inParams["ResourceSettingData"] = new string[] { txtResource }; - ManagementBaseObject outParams = objVmsvc.InvokeMethod("AddVirtualSystemResources", inParams, null); - JobResult result = CreateJobResultFromWmiMethodResults(outParams); - - if (result.ReturnValue == ReturnCode.OK) - { - string[] wmiPaths = (string[])outParams["NewResources"]; - return wmi.GetWmiObjectByPath(wmiPaths[0]); - } - else if (result.ReturnValue == ReturnCode.JobStarted) - { - if (JobCompleted(result.Job)) - { - string[] wmiPaths = (string[])outParams["NewResources"]; - return wmi.GetWmiObjectByPath(wmiPaths[0]); - } - else - { - throw new Exception("Cannot add virtual machine resources"); - } - } - else - { - throw new Exception("Cannot add virtual machine resources: " + txtResource); - } - } - - private JobResult RemoveVirtualMachineResources(ManagementObject objVm, ManagementObject resource) - { - if (resource == null) - return null; - - // request management service - ManagementObject objVmsvc = GetVirtualSystemManagementService(); - - // remove resources - ManagementBaseObject inParams = objVmsvc.GetMethodParameters("RemoveVirtualSystemResources"); - inParams["TargetSystem"] = objVm; - inParams["ResourceSettingData"] = new string[] { resource.Path.Path }; - ManagementBaseObject outParams = objVmsvc.InvokeMethod("RemoveVirtualSystemResources", inParams, null); - JobResult result = CreateJobResultFromWmiMethodResults(outParams); - if (result.ReturnValue == ReturnCode.OK) - { - return result; - } - else if (result.ReturnValue == ReturnCode.JobStarted) - { - if (!JobCompleted(result.Job)) - { - throw new Exception("Cannot remove virtual machine resources"); - } - } - else - { - throw new Exception("Cannot remove virtual machine resources: " + resource.Path.Path); - } - - return result; - } - public JobResult ChangeVirtualMachineState(string vmId, VirtualMachineRequestedState newState) { HostedSolutionLog.LogStart("ChangeVirtualMachineState"); @@ -604,8 +443,8 @@ namespace WebsitePanel.Providers.Virtualization //cmd.Parameters.Add("AsJob"); paramList.ForEach(p => cmd.Parameters.Add(p)); - PowerShell.Execute(cmd, false); - jobResult = JobHelper.CreateSuccessResult(); + PowerShell.Execute(cmd, true); + jobResult = JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } catch (Exception ex) { @@ -633,7 +472,7 @@ namespace WebsitePanel.Providers.Virtualization if (force) cmd.Parameters.Add("Force"); //if (!string.IsNullOrEmpty(reason)) cmd.Parameters.Add("Reason", reason); - PowerShell.Execute(cmd, false); + PowerShell.Execute(cmd, true); } catch (Exception ex) { @@ -665,133 +504,58 @@ namespace WebsitePanel.Providers.Virtualization public JobResult RenameVirtualMachine(string vmId, string name) { - // load virtual machine - ManagementObject objVm = GetVirtualMachineObject(vmId); + var vm = GetVirtualMachine(vmId); - // load machine settings - ManagementObject objVmSettings = GetVirtualMachineSettingsObject(vmId); + Command cmdSet = new Command("Rename-VM"); + cmdSet.Parameters.Add("Name", vm.Name); + cmdSet.Parameters.Add("NewName", name); + PowerShell.Execute(cmdSet, true); - // rename machine - objVmSettings["ElementName"] = name; - - // save - ManagementObject objVmsvc = GetVirtualSystemManagementService(); - ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ModifyVirtualSystem"); - inParams["ComputerSystem"] = objVm.Path.Path; - inParams["SystemSettingData"] = objVmSettings.GetText(TextFormat.CimDtd20); - ManagementBaseObject outParams = objVmsvc.InvokeMethod("ModifyVirtualSystem", inParams, null); - return CreateJobResultFromWmiMethodResults(outParams); + return JobHelper.CreateSuccessResult(); } public JobResult DeleteVirtualMachine(string vmId) { - // load virtual machine object - ManagementObject objVm = GetVirtualMachineObject(vmId); - - // check state - VirtualMachine vm = GetVirtualMachine(vmId); + var vm = GetVirtualMachineEx(vmId); // The virtual computer system must be in the powered off or saved state prior to calling this method. - if (vm.State == VirtualMachineState.Saved - || vm.State == VirtualMachineState.Off) - { - // delete network adapters and ports - DeleteNetworkAdapters(objVm); - - // destroy machine - ManagementObject objVmsvc = GetVirtualSystemManagementService(); - - // get method - ManagementBaseObject inParams = objVmsvc.GetMethodParameters("DestroyVirtualSystem"); - inParams["ComputerSystem"] = objVm; - - // invoke method - ManagementBaseObject outParams = objVmsvc.InvokeMethod("DestroyVirtualSystem", inParams, null); - return CreateJobResultFromWmiMethodResults(outParams); - } - else - { + if (vm.State != VirtualMachineState.Saved && vm.State != VirtualMachineState.Off) throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Destroy method."); + + // Delete network adapters and network switchesw + foreach (var networkAdapter in vm.Adapters) + { + NetworkAdapterHelper.Delete(PowerShell, vm.Name, networkAdapter); + + if (!string.IsNullOrEmpty(networkAdapter.SwitchName)) + DeleteSwitch(networkAdapter.SwitchName); } - } - private void DeleteNetworkAdapters(ManagementObject objVM) - { - string vmId = (string)objVM["Name"]; + object[] errors; - // delete synthetic adapters - foreach (ManagementObject objNic in wmi.GetWmiObjects("Msvm_SyntheticEthernetPortSettingData", "InstanceID like 'Microsoft:{0}%'", vmId)) - DeleteNetworkAdapter(objVM, objNic); + Command cmdSet = new Command("Remove-VM"); + cmdSet.Parameters.Add("Name", vm.Name); + cmdSet.Parameters.Add("Force"); + PowerShell.Execute(cmdSet, false, out errors); - // delete legacy adapters - foreach (ManagementObject objNic in wmi.GetWmiObjects("Msvm_EmulatedEthernetPortSettingData", "InstanceID like 'Microsoft:{0}%'", vmId)) - DeleteNetworkAdapter(objVM, objNic); - } + PowerShellManager.ExceptionIfErrors(errors); - private void DeleteNetworkAdapter(ManagementObject objVM, string macAddress) - { - // locate network adapter - ManagementObject objNic = wmi.GetWmiObject("CIM_ResourceAllocationSettingData", "Address = '{0}'", macAddress); - - // delete adapter - DeleteNetworkAdapter(objVM, objNic); - } - - private void DeleteNetworkAdapter(ManagementObject objVM, ManagementObject objNic) - { - if (objNic == null) - return; - - // delete corresponding switch port - string[] conn = (string[])objNic["Connection"]; - if (conn != null && conn.Length > 0) - DeleteSwitchPort(conn[0]); - - // delete adapter - RemoveVirtualMachineResources(objVM, objNic); - } - - private void DeleteSwitchPort(string portPath) - { - // Network service - ManagementObject objNetworkSvc = GetVirtualSwitchManagementService(); - - // create switch port - ManagementBaseObject inParams = objNetworkSvc.GetMethodParameters("DeleteSwitchPort"); - inParams["SwitchPort"] = portPath; - - // invoke method - objNetworkSvc.InvokeMethod("DeleteSwitchPort", inParams, null); + return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } public JobResult ExportVirtualMachine(string vmId, string exportPath) { - // load virtual machine object - ManagementObject objVm = GetVirtualMachineObject(vmId); - - // check state - VirtualMachine vm = GetVirtualMachine(vmId); + var vm = GetVirtualMachine(vmId); // The virtual computer system must be in the powered off or saved state prior to calling this method. - if (vm.State == VirtualMachineState.Off) - { - // export machine - ManagementObject objVmsvc = GetVirtualSystemManagementService(); - - // get method - ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ExportVirtualSystem"); - inParams["ComputerSystem"] = objVm; - inParams["CopyVmState"] = true; - inParams["ExportDirectory"] = FileUtils.EvaluateSystemVariables(exportPath); - - // invoke method - ManagementBaseObject outParams = objVmsvc.InvokeMethod("ExportVirtualSystem", inParams, null); - return CreateJobResultFromWmiMethodResults(outParams); - } - else - { + if (vm.State != VirtualMachineState.Off) throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Export method."); - } + + Command cmdSet = new Command("Export-VM"); + cmdSet.Parameters.Add("Name", vm.Name); + cmdSet.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(exportPath)); + PowerShell.Execute(cmdSet, true); + return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } #endregion @@ -808,7 +572,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Get-VMSnapshot"); cmd.Parameters.Add("VMName", vm.Name); - Collection result = PowerShell.Execute(cmd, false); + Collection result = PowerShell.Execute(cmd, true); if (result != null && result.Count > 0) { foreach (PSObject psSnapshot in result) @@ -833,7 +597,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Get-VMSnapshot"); cmd.Parameters.Add("Id", snapshotId); - Collection result = PowerShell.Execute(cmd, false); + Collection result = PowerShell.Execute(cmd, true); if (result != null && result.Count > 0) { return SnapshotHelper.GetFromPS(result[0]); @@ -857,7 +621,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Checkpoint-VM"); cmd.Parameters.Add("Name", vm.Name); - PowerShell.Execute(cmd, false); + PowerShell.Execute(cmd, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } catch (Exception ex) @@ -879,7 +643,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("Name", snapshot.Name); cmd.Parameters.Add("NewName", name); - PowerShell.Execute(cmd, false); + PowerShell.Execute(cmd, true); return JobHelper.CreateSuccessResult(); } catch (Exception ex) @@ -900,7 +664,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", vm.Name); cmd.Parameters.Add("Name", snapshot.Name); - PowerShell.Execute(cmd, false); + PowerShell.Execute(cmd, true); return JobHelper.CreateSuccessResult(); } catch (Exception ex) @@ -1042,7 +806,10 @@ namespace WebsitePanel.Providers.Virtualization if (!string.IsNullOrEmpty(computerName)) cmd.Parameters.Add("ComputerName", computerName); if (!string.IsNullOrEmpty(type)) cmd.Parameters.Add("SwitchType", type); - Collection result = PowerShell.Execute(cmd,false); + object[] errors; + Collection result = PowerShell.Execute(cmd, false, out errors); + PowerShellManager.ExceptionIfErrors(errors); + foreach (PSObject current in result) { VirtualSwitch sw = new VirtualSwitch(); @@ -1083,7 +850,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("SwitchType", "Private"); cmd.Parameters.Add("Name", name); - Collection result = PowerShell.Execute(cmd, false); + Collection result = PowerShell.Execute(cmd, true); if (result != null && result.Count > 0) { virtualSwitch = new VirtualSwitch(); @@ -1102,7 +869,7 @@ namespace WebsitePanel.Providers.Virtualization return virtualSwitch; } - public ReturnCode DeleteSwitch(string switchId) + public ReturnCode DeleteSwitch(string switchId) // switchId is SwitchName { HostedSolutionLog.LogStart("DeleteSwitch"); HostedSolutionLog.DebugInfo("switchId: {0}", switchId); @@ -1111,7 +878,8 @@ namespace WebsitePanel.Providers.Virtualization { Command cmd = new Command("Remove-VMSwitch"); cmd.Parameters.Add("Name", switchId); - PowerShell.Execute(cmd, false); + cmd.Parameters.Add("Force"); + PowerShell.Execute(cmd, true); } catch (Exception ex) { @@ -1438,13 +1206,6 @@ namespace WebsitePanel.Providers.Virtualization } } - private string GetPropertyValue(string propertyName, XmlDocument doc) - { - string xpath = string.Format(@"//PROPERTY[@NAME = '{0}']/VALUE/child::text()", propertyName); - XmlNode node = doc.SelectSingleNode(xpath); - return node != null ? node.Value : null; - } - public MountedDiskInfo MountVirtualHardDisk(string vhdPath) { ManagementObject objImgSvc = GetImageManagementService(); @@ -1687,7 +1448,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); cmd.Parameters.Add("DestinationPath", destinationPath); cmd.Parameters.Add("VHDType", diskType.ToString()); - PowerShell.Execute(cmd, false); + PowerShell.Execute(cmd, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } catch (Exception ex) @@ -1840,53 +1601,41 @@ exit", Convert.ToInt32(objDisk["Index"]))); #region Jobs public ConcreteJob GetJob(string jobId) { - HostedSolutionLog.LogStart("GetJob"); - HostedSolutionLog.DebugInfo("jobId: {0}", jobId); + throw new NotImplementedException(); - Runspace runSpace = null; - ConcreteJob job; + //HostedSolutionLog.LogStart("GetJob"); + //HostedSolutionLog.DebugInfo("jobId: {0}", jobId); - try - { - Command cmd = new Command("Get-Job"); + //Runspace runSpace = null; + //ConcreteJob job; - if (!string.IsNullOrEmpty(jobId)) cmd.Parameters.Add("Id", jobId); + //try + //{ + // Command cmd = new Command("Get-Job"); - Collection result = PowerShell.Execute( cmd, false); - job = JobHelper.CreateFromPSObject(result); - } - catch (Exception ex) - { - HostedSolutionLog.LogError("GetJob", ex); - throw; - } + // if (!string.IsNullOrEmpty(jobId)) cmd.Parameters.Add("Id", jobId); - HostedSolutionLog.LogEnd("GetJob"); - return job; + // Collection result = PowerShell.Execute(cmd, true); + // job = JobHelper.CreateFromPSObject(result); + //} + //catch (Exception ex) + //{ + // HostedSolutionLog.LogError("GetJob", ex); + // throw; + //} + + //HostedSolutionLog.LogEnd("GetJob"); + //return job; } public List GetAllJobs() { - List jobs = new List(); - - ManagementObjectCollection objJobs = wmi.GetWmiObjects("CIM_ConcreteJob"); - foreach (ManagementObject objJob in objJobs) - jobs.Add(CreateJobFromWmiObject(objJob)); - - return jobs; + throw new NotImplementedException(); } public ChangeJobStateReturnCode ChangeJobState(string jobId, ConcreteJobRequestedState newState) { - ManagementObject objJob = GetJobWmiObject(jobId); - - // get method - ManagementBaseObject inParams = objJob.GetMethodParameters("RequestStateChange"); - inParams["RequestedState"] = (Int32)newState; - - // invoke method - ManagementBaseObject outParams = objJob.InvokeMethod("RequestStateChange", inParams, null); - return (ChangeJobStateReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + throw new NotImplementedException(); } #endregion @@ -2504,7 +2253,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); private PowerShellManager _powerShell; protected PowerShellManager PowerShell { - get { return _powerShell ?? (_powerShell = new PowerShellManager()); } + get { return _powerShell ?? (_powerShell = new PowerShellManager(ServerNameSettings)); } } #endregion diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs index 949b08bd..74298da0 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs @@ -12,12 +12,14 @@ namespace WebsitePanel.Providers.Virtualization { public class PowerShellManager : IDisposable { + private readonly string _remoteComputerName; protected static InitialSessionState session = null; protected Runspace RunSpace { get; set; } - public PowerShellManager() + public PowerShellManager(string remoteComputerName) { + _remoteComputerName = remoteComputerName; OpenRunspace(); } @@ -61,24 +63,27 @@ namespace WebsitePanel.Providers.Virtualization return Execute(cmd, true); } - public Collection Execute(Command cmd, bool useDomainController) + public Collection Execute(Command cmd, bool addComputerNameParameter) { object[] errors; - return Execute(cmd, useDomainController, out errors); + return Execute(cmd, addComputerNameParameter, out errors); } - public Collection Execute(Command cmd, out object[] errors) - { - return Execute(cmd, true, out errors); - } - - public Collection Execute(Command cmd, bool useDomainController, out object[] errors) + public Collection Execute(Command cmd, bool addComputerNameParameter, out object[] errors) { HostedSolutionLog.LogStart("Execute"); List errorList = new List(); HostedSolutionLog.DebugCommand(cmd); Collection results = null; + + // Add computerName parameter to command if it is remote server + if (addComputerNameParameter) + { + if (!string.IsNullOrEmpty(_remoteComputerName)) + cmd.Parameters.Add("ComputerName", _remoteComputerName); + } + // Create a pipeline Pipeline pipeLine = RunSpace.CreatePipeline(); using (pipeLine) @@ -88,6 +93,8 @@ namespace WebsitePanel.Providers.Virtualization // Execute the pipeline and save the objects returned. results = pipeLine.Invoke(); + // Only non-terminating errors are delivered here. + // Terminating errors raise exceptions instead. // Log out any errors in the pipeline execution // NOTE: These errors are NOT thrown as exceptions! // Be sure to check this to ensure that no errors @@ -108,52 +115,10 @@ namespace WebsitePanel.Providers.Virtualization return results; } - - /// - /// Returns the identity of the object from the shell execution result - /// - /// - /// - public static string GetResultObjectIdentity(Collection result) + public static void ExceptionIfErrors(object[] errors) { - HostedSolutionLog.LogStart("GetResultObjectIdentity"); - if (result == null) - throw new ArgumentNullException("result", "Execution result is not specified"); - - if (result.Count < 1) - throw new ArgumentException("Execution result is empty", "result"); - - if (result.Count > 1) - throw new ArgumentException("Execution result contains more than one object", "result"); - - PSMemberInfo info = result[0].Members["Identity"]; - if (info == null) - throw new ArgumentException("Execution result does not contain Identity property", "result"); - - string ret = info.Value.ToString(); - HostedSolutionLog.LogEnd("GetResultObjectIdentity"); - return ret; - } - - public static string GetResultObjectDN(Collection result) - { - HostedSolutionLog.LogStart("GetResultObjectDN"); - if (result == null) - throw new ArgumentNullException("result", "Execution result is not specified"); - - if (result.Count < 1) - throw new ArgumentException("Execution result does not contain any object"); - - if (result.Count > 1) - throw new ArgumentException("Execution result contains more than one object"); - - PSMemberInfo info = result[0].Members["DistinguishedName"]; - if (info == null) - throw new ArgumentException("Execution result does not contain DistinguishedName property", "result"); - - string ret = info.Value.ToString(); - HostedSolutionLog.LogEnd("GetResultObjectDN"); - return ret; + if (errors != null && errors.Length > 0) + throw new Exception("Invoke error: " + string.Join("; ", errors.Select(e => e.ToString()))); } } } From e96a2195b0aecc38769ccb58b925a55905474b91 Mon Sep 17 00:00:00 2001 From: AlexanderTr Date: Sun, 22 Mar 2015 07:35:09 +0300 Subject: [PATCH 02/36] wsp-10323 Convert the VSP provider into one utilizing PowerShell. Step 7 --- .../Constants.cs | 10 ++ .../Helpers/NetworkAdapterHelper.cs | 14 +- .../HyperV2012R2.cs | 168 +++++++----------- 3 files changed, 80 insertions(+), 112 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Constants.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Constants.cs index 7821a6fd..b487d4cf 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Constants.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Constants.cs @@ -8,6 +8,16 @@ namespace WebsitePanel.Providers.Virtualization { public static class Constants { + public const string CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG = "WebsitePanel.HyperV.UseDiskPartClearReadOnlyFlag"; + public const string WMI_VIRTUALIZATION_NAMESPACE = @"root\virtualization\v2"; + public const string WMI_CIMV2_NAMESPACE = @"root\cimv2"; + + public const string LIBRARY_INDEX_FILE_NAME = "index.xml"; + + public const string EXTERNAL_NETWORK_ADAPTER_NAME = "External Network Adapter"; + public const string PRIVATE_NETWORK_ADAPTER_NAME = "Private Network Adapter"; + public const string MANAGEMENT_NETWORK_ADAPTER_NAME = "Management Network Adapter"; + public const Int64 Size1G = 0x40000000; public const Int64 Size1M = 0x100000; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/NetworkAdapterHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/NetworkAdapterHelper.cs index f14f8f97..f2c99ce5 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/NetworkAdapterHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/NetworkAdapterHelper.cs @@ -10,15 +10,7 @@ using System.Threading.Tasks; namespace WebsitePanel.Providers.Virtualization { public static class NetworkAdapterHelper - { - #region Constants - - private const string EXTERNAL_NETWORK_ADAPTER_NAME = "External Network Adapter"; - private const string PRIVATE_NETWORK_ADAPTER_NAME = "Private Network Adapter"; - private const string MANAGEMENT_NETWORK_ADAPTER_NAME = "Management Network Adapter"; - - #endregion - + { public static VirtualMachineNetworkAdapter[] Get(PowerShellManager powerShell, string vmName) { List adapters = new List(); @@ -60,7 +52,7 @@ namespace WebsitePanel.Providers.Virtualization else if (vm.ExternalNetworkEnabled && !String.IsNullOrEmpty(vm.ExternalNicMacAddress) && Get(powerShell,vm.Name,vm.ExternalNicMacAddress) == null) { - Add(powerShell, vm.Name, vm.ExternalSwitchId, vm.ExternalNicMacAddress, EXTERNAL_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter); + Add(powerShell, vm.Name, vm.ExternalSwitchId, vm.ExternalNicMacAddress, Constants.EXTERNAL_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter); } // Private NIC @@ -72,7 +64,7 @@ namespace WebsitePanel.Providers.Virtualization else if (vm.PrivateNetworkEnabled && !String.IsNullOrEmpty(vm.PrivateNicMacAddress) && Get(powerShell, vm.Name, vm.PrivateNicMacAddress) == null) { - Add(powerShell, vm.Name, vm.PrivateSwitchId, vm.PrivateNicMacAddress, PRIVATE_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter); + Add(powerShell, vm.Name, vm.PrivateSwitchId, vm.PrivateNicMacAddress, Constants.PRIVATE_NETWORK_ADAPTER_NAME, vm.LegacyNetworkAdapter); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index b8ad22ab..8d8d9cdf 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -57,25 +57,6 @@ namespace WebsitePanel.Providers.Virtualization { public class HyperV2012R2 : HostingServiceProviderBase, IVirtualizationServer { - #region Constants - private const string CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG = "WebsitePanel.HyperV.UseDiskPartClearReadOnlyFlag"; - private const string WMI_VIRTUALIZATION_NAMESPACE = @"root\virtualization\v2"; - private const string WMI_CIMV2_NAMESPACE = @"root\cimv2"; - - private const int SWITCH_PORTS_NUMBER = 1024; - private const string LIBRARY_INDEX_FILE_NAME = "index.xml"; - private const string EXTERNAL_NETWORK_ADAPTER_NAME = "External Network Adapter"; - private const string PRIVATE_NETWORK_ADAPTER_NAME = "Private Network Adapter"; - private const string MANAGEMENT_NETWORK_ADAPTER_NAME = "Management Network Adapter"; - - private const string KVP_RAM_SUMMARY_KEY = "VM-RAM-Summary"; - private const string KVP_HDD_SUMMARY_KEY = "VM-HDD-Summary"; - - private const Int64 Size1G = 0x40000000; - private const Int64 Size1M = 0x100000; - - #endregion - #region Provider Settings protected string ServerNameSettings { @@ -119,16 +100,17 @@ namespace WebsitePanel.Providers.Virtualization #endregion #region Fields - private Wmi _wmi = null; + private PowerShellManager _powerShell; + protected PowerShellManager PowerShell + { + get { return _powerShell ?? (_powerShell = new PowerShellManager(ServerNameSettings)); } + } + + private Wmi _wmi; private Wmi wmi { - get - { - if (_wmi == null) - _wmi = new Wmi(ServerNameSettings, WMI_VIRTUALIZATION_NAMESPACE); - return _wmi; - } + get { return _wmi ?? (_wmi = new Wmi(ServerNameSettings, Constants.WMI_VIRTUALIZATION_NAMESPACE)); } } #endregion @@ -169,7 +151,7 @@ namespace WebsitePanel.Providers.Virtualization vm.Name = result[0].GetProperty("Name").ToString(); vm.State = result[0].GetEnum("State"); vm.CpuUsage = ConvertNullableToInt32(result[0].GetProperty("CpuUsage")); - vm.RamUsage = ConvertNullableToInt64(result[0].GetProperty("MemoryAssigned")) / Size1M; + vm.RamUsage = ConvertNullableToInt64(result[0].GetProperty("MemoryAssigned")) / Constants.Size1M; vm.Uptime = Convert.ToInt64(result[0].GetProperty("UpTime").TotalMilliseconds); vm.Status = result[0].GetProperty("Status").ToString(); vm.ReplicationState = result[0].GetProperty("ReplicationState").ToString(); @@ -203,7 +185,7 @@ namespace WebsitePanel.Providers.Virtualization if (vm.Disks != null && vm.Disks.GetLength(0) > 0) { vm.VirtualHardDrivePath = vm.Disks[0].Path; - vm.HddSize = Convert.ToInt32(vm.Disks[0].FileSize / Size1G); + vm.HddSize = Convert.ToInt32(vm.Disks[0].FileSize / Constants.Size1G); } // network adapters @@ -219,7 +201,6 @@ namespace WebsitePanel.Providers.Virtualization HostedSolutionLog.LogEnd("GetVirtualMachine"); return vm; - } public List GetVirtualMachines() @@ -557,6 +538,7 @@ namespace WebsitePanel.Providers.Virtualization PowerShell.Execute(cmdSet, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } + #endregion #region Snapshots @@ -895,7 +877,7 @@ namespace WebsitePanel.Providers.Virtualization #region Library public LibraryItem[] GetLibraryItems(string path) { - path = Path.Combine(FileUtils.EvaluateSystemVariables(path), LIBRARY_INDEX_FILE_NAME); + path = Path.Combine(FileUtils.EvaluateSystemVariables(path), Constants.LIBRARY_INDEX_FILE_NAME); // convert to UNC if it is a remote computer path = ConvertToUNC(path); @@ -971,14 +953,6 @@ namespace WebsitePanel.Providers.Virtualization return items.ToArray(); } - private string ConvertToUNC(string path) - { - if (String.IsNullOrEmpty(ServerNameSettings) - || path.StartsWith(@"\\")) - return path; - - return String.Format(@"\\{0}\{1}", ServerNameSettings, path.Replace(":", "$")); - } #endregion #region KVP @@ -1208,6 +1182,39 @@ namespace WebsitePanel.Providers.Virtualization public MountedDiskInfo MountVirtualHardDisk(string vhdPath) { + //MountedDiskInfo diskInfo = new MountedDiskInfo(); + //vhdPath = FileUtils.EvaluateSystemVariables(vhdPath); + + //// Mount disk + //Command cmd = new Command("Mount-VHD"); + + //cmd.Parameters.Add("Path", vhdPath); + //cmd.Parameters.Add("PassThru"); + + //// Get disk address + //var result = PowerShell.Execute(cmd, true); + + //try + //{ + // if (result == null || result.Count == 0) + // throw new Exception("Failed to mount disk"); + + // diskInfo.DiskAddress = result[0].GetString("DiskNumber"); + + // // Get disk volumes + + //} + //catch (Exception ex) + //{ + // // unmount disk + // UnmountVirtualHardDisk(vhdPath); + + // // throw error + // throw ex; + //} + + //return diskInfo; + ManagementObject objImgSvc = GetImageManagementService(); // get method params @@ -1264,11 +1271,11 @@ namespace WebsitePanel.Providers.Virtualization // check if DiskPart must be used to bring disk online and clear read-only flag bool useDiskPartToClearReadOnly = false; - if (ConfigurationManager.AppSettings[CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null) - useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]); + if (ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null) + useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]); // determine disk index for DiskPart - Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE); ManagementObject objDisk = cimv2.GetWmiObject("win32_diskdrive", "Model='Msft Virtual Disk SCSI Disk Device' and ScsiTargetID={0} and ScsiLogicalUnit={1} and scsiPort={2}", targetId, lun, portNumber); @@ -1401,29 +1408,23 @@ exit", Convert.ToInt32(objDisk["Index"]))); public ReturnCode UnmountVirtualHardDisk(string vhdPath) { - ManagementObject objImgSvc = GetImageManagementService(); + Command cmd = new Command("Dismount-VHD"); - // get method params - ManagementBaseObject inParams = objImgSvc.GetMethodParameters("Unmount"); - inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath); + cmd.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(vhdPath)); - ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("Unmount", inParams, null); - return (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + PowerShell.Execute(cmd, true); + return ReturnCode.OK; } public JobResult ExpandVirtualHardDisk(string vhdPath, UInt64 sizeGB) { - const UInt64 Size1G = 0x40000000; + Command cmd = new Command("Resize-VHD"); - ManagementObject objImgSvc = GetImageManagementService(); + cmd.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(vhdPath)); + cmd.Parameters.Add("SizeBytes", sizeGB * Constants.Size1G); - // get method params - ManagementBaseObject inParams = objImgSvc.GetMethodParameters("ExpandVirtualHardDisk"); - inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath); - inParams["MaxInternalSize"] = sizeGB * Size1G; - - ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("ExpandVirtualHardDisk", inParams, null); - return CreateJobResultFromWmiMethodResults(outParams); + PowerShell.Execute(cmd, true); + return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } public JobResult ConvertVirtualHardDisk(string sourcePath, string destinationPath, VirtualHardDiskType diskType) @@ -1888,15 +1889,6 @@ exit", Convert.ToInt32(objDisk["Index"]))); return value == null ? 0 : Convert.ToInt64(value); } - //protected VirtualMachineSnapshot GetSnapshotById(string id) - //{ - // var vms = GetVirtualMachines(); - // var allSnapshots = vms.SelectMany(vm => GetVirtualMachineSnapshots(vm.Id.ToString())); - - // return allSnapshots.FirstOrDefault(s => s.Id == id); - //} - - protected JobResult CreateJobResultFromWmiMethodResults(ManagementBaseObject outParams) { JobResult result = new JobResult(); @@ -1918,21 +1910,11 @@ exit", Convert.ToInt32(objDisk["Index"]))); return result; } - private ManagementObject GetJobWmiObject(string id) - { - return wmi.GetWmiObject("msvm_ConcreteJob", "InstanceID = '{0}'", id); - } - private ManagementObject GetVirtualSystemManagementService() { return wmi.GetWmiObject("msvm_VirtualSystemManagementService"); } - private ManagementObject GetVirtualSwitchManagementService() - { - return wmi.GetWmiObject("msvm_VirtualSwitchManagementService"); - } - protected ManagementObject GetImageManagementService() { return wmi.GetWmiObject("msvm_ImageManagementService"); @@ -1949,18 +1931,13 @@ exit", Convert.ToInt32(objDisk["Index"]))); wmi.GetWmiObject("Msvm_VirtualSystemSettingData", "InstanceID = '{0}'", "Microsoft:" + snapshotId); } - - - - private VirtualSwitch CreateSwitchFromWmiObject(ManagementObject objSwitch) + private string ConvertToUNC(string path) { - if (objSwitch == null || objSwitch.Properties.Count == 0) - return null; + if (String.IsNullOrEmpty(ServerNameSettings) + || path.StartsWith(@"\\")) + return path; - VirtualSwitch sw = new VirtualSwitch(); - sw.SwitchId = (string)objSwitch["Name"]; - sw.Name = (string)objSwitch["ElementName"]; - return sw; + return String.Format(@"\\{0}\{1}", ServerNameSettings, path.Replace(":", "$")); } private ConcreteJob CreateJobFromWmiObject(ManagementBaseObject objJob) @@ -2061,7 +2038,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); return File.Exists(path); else { - Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE); ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", path.Replace("\\", "\\\\")); return (objFile != null); } @@ -2073,7 +2050,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); return Directory.Exists(path); else { - Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE); ManagementObject objDir = cimv2.GetWmiObject("Win32_Directory", "Name='{0}'", path.Replace("\\", "\\\\")); return (objDir != null); } @@ -2097,7 +2074,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); return false; // copy using WMI - Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE); ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", sourceFileName.Replace("\\", "\\\\")); if (objFile == null) throw new Exception("Source file does not exists: " + sourceFileName); @@ -2247,17 +2224,6 @@ exit", Convert.ToInt32(objDisk["Index"]))); return !String.IsNullOrEmpty(connString); } #endregion Hyper-V Cloud - - #region PowerShell integration - - private PowerShellManager _powerShell; - protected PowerShellManager PowerShell - { - get { return _powerShell ?? (_powerShell = new PowerShellManager(ServerNameSettings)); } - } - - #endregion - - + } -} +} \ No newline at end of file From 2c68edf657d3c4c7516ec0066ee94e78911493e7 Mon Sep 17 00:00:00 2001 From: me Date: Sun, 22 Mar 2015 21:18:23 +0400 Subject: [PATCH 03/36] wsp-10323 Fix build settings --- .../WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj index 635edce5..d89e8c59 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj @@ -26,7 +26,7 @@ pdbonly true - bin\Release\ + ..\WebsitePanel.Server\bin\ TRACE prompt 4 From 1c4039445b0900562aa41efc930fea8dcde2f56f Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Sun, 22 Mar 2015 20:49:38 +0300 Subject: [PATCH 04/36] wsp-10323 Fix build settings --- .../WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj index d89e8c59..65ec14ae 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj @@ -26,7 +26,7 @@ pdbonly true - ..\WebsitePanel.Server\bin\ + ..\WebsitePanel.Server\bin\HyperV2012R2\ TRACE prompt 4 From 9b32591f2412e899f306da4d44e3d8d0f6a7596e Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Sun, 22 Mar 2015 21:14:05 +0300 Subject: [PATCH 05/36] renamed CRM resource group --- .../Servers/ResourceGroups.cs | 2 +- .../WebsitePanel_SharedResources.ascx.resx | 5 +++-- .../App_LocalResources/OrganizationMenu.ascx.resx | 2 +- .../App_LocalResources/UserOrganization.ascx.resx | 4 ++-- .../App_LocalResources/OrganizationHome.ascx.resx | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs index 4f9b1d21..b7a6cca0 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Servers/ResourceGroups.cs @@ -47,7 +47,7 @@ namespace WebsitePanel.EnterpriseServer public const string HostedSharePoint = "Hosted SharePoint"; public const string Exchange = "Exchange"; public const string HostedOrganizations = "Hosted Organizations"; - public const string HostedCRM = "Hosted CRM"; + public const string HostedCRM = "Hosted CRM"; // CRM 4/2011 public const string HostedCRM2013 = "Hosted CRM2013"; // CRM 2013/2015 public const string VPS = "VPS"; public const string BlackBerry = "BlackBerry"; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index 396529e1..6aa175d2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -3338,7 +3338,8 @@ Hosted Organizations - Hosted CRM + CRM 4/2011 + BlackBerry @@ -5444,7 +5445,7 @@ ESS licenses per organization - Hosted CRM 2013/2015 + CRM 2013/2015 CRM users quota (Professional license) has been reached. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx index 13b0668d..e00296b4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx @@ -133,7 +133,7 @@ Contacts - CRM + CRM 4/2011 CRM Organization diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx index e8f5dcb6..9a815be7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserOrganization.ascx.resx @@ -151,10 +151,10 @@ Contacts - Hosted Organization - CRM 2013/2015 + CRM 2013/2015 - Hosted Organization - CRM + CRM 4/2011 CRM Organization diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx index f71acc7e..7b71c51e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/App_LocalResources/OrganizationHome.ascx.resx @@ -181,7 +181,7 @@ BlackBerry - CRM + CRM 4/2011 Exchange @@ -227,7 +227,7 @@ Remote Desktop - + RDS Servers From 9c17eb9c7486d11273c3059a403edc249e076229 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Sun, 22 Mar 2015 14:45:58 -0400 Subject: [PATCH 06/36] Added tag build-2.1.0.620 for changeset 1b976062ded2 From a26a67cbf7f81ea3a7e6183782e1e428a9c7fa02 Mon Sep 17 00:00:00 2001 From: me Date: Mon, 23 Mar 2015 09:12:14 +0400 Subject: [PATCH 07/36] wsp-10323 bugfix + Step 8 --- .../VirtualizationServerProxy.cs | 79 +-- .../esVirtualizationServer.asmx.cs | 7 +- .../Virtualization/MemoryInfo.cs | 6 +- .../Virtualization/VirtualMachine.cs | 4 +- .../Helpers/VirtualMachineHelper.cs | 16 +- .../HyperV2012R2.cs | 569 +++++------------- .../IVirtualMachineCreateControl.cs | 52 ++ .../WebsitePanel/UserControls/Gauge.ascx.cs | 10 +- .../UserControls/QuotaViewer.ascx.cs | 2 +- .../WebsitePanel/VPS/VdcCreateServer.ascx | 2 + .../WebsitePanel/VPS/VdcCreateServer.ascx.cs | 38 ++ .../VPS/VdcCreateServer.ascx.designer.cs | 49 +- .../WebsitePanel.Portal.Modules.csproj | 1 + 13 files changed, 297 insertions(+), 538 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineCreateControl.cs diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/VirtualizationServerProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/VirtualizationServerProxy.cs index a206a34d..26699aa8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/VirtualizationServerProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/VirtualizationServerProxy.cs @@ -29,7 +29,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.3074 +// Runtime Version:2.0.50727.5466 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -40,7 +40,6 @@ // This source code was auto-generated by wsdl, Version=2.0.50727.42. // namespace WebsitePanel.EnterpriseServer { - using System.Xml.Serialization; using System.Web.Services; using System.ComponentModel; @@ -50,7 +49,7 @@ namespace WebsitePanel.EnterpriseServer { using WebsitePanel.Providers; using WebsitePanel.Providers.Common; using WebsitePanel.Providers.Virtualization; - using WebsitePanel.Providers.ResultObjects; + using WebsitePanel.Providers.ResultObjects; /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] @@ -171,9 +170,11 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback SendVirtualMachineSummaryLetterOperationCompleted; /// - public esVirtualizationServer() { + public esVirtualizationServer() + { this.Url = "http://127.0.0.1:9002/esVirtualizationServer.asmx"; } + /// public event GetVirtualMachinesCompletedEventHandler GetVirtualMachinesCompleted; @@ -339,7 +340,7 @@ namespace WebsitePanel.EnterpriseServer { /// public event SendVirtualMachineSummaryLetterCompletedEventHandler SendVirtualMachineSummaryLetterCompleted; - + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetVirtualMachines", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public VirtualMachineMetaItemsPaged GetVirtualMachines(int packageId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, bool recursive) { @@ -949,8 +950,8 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOperatingSystemTemplatesByServi" + - "ceId", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOperatingSystemTemplatesByService" + + "Id", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public LibraryItem[] GetOperatingSystemTemplatesByServiceId(int serviceId) { object[] results = this.Invoke("GetOperatingSystemTemplatesByServiceId", new object[] { serviceId}); @@ -1133,6 +1134,7 @@ namespace WebsitePanel.EnterpriseServer { string osTemplateFile, string password, string summaryLetterEmail, + int generation, int cpuCores, int ramMB, int hddGB, @@ -1159,6 +1161,7 @@ namespace WebsitePanel.EnterpriseServer { osTemplateFile, password, summaryLetterEmail, + generation, cpuCores, ramMB, hddGB, @@ -1189,6 +1192,7 @@ namespace WebsitePanel.EnterpriseServer { string osTemplateFile, string password, string summaryLetterEmail, + int generation, int cpuCores, int ramMB, int hddGB, @@ -1217,6 +1221,7 @@ namespace WebsitePanel.EnterpriseServer { osTemplateFile, password, summaryLetterEmail, + generation, cpuCores, ramMB, hddGB, @@ -1252,6 +1257,7 @@ namespace WebsitePanel.EnterpriseServer { string osTemplateFile, string password, string summaryLetterEmail, + int generation, int cpuCores, int ramMB, int hddGB, @@ -1272,7 +1278,7 @@ namespace WebsitePanel.EnterpriseServer { int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses) { - this.CreateVirtualMachineAsync(packageId, hostname, osTemplateFile, password, summaryLetterEmail, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, externalAddressesNumber, randomExternalAddresses, externalAddresses, privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses, null); + this.CreateVirtualMachineAsync(packageId, hostname, osTemplateFile, password, summaryLetterEmail, generation, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, externalAddressesNumber, randomExternalAddresses, externalAddresses, privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses, null); } /// @@ -1282,6 +1288,7 @@ namespace WebsitePanel.EnterpriseServer { string osTemplateFile, string password, string summaryLetterEmail, + int generation, int cpuCores, int ramMB, int hddGB, @@ -1312,6 +1319,7 @@ namespace WebsitePanel.EnterpriseServer { osTemplateFile, password, summaryLetterEmail, + generation, cpuCores, ramMB, hddGB, @@ -2462,8 +2470,8 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddVirtualMachineExternalIPAddress" + - "es", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddVirtualMachineExternalIPAddresses" + + "", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public ResultObject AddVirtualMachineExternalIPAddresses(int itemId, bool selectRandom, int addressesNumber, int[] addressId) { object[] results = this.Invoke("AddVirtualMachineExternalIPAddresses", new object[] { itemId, @@ -2513,8 +2521,8 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetVirtualMachinePrimaryExternalIP" + - "Address", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetVirtualMachinePrimaryExternalIPAd" + + "dress", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public ResultObject SetVirtualMachinePrimaryExternalIPAddress(int itemId, int addressId) { object[] results = this.Invoke("SetVirtualMachinePrimaryExternalIPAddress", new object[] { itemId, @@ -2558,8 +2566,8 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteVirtualMachineExternalIPAddr" + - "esses", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteVirtualMachineExternalIPAddres" + + "ses", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public ResultObject DeleteVirtualMachineExternalIPAddresses(int itemId, int[] addressId) { object[] results = this.Invoke("DeleteVirtualMachineExternalIPAddresses", new object[] { itemId, @@ -2644,8 +2652,7 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddVirtualMachinePrivateIPAddresse" + - "s", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddVirtualMachinePrivateIPAddresses", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public ResultObject AddVirtualMachinePrivateIPAddresses(int itemId, bool selectRandom, int addressesNumber, string[] addresses) { object[] results = this.Invoke("AddVirtualMachinePrivateIPAddresses", new object[] { itemId, @@ -2695,8 +2702,8 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetVirtualMachinePrimaryPrivateIPA" + - "ddress", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetVirtualMachinePrimaryPrivateIPAdd" + + "ress", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public ResultObject SetVirtualMachinePrimaryPrivateIPAddress(int itemId, int addressId) { object[] results = this.Invoke("SetVirtualMachinePrimaryPrivateIPAddress", new object[] { itemId, @@ -2740,8 +2747,8 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteVirtualMachinePrivateIPAddre" + - "sses", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteVirtualMachinePrivateIPAddress" + + "es", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public ResultObject DeleteVirtualMachinePrivateIPAddresses(int itemId, int[] addressId) { object[] results = this.Invoke("DeleteVirtualMachinePrivateIPAddresses", new object[] { itemId, @@ -2826,8 +2833,7 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/UpdateVirtualMachineUserPermission" + - "s", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/UpdateVirtualMachineUserPermissions", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public int UpdateVirtualMachineUserPermissions(int itemId, VirtualMachinePermission[] permissions) { object[] results = this.Invoke("UpdateVirtualMachineUserPermissions", new object[] { itemId, @@ -3112,36 +3118,8 @@ namespace WebsitePanel.EnterpriseServer { public new void CancelAsync(object userState) { base.CancelAsync(userState); } - } - - - - - - - - - - - - - - - - - - - - - - - - - - - /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] public delegate void GetVirtualMachinesCompletedEventHandler(object sender, GetVirtualMachinesCompletedEventArgs e); @@ -4602,5 +4580,4 @@ namespace WebsitePanel.EnterpriseServer { } } } - } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer.asmx.cs index cb5e7677..5ad2523e 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer.asmx.cs @@ -37,7 +37,10 @@ using System.ComponentModel; using WebsitePanel.Providers.Common; using WebsitePanel.Providers.ResultObjects; using Microsoft.Web.Services3; - +using WebsitePanel.Providers; +using WebsitePanel.Providers.Common; +using WebsitePanel.Providers.Virtualization; +using WebsitePanel.Providers.ResultObjects; using WebsitePanel.Providers.Virtualization; namespace WebsitePanel.EnterpriseServer @@ -183,7 +186,7 @@ namespace WebsitePanel.EnterpriseServer [WebMethod] public IntResult CreateVirtualMachine(int packageId, string hostname, string osTemplateFile, string password, string summaryLetterEmail, - int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock, + int generation, int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock, bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed, bool externalNetworkEnabled, int externalAddressesNumber, bool randomExternalAddresses, int[] externalAddresses, bool privateNetworkEnabled, int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MemoryInfo.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MemoryInfo.cs index 7e79088a..e25a0173 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MemoryInfo.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MemoryInfo.cs @@ -35,9 +35,9 @@ namespace WebsitePanel.Providers.Virtualization public class MemoryInfo { public bool DynamicMemoryEnabled { get; set; } - public Int64 Startup { get; set; } - public Int64 Minimum { get; set; } - public Int64 Maximum { get; set; } + public int Startup { get; set; } + public int Minimum { get; set; } + public int Maximum { get; set; } public int Buffer { get; set; } public int Priority { get; set; } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs index 11da6676..aa659526 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/VirtualMachine.cs @@ -69,8 +69,8 @@ namespace WebsitePanel.Providers.Virtualization public int CpuUsage { get; set; } [Persistent] - public long RamSize { get; set; } - public long RamUsage { get; set; } + public int RamSize { get; set; } + public int RamUsage { get; set; } [Persistent] public int HddSize { get; set; } public LogicalDisk[] HddLogicalDisks { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs index e7d05288..30aad925 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VirtualMachineHelper.cs @@ -21,7 +21,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", name); cmd.Parameters.Add("Name", "HeartBeat"); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { var statusString = result[0].GetProperty("PrimaryOperationalStatus"); @@ -41,7 +41,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", name); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { procs = Convert.ToInt32(result[0].GetProperty("Count")); @@ -58,13 +58,13 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", name); - Collection result = powerShell.Execute(cmd, false); + Collection result = powerShell.Execute(cmd, true); if (result != null && result.Count > 0) { info.DynamicMemoryEnabled = Convert.ToBoolean(result[0].GetProperty("DynamicMemoryEnabled")); - info.Startup = Convert.ToInt64(result[0].GetProperty("Startup")) / Constants.Size1M; - info.Minimum = Convert.ToInt64(result[0].GetProperty("Minimum")) / Constants.Size1M; - info.Maximum = Convert.ToInt64(result[0].GetProperty("Maximum")) / Constants.Size1M; + info.Startup = Convert.ToInt32(Convert.ToInt64(result[0].GetProperty("Startup")) / Constants.Size1M); + info.Minimum = Convert.ToInt32(Convert.ToInt64(result[0].GetProperty("Minimum")) / Constants.Size1M); + info.Maximum = Convert.ToInt32(Convert.ToInt64(result[0].GetProperty("Maximum")) / Constants.Size1M); info.Buffer = Convert.ToInt32(result[0].GetProperty("Buffer")); info.Priority = Convert.ToInt32(result[0].GetProperty("Priority")); } @@ -81,7 +81,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("Reserve", Convert.ToInt64(cpuReserveSettings * 1000)); cmd.Parameters.Add("RelativeWeight", cpuWeightSettings); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } public static void UpdateMemory(PowerShellManager powerShell, VirtualMachine vm, long ramMB) @@ -91,7 +91,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", vm.Name); cmd.Parameters.Add("StartupBytes", ramMB * Constants.Size1M); - powerShell.Execute(cmd, false); + powerShell.Execute(cmd, true); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index 7b1801ea..b86d832a 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -57,25 +57,6 @@ namespace WebsitePanel.Providers.Virtualization { public class HyperV2012R2 : HostingServiceProviderBase, IVirtualizationServer { - #region Constants - private const string CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG = "WebsitePanel.HyperV.UseDiskPartClearReadOnlyFlag"; - private const string WMI_VIRTUALIZATION_NAMESPACE = @"root\virtualization\v2"; - private const string WMI_CIMV2_NAMESPACE = @"root\cimv2"; - - private const int SWITCH_PORTS_NUMBER = 1024; - private const string LIBRARY_INDEX_FILE_NAME = "index.xml"; - private const string EXTERNAL_NETWORK_ADAPTER_NAME = "External Network Adapter"; - private const string PRIVATE_NETWORK_ADAPTER_NAME = "Private Network Adapter"; - private const string MANAGEMENT_NETWORK_ADAPTER_NAME = "Management Network Adapter"; - - private const string KVP_RAM_SUMMARY_KEY = "VM-RAM-Summary"; - private const string KVP_HDD_SUMMARY_KEY = "VM-HDD-Summary"; - - private const Int64 Size1G = 0x40000000; - private const Int64 Size1M = 0x100000; - - #endregion - #region Provider Settings protected string ServerNameSettings { @@ -119,16 +100,17 @@ namespace WebsitePanel.Providers.Virtualization #endregion #region Fields - private Wmi _wmi = null; + private PowerShellManager _powerShell; + protected PowerShellManager PowerShell + { + get { return _powerShell ?? (_powerShell = new PowerShellManager(ServerNameSettings)); } + } + + private Wmi _wmi; private Wmi wmi { - get - { - if (_wmi == null) - _wmi = new Wmi(ServerNameSettings, WMI_VIRTUALIZATION_NAMESPACE); - return _wmi; - } + get { return _wmi ?? (_wmi = new Wmi(ServerNameSettings, Constants.WMI_VIRTUALIZATION_NAMESPACE)); } } #endregion @@ -163,13 +145,13 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("Id", vmId); - Collection result = PowerShell.Execute(cmd, false); + Collection result = PowerShell.Execute(cmd, true); if (result != null && result.Count > 0) { vm.Name = result[0].GetProperty("Name").ToString(); vm.State = result[0].GetEnum("State"); vm.CpuUsage = ConvertNullableToInt32(result[0].GetProperty("CpuUsage")); - vm.RamUsage = ConvertNullableToInt64(result[0].GetProperty("MemoryAssigned")) / Size1M; + vm.RamUsage = Convert.ToInt32(ConvertNullableToInt64(result[0].GetProperty("MemoryAssigned")) / Constants.Size1M); vm.Uptime = Convert.ToInt64(result[0].GetProperty("UpTime").TotalMilliseconds); vm.Status = result[0].GetProperty("Status").ToString(); vm.ReplicationState = result[0].GetProperty("ReplicationState").ToString(); @@ -203,7 +185,7 @@ namespace WebsitePanel.Providers.Virtualization if (vm.Disks != null && vm.Disks.GetLength(0) > 0) { vm.VirtualHardDrivePath = vm.Disks[0].Path; - vm.HddSize = Convert.ToInt32(vm.Disks[0].FileSize / Size1G); + vm.HddSize = Convert.ToInt32(vm.Disks[0].FileSize / Constants.Size1G); } // network adapters @@ -219,7 +201,6 @@ namespace WebsitePanel.Providers.Virtualization HostedSolutionLog.LogEnd("GetVirtualMachine"); return vm; - } public List GetVirtualMachines() @@ -232,7 +213,7 @@ namespace WebsitePanel.Providers.Virtualization { Command cmd = new Command("Get-VM"); - Collection result = PowerShell.Execute(cmd, false); + Collection result = PowerShell.Execute(cmd, true); foreach (PSObject current in result) { VirtualMachine vm = new VirtualMachine @@ -332,8 +313,9 @@ namespace WebsitePanel.Providers.Virtualization // Add new VM Command cmdNew = new Command("New-VM"); cmdNew.Parameters.Add("Name", vm.Name); + cmdNew.Parameters.Add("Generation", vm.Generation > 1 ? vm.Generation : 1); cmdNew.Parameters.Add("VHDPath", vm.VirtualHardDrivePath); - PowerShell.Execute(cmdNew, false); + PowerShell.Execute(cmdNew, true); // Set VM Command cmdSet = new Command("Set-VM"); @@ -350,7 +332,7 @@ namespace WebsitePanel.Providers.Virtualization } if (autoStopAction != AutomaticStopAction.Undefined) cmdSet.Parameters.Add("AutomaticStopAction", autoStopAction.ToString()); - PowerShell.Execute(cmdSet, false); + PowerShell.Execute(cmdSet, true); // Get created machine Id var createdMachine = GetVirtualMachines().FirstOrDefault(m => m.Name == vm.Name); @@ -396,168 +378,6 @@ namespace WebsitePanel.Providers.Virtualization return vm; } - - private void AddVirtualMachineDvdDrive(string vmId, ManagementObject objVM) - { - // load IDE 1 controller - ManagementObject objIDE1 = wmi.GetWmiObject( - "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Emulated IDE Controller'" - + " and InstanceID Like 'Microsoft:{0}%' and Address = 1", vmId); - - // load default hard disk drive - ManagementObject objDefaultDvd = wmi.GetWmiObject( - "Msvm_ResourceAllocationSettingData", "ResourceSubType = 'Microsoft Synthetic DVD Drive'" - + " and InstanceID like '%Default'"); - ManagementObject objDvd = (ManagementObject)objDefaultDvd.Clone(); - objDvd["Parent"] = objIDE1.Path; - objDvd["Address"] = 0; - - // add DVD drive to VM resources - AddVirtualMachineResources(objVM, objDvd); - } - - private void AddNetworkAdapter(ManagementObject objVm, string switchId, string portName, string macAddress, string adapterName, bool legacyAdapter) - { - string nicClassName = GetNetworkAdapterClassName(legacyAdapter); - - string vmId = (string)objVm["Name"]; - - // check if already exists - ManagementObject objNic = wmi.GetWmiObject( - nicClassName, "InstanceID like 'Microsoft:{0}%' and Address = '{1}'", vmId, macAddress); - - if (objNic != null) - return; // exists - exit - - portName = String.Format("{0} - {1}", - portName, (adapterName == EXTERNAL_NETWORK_ADAPTER_NAME) ? "External" : "Private"); - - // Network service - ManagementObject objNetworkSvc = GetVirtualSwitchManagementService(); - - // default NIC - ManagementObject objDefaultNic = wmi.GetWmiObject(nicClassName, "InstanceID like '%Default'"); - - // find switch - ManagementObject objSwitch = wmi.GetWmiObject("msvm_VirtualSwitch", "Name = '{0}'", switchId); - - // create switch port - ManagementBaseObject inParams = objNetworkSvc.GetMethodParameters("CreateSwitchPort"); - inParams["VirtualSwitch"] = objSwitch; - inParams["Name"] = portName; - inParams["FriendlyName"] = portName; - inParams["ScopeOfResidence"] = ""; - - // invoke method - ManagementBaseObject outParams = objNetworkSvc.InvokeMethod("CreateSwitchPort", inParams, null); - - // process output parameters - ReturnCode code = (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); - if (code == ReturnCode.OK) - { - // created port - ManagementObject objPort = wmi.GetWmiObjectByPath((string)outParams["CreatedSwitchPort"]); - - // create NIC - ManagementObject objExtNic = (ManagementObject)objDefaultNic.Clone(); - objExtNic["Connection"] = new string[] { objPort.Path.Path }; - - if (!String.IsNullOrEmpty(macAddress)) - { - objExtNic["StaticMacAddress"] = true; - objExtNic["Address"] = macAddress; - } - else - { - objExtNic["StaticMacAddress"] = false; - } - objExtNic["ElementName"] = adapterName; - - if (!legacyAdapter) - objExtNic["VirtualSystemIdentifiers"] = new string[] { Guid.NewGuid().ToString("B") }; - - // add NIC - ManagementObject objCreatedExtNic = AddVirtualMachineResources(objVm, objExtNic); - } - } - - private string GetNetworkAdapterClassName(bool legacy) - { - return legacy ? "Msvm_EmulatedEthernetPortSettingData" : "Msvm_SyntheticEthernetPortSettingData"; - } - - private ManagementObject AddVirtualMachineResources(ManagementObject objVm, ManagementObject resource) - { - if (resource == null) - return resource; - - // request management service - ManagementObject objVmsvc = GetVirtualSystemManagementService(); - - // add resources - string txtResource = resource.GetText(TextFormat.CimDtd20); - ManagementBaseObject inParams = objVmsvc.GetMethodParameters("AddVirtualSystemResources"); - inParams["TargetSystem"] = objVm; - inParams["ResourceSettingData"] = new string[] { txtResource }; - ManagementBaseObject outParams = objVmsvc.InvokeMethod("AddVirtualSystemResources", inParams, null); - JobResult result = CreateJobResultFromWmiMethodResults(outParams); - - if (result.ReturnValue == ReturnCode.OK) - { - string[] wmiPaths = (string[])outParams["NewResources"]; - return wmi.GetWmiObjectByPath(wmiPaths[0]); - } - else if (result.ReturnValue == ReturnCode.JobStarted) - { - if (JobCompleted(result.Job)) - { - string[] wmiPaths = (string[])outParams["NewResources"]; - return wmi.GetWmiObjectByPath(wmiPaths[0]); - } - else - { - throw new Exception("Cannot add virtual machine resources"); - } - } - else - { - throw new Exception("Cannot add virtual machine resources: " + txtResource); - } - } - - private JobResult RemoveVirtualMachineResources(ManagementObject objVm, ManagementObject resource) - { - if (resource == null) - return null; - - // request management service - ManagementObject objVmsvc = GetVirtualSystemManagementService(); - - // remove resources - ManagementBaseObject inParams = objVmsvc.GetMethodParameters("RemoveVirtualSystemResources"); - inParams["TargetSystem"] = objVm; - inParams["ResourceSettingData"] = new string[] { resource.Path.Path }; - ManagementBaseObject outParams = objVmsvc.InvokeMethod("RemoveVirtualSystemResources", inParams, null); - JobResult result = CreateJobResultFromWmiMethodResults(outParams); - if (result.ReturnValue == ReturnCode.OK) - { - return result; - } - else if (result.ReturnValue == ReturnCode.JobStarted) - { - if (!JobCompleted(result.Job)) - { - throw new Exception("Cannot remove virtual machine resources"); - } - } - else - { - throw new Exception("Cannot remove virtual machine resources: " + resource.Path.Path); - } - - return result; - } - public JobResult ChangeVirtualMachineState(string vmId, VirtualMachineRequestedState newState) { HostedSolutionLog.LogStart("ChangeVirtualMachineState"); @@ -604,8 +424,8 @@ namespace WebsitePanel.Providers.Virtualization //cmd.Parameters.Add("AsJob"); paramList.ForEach(p => cmd.Parameters.Add(p)); - PowerShell.Execute(cmd, false); - jobResult = JobHelper.CreateSuccessResult(); + PowerShell.Execute(cmd, true); + jobResult = JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } catch (Exception ex) { @@ -633,7 +453,7 @@ namespace WebsitePanel.Providers.Virtualization if (force) cmd.Parameters.Add("Force"); //if (!string.IsNullOrEmpty(reason)) cmd.Parameters.Add("Reason", reason); - PowerShell.Execute(cmd, false); + PowerShell.Execute(cmd, true); } catch (Exception ex) { @@ -665,134 +485,60 @@ namespace WebsitePanel.Providers.Virtualization public JobResult RenameVirtualMachine(string vmId, string name) { - // load virtual machine - ManagementObject objVm = GetVirtualMachineObject(vmId); + var vm = GetVirtualMachine(vmId); - // load machine settings - ManagementObject objVmSettings = GetVirtualMachineSettingsObject(vmId); + Command cmdSet = new Command("Rename-VM"); + cmdSet.Parameters.Add("Name", vm.Name); + cmdSet.Parameters.Add("NewName", name); + PowerShell.Execute(cmdSet, true); - // rename machine - objVmSettings["ElementName"] = name; - - // save - ManagementObject objVmsvc = GetVirtualSystemManagementService(); - ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ModifyVirtualSystem"); - inParams["ComputerSystem"] = objVm.Path.Path; - inParams["SystemSettingData"] = objVmSettings.GetText(TextFormat.CimDtd20); - ManagementBaseObject outParams = objVmsvc.InvokeMethod("ModifyVirtualSystem", inParams, null); - return CreateJobResultFromWmiMethodResults(outParams); + return JobHelper.CreateSuccessResult(); } public JobResult DeleteVirtualMachine(string vmId) { - // load virtual machine object - ManagementObject objVm = GetVirtualMachineObject(vmId); - - // check state - VirtualMachine vm = GetVirtualMachine(vmId); + var vm = GetVirtualMachineEx(vmId); // The virtual computer system must be in the powered off or saved state prior to calling this method. - if (vm.State == VirtualMachineState.Saved - || vm.State == VirtualMachineState.Off) - { - // delete network adapters and ports - DeleteNetworkAdapters(objVm); - - // destroy machine - ManagementObject objVmsvc = GetVirtualSystemManagementService(); - - // get method - ManagementBaseObject inParams = objVmsvc.GetMethodParameters("DestroyVirtualSystem"); - inParams["ComputerSystem"] = objVm; - - // invoke method - ManagementBaseObject outParams = objVmsvc.InvokeMethod("DestroyVirtualSystem", inParams, null); - return CreateJobResultFromWmiMethodResults(outParams); - } - else - { + if (vm.State != VirtualMachineState.Saved && vm.State != VirtualMachineState.Off) throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Destroy method."); + + // Delete network adapters and network switchesw + foreach (var networkAdapter in vm.Adapters) + { + NetworkAdapterHelper.Delete(PowerShell, vm.Name, networkAdapter); + + if (!string.IsNullOrEmpty(networkAdapter.SwitchName)) + DeleteSwitch(networkAdapter.SwitchName); } - } - private void DeleteNetworkAdapters(ManagementObject objVM) - { - string vmId = (string)objVM["Name"]; + object[] errors; - // delete synthetic adapters - foreach (ManagementObject objNic in wmi.GetWmiObjects("Msvm_SyntheticEthernetPortSettingData", "InstanceID like 'Microsoft:{0}%'", vmId)) - DeleteNetworkAdapter(objVM, objNic); + Command cmdSet = new Command("Remove-VM"); + cmdSet.Parameters.Add("Name", vm.Name); + cmdSet.Parameters.Add("Force"); + PowerShell.Execute(cmdSet, false, out errors); - // delete legacy adapters - foreach (ManagementObject objNic in wmi.GetWmiObjects("Msvm_EmulatedEthernetPortSettingData", "InstanceID like 'Microsoft:{0}%'", vmId)) - DeleteNetworkAdapter(objVM, objNic); - } + PowerShellManager.ExceptionIfErrors(errors); - private void DeleteNetworkAdapter(ManagementObject objVM, string macAddress) - { - // locate network adapter - ManagementObject objNic = wmi.GetWmiObject("CIM_ResourceAllocationSettingData", "Address = '{0}'", macAddress); - - // delete adapter - DeleteNetworkAdapter(objVM, objNic); - } - - private void DeleteNetworkAdapter(ManagementObject objVM, ManagementObject objNic) - { - if (objNic == null) - return; - - // delete corresponding switch port - string[] conn = (string[])objNic["Connection"]; - if (conn != null && conn.Length > 0) - DeleteSwitchPort(conn[0]); - - // delete adapter - RemoveVirtualMachineResources(objVM, objNic); - } - - private void DeleteSwitchPort(string portPath) - { - // Network service - ManagementObject objNetworkSvc = GetVirtualSwitchManagementService(); - - // create switch port - ManagementBaseObject inParams = objNetworkSvc.GetMethodParameters("DeleteSwitchPort"); - inParams["SwitchPort"] = portPath; - - // invoke method - objNetworkSvc.InvokeMethod("DeleteSwitchPort", inParams, null); + return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } public JobResult ExportVirtualMachine(string vmId, string exportPath) { - // load virtual machine object - ManagementObject objVm = GetVirtualMachineObject(vmId); - - // check state - VirtualMachine vm = GetVirtualMachine(vmId); + var vm = GetVirtualMachine(vmId); // The virtual computer system must be in the powered off or saved state prior to calling this method. - if (vm.State == VirtualMachineState.Off) - { - // export machine - ManagementObject objVmsvc = GetVirtualSystemManagementService(); - - // get method - ManagementBaseObject inParams = objVmsvc.GetMethodParameters("ExportVirtualSystem"); - inParams["ComputerSystem"] = objVm; - inParams["CopyVmState"] = true; - inParams["ExportDirectory"] = FileUtils.EvaluateSystemVariables(exportPath); - - // invoke method - ManagementBaseObject outParams = objVmsvc.InvokeMethod("ExportVirtualSystem", inParams, null); - return CreateJobResultFromWmiMethodResults(outParams); - } - else - { + if (vm.State != VirtualMachineState.Off) throw new Exception("The virtual computer system must be in the powered off or saved state prior to calling Export method."); - } + + Command cmdSet = new Command("Export-VM"); + cmdSet.Parameters.Add("Name", vm.Name); + cmdSet.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(exportPath)); + PowerShell.Execute(cmdSet, true); + return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } + #endregion #region Snapshots @@ -808,7 +554,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Get-VMSnapshot"); cmd.Parameters.Add("VMName", vm.Name); - Collection result = PowerShell.Execute(cmd, false); + Collection result = PowerShell.Execute(cmd, true); if (result != null && result.Count > 0) { foreach (PSObject psSnapshot in result) @@ -833,7 +579,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Get-VMSnapshot"); cmd.Parameters.Add("Id", snapshotId); - Collection result = PowerShell.Execute(cmd, false); + Collection result = PowerShell.Execute(cmd, true); if (result != null && result.Count > 0) { return SnapshotHelper.GetFromPS(result[0]); @@ -857,7 +603,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Checkpoint-VM"); cmd.Parameters.Add("Name", vm.Name); - PowerShell.Execute(cmd, false); + PowerShell.Execute(cmd, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } catch (Exception ex) @@ -879,7 +625,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("Name", snapshot.Name); cmd.Parameters.Add("NewName", name); - PowerShell.Execute(cmd, false); + PowerShell.Execute(cmd, true); return JobHelper.CreateSuccessResult(); } catch (Exception ex) @@ -900,7 +646,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("VMName", vm.Name); cmd.Parameters.Add("Name", snapshot.Name); - PowerShell.Execute(cmd, false); + PowerShell.Execute(cmd, true); return JobHelper.CreateSuccessResult(); } catch (Exception ex) @@ -1042,7 +788,10 @@ namespace WebsitePanel.Providers.Virtualization if (!string.IsNullOrEmpty(computerName)) cmd.Parameters.Add("ComputerName", computerName); if (!string.IsNullOrEmpty(type)) cmd.Parameters.Add("SwitchType", type); - Collection result = PowerShell.Execute(cmd,false); + object[] errors; + Collection result = PowerShell.Execute(cmd, false, out errors); + PowerShellManager.ExceptionIfErrors(errors); + foreach (PSObject current in result) { VirtualSwitch sw = new VirtualSwitch(); @@ -1083,7 +832,7 @@ namespace WebsitePanel.Providers.Virtualization cmd.Parameters.Add("SwitchType", "Private"); cmd.Parameters.Add("Name", name); - Collection result = PowerShell.Execute(cmd, false); + Collection result = PowerShell.Execute(cmd, true); if (result != null && result.Count > 0) { virtualSwitch = new VirtualSwitch(); @@ -1102,7 +851,7 @@ namespace WebsitePanel.Providers.Virtualization return virtualSwitch; } - public ReturnCode DeleteSwitch(string switchId) + public ReturnCode DeleteSwitch(string switchId) // switchId is SwitchName { HostedSolutionLog.LogStart("DeleteSwitch"); HostedSolutionLog.DebugInfo("switchId: {0}", switchId); @@ -1111,7 +860,8 @@ namespace WebsitePanel.Providers.Virtualization { Command cmd = new Command("Remove-VMSwitch"); cmd.Parameters.Add("Name", switchId); - PowerShell.Execute(cmd, false); + cmd.Parameters.Add("Force"); + PowerShell.Execute(cmd, true); } catch (Exception ex) { @@ -1127,7 +877,7 @@ namespace WebsitePanel.Providers.Virtualization #region Library public LibraryItem[] GetLibraryItems(string path) { - path = Path.Combine(FileUtils.EvaluateSystemVariables(path), LIBRARY_INDEX_FILE_NAME); + path = Path.Combine(FileUtils.EvaluateSystemVariables(path), Constants.LIBRARY_INDEX_FILE_NAME); // convert to UNC if it is a remote computer path = ConvertToUNC(path); @@ -1203,14 +953,6 @@ namespace WebsitePanel.Providers.Virtualization return items.ToArray(); } - private string ConvertToUNC(string path) - { - if (String.IsNullOrEmpty(ServerNameSettings) - || path.StartsWith(@"\\")) - return path; - - return String.Format(@"\\{0}\{1}", ServerNameSettings, path.Replace(":", "$")); - } #endregion #region KVP @@ -1438,15 +1180,41 @@ namespace WebsitePanel.Providers.Virtualization } } - private string GetPropertyValue(string propertyName, XmlDocument doc) - { - string xpath = string.Format(@"//PROPERTY[@NAME = '{0}']/VALUE/child::text()", propertyName); - XmlNode node = doc.SelectSingleNode(xpath); - return node != null ? node.Value : null; - } - public MountedDiskInfo MountVirtualHardDisk(string vhdPath) { + //MountedDiskInfo diskInfo = new MountedDiskInfo(); + //vhdPath = FileUtils.EvaluateSystemVariables(vhdPath); + + //// Mount disk + //Command cmd = new Command("Mount-VHD"); + + //cmd.Parameters.Add("Path", vhdPath); + //cmd.Parameters.Add("PassThru"); + + //// Get disk address + //var result = PowerShell.Execute(cmd, true); + + //try + //{ + // if (result == null || result.Count == 0) + // throw new Exception("Failed to mount disk"); + + // diskInfo.DiskAddress = result[0].GetString("DiskNumber"); + + // // Get disk volumes + + //} + //catch (Exception ex) + //{ + // // unmount disk + // UnmountVirtualHardDisk(vhdPath); + + // // throw error + // throw ex; + //} + + //return diskInfo; + ManagementObject objImgSvc = GetImageManagementService(); // get method params @@ -1503,11 +1271,11 @@ namespace WebsitePanel.Providers.Virtualization // check if DiskPart must be used to bring disk online and clear read-only flag bool useDiskPartToClearReadOnly = false; - if (ConfigurationManager.AppSettings[CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null) - useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]); + if (ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null) + useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]); // determine disk index for DiskPart - Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE); ManagementObject objDisk = cimv2.GetWmiObject("win32_diskdrive", "Model='Msft Virtual Disk SCSI Disk Device' and ScsiTargetID={0} and ScsiLogicalUnit={1} and scsiPort={2}", targetId, lun, portNumber); @@ -1640,29 +1408,23 @@ exit", Convert.ToInt32(objDisk["Index"]))); public ReturnCode UnmountVirtualHardDisk(string vhdPath) { - ManagementObject objImgSvc = GetImageManagementService(); + Command cmd = new Command("Dismount-VHD"); - // get method params - ManagementBaseObject inParams = objImgSvc.GetMethodParameters("Unmount"); - inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath); + cmd.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(vhdPath)); - ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("Unmount", inParams, null); - return (ReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + PowerShell.Execute(cmd, true); + return ReturnCode.OK; } public JobResult ExpandVirtualHardDisk(string vhdPath, UInt64 sizeGB) { - const UInt64 Size1G = 0x40000000; + Command cmd = new Command("Resize-VHD"); - ManagementObject objImgSvc = GetImageManagementService(); + cmd.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(vhdPath)); + cmd.Parameters.Add("SizeBytes", sizeGB * Constants.Size1G); - // get method params - ManagementBaseObject inParams = objImgSvc.GetMethodParameters("ExpandVirtualHardDisk"); - inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath); - inParams["MaxInternalSize"] = sizeGB * Size1G; - - ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("ExpandVirtualHardDisk", inParams, null); - return CreateJobResultFromWmiMethodResults(outParams); + PowerShell.Execute(cmd, true); + return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } public JobResult ConvertVirtualHardDisk(string sourcePath, string destinationPath, VirtualHardDiskType diskType) @@ -1687,7 +1449,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); cmd.Parameters.Add("DestinationPath", destinationPath); cmd.Parameters.Add("VHDType", diskType.ToString()); - PowerShell.Execute(cmd, false); + PowerShell.Execute(cmd, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } catch (Exception ex) @@ -1840,53 +1602,41 @@ exit", Convert.ToInt32(objDisk["Index"]))); #region Jobs public ConcreteJob GetJob(string jobId) { - HostedSolutionLog.LogStart("GetJob"); - HostedSolutionLog.DebugInfo("jobId: {0}", jobId); + throw new NotImplementedException(); - Runspace runSpace = null; - ConcreteJob job; + //HostedSolutionLog.LogStart("GetJob"); + //HostedSolutionLog.DebugInfo("jobId: {0}", jobId); - try - { - Command cmd = new Command("Get-Job"); + //Runspace runSpace = null; + //ConcreteJob job; - if (!string.IsNullOrEmpty(jobId)) cmd.Parameters.Add("Id", jobId); + //try + //{ + // Command cmd = new Command("Get-Job"); - Collection result = PowerShell.Execute( cmd, false); - job = JobHelper.CreateFromPSObject(result); - } - catch (Exception ex) - { - HostedSolutionLog.LogError("GetJob", ex); - throw; - } + // if (!string.IsNullOrEmpty(jobId)) cmd.Parameters.Add("Id", jobId); - HostedSolutionLog.LogEnd("GetJob"); - return job; + // Collection result = PowerShell.Execute(cmd, true); + // job = JobHelper.CreateFromPSObject(result); + //} + //catch (Exception ex) + //{ + // HostedSolutionLog.LogError("GetJob", ex); + // throw; + //} + + //HostedSolutionLog.LogEnd("GetJob"); + //return job; } public List GetAllJobs() { - List jobs = new List(); - - ManagementObjectCollection objJobs = wmi.GetWmiObjects("CIM_ConcreteJob"); - foreach (ManagementObject objJob in objJobs) - jobs.Add(CreateJobFromWmiObject(objJob)); - - return jobs; + throw new NotImplementedException(); } public ChangeJobStateReturnCode ChangeJobState(string jobId, ConcreteJobRequestedState newState) { - ManagementObject objJob = GetJobWmiObject(jobId); - - // get method - ManagementBaseObject inParams = objJob.GetMethodParameters("RequestStateChange"); - inParams["RequestedState"] = (Int32)newState; - - // invoke method - ManagementBaseObject outParams = objJob.InvokeMethod("RequestStateChange", inParams, null); - return (ChangeJobStateReturnCode)Convert.ToInt32(outParams["ReturnValue"]); + throw new NotImplementedException(); } #endregion @@ -2139,15 +1889,6 @@ exit", Convert.ToInt32(objDisk["Index"]))); return value == null ? 0 : Convert.ToInt64(value); } - //protected VirtualMachineSnapshot GetSnapshotById(string id) - //{ - // var vms = GetVirtualMachines(); - // var allSnapshots = vms.SelectMany(vm => GetVirtualMachineSnapshots(vm.Id.ToString())); - - // return allSnapshots.FirstOrDefault(s => s.Id == id); - //} - - protected JobResult CreateJobResultFromWmiMethodResults(ManagementBaseObject outParams) { JobResult result = new JobResult(); @@ -2169,21 +1910,11 @@ exit", Convert.ToInt32(objDisk["Index"]))); return result; } - private ManagementObject GetJobWmiObject(string id) - { - return wmi.GetWmiObject("msvm_ConcreteJob", "InstanceID = '{0}'", id); - } - private ManagementObject GetVirtualSystemManagementService() { return wmi.GetWmiObject("msvm_VirtualSystemManagementService"); } - private ManagementObject GetVirtualSwitchManagementService() - { - return wmi.GetWmiObject("msvm_VirtualSwitchManagementService"); - } - protected ManagementObject GetImageManagementService() { return wmi.GetWmiObject("msvm_ImageManagementService"); @@ -2200,18 +1931,13 @@ exit", Convert.ToInt32(objDisk["Index"]))); wmi.GetWmiObject("Msvm_VirtualSystemSettingData", "InstanceID = '{0}'", "Microsoft:" + snapshotId); } - - - - private VirtualSwitch CreateSwitchFromWmiObject(ManagementObject objSwitch) + private string ConvertToUNC(string path) { - if (objSwitch == null || objSwitch.Properties.Count == 0) - return null; + if (String.IsNullOrEmpty(ServerNameSettings) + || path.StartsWith(@"\\")) + return path; - VirtualSwitch sw = new VirtualSwitch(); - sw.SwitchId = (string)objSwitch["Name"]; - sw.Name = (string)objSwitch["ElementName"]; - return sw; + return String.Format(@"\\{0}\{1}", ServerNameSettings, path.Replace(":", "$")); } private ConcreteJob CreateJobFromWmiObject(ManagementBaseObject objJob) @@ -2312,7 +2038,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); return File.Exists(path); else { - Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE); ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", path.Replace("\\", "\\\\")); return (objFile != null); } @@ -2324,7 +2050,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); return Directory.Exists(path); else { - Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE); ManagementObject objDir = cimv2.GetWmiObject("Win32_Directory", "Name='{0}'", path.Replace("\\", "\\\\")); return (objDir != null); } @@ -2348,7 +2074,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); return false; // copy using WMI - Wmi cimv2 = new Wmi(ServerNameSettings, WMI_CIMV2_NAMESPACE); + Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE); ManagementObject objFile = cimv2.GetWmiObject("CIM_Datafile", "Name='{0}'", sourceFileName.Replace("\\", "\\\\")); if (objFile == null) throw new Exception("Source file does not exists: " + sourceFileName); @@ -2498,17 +2224,6 @@ exit", Convert.ToInt32(objDisk["Index"]))); return !String.IsNullOrEmpty(connString); } #endregion Hyper-V Cloud - - #region PowerShell integration - - private PowerShellManager _powerShell; - protected PowerShellManager PowerShell - { - get { return _powerShell ?? (_powerShell = new PowerShellManager()); } - } - - #endregion - - + } -} +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineCreateControl.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineCreateControl.cs new file mode 100644 index 00000000..7ffcba0b --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/ProviderControls/IVirtualMachineCreateControl.cs @@ -0,0 +1,52 @@ +// Copyright (c) 2015, 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. + +using System; +using System.Data; +using System.Configuration; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; + +using WebsitePanel.Providers.Mail; +using WebsitePanel.Providers.Virtualization; + +namespace WebsitePanel.Portal +{ + /// + /// Summary description for IVirtualMachineCreateControl + /// + public interface IVirtualMachineCreateControl + { + void BindItem(VirtualMachine item); + void SaveItem(VirtualMachine item); + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Gauge.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Gauge.ascx.cs index 9a7d4440..6d80d876 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Gauge.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/Gauge.ascx.cs @@ -56,15 +56,15 @@ namespace WebsitePanel.Portal set { ViewState["DisplayText"] = value; } } - public long Progress + public int Progress { - get { return (ViewState["Progress"] != null) ? (long)ViewState["Progress"] : 0; } + get { return (ViewState["Progress"] != null) ? (int)ViewState["Progress"] : 0; } set { ViewState["Progress"] = value; } } - public long Total + public int Total { - get { return (ViewState["Total"] != null) ? (long)ViewState["Total"] : 0; } + get { return (ViewState["Total"] != null) ? (int)ViewState["Total"] : 0; } set { ViewState["Total"] = value; } } @@ -101,7 +101,7 @@ namespace WebsitePanel.Portal string bkgSrc = Page.ResolveUrl(PortalUtils.GetThemedImage("gauge_bkg.gif")); // calculate the width of the gauge - long fTotal = Total; + int fTotal = Total; int percent = (fTotal > 0) ? Convert.ToInt32(Math.Round((double)Progress / (double)fTotal * 100)) : 0; double fFilledWidth = (fTotal > 0) ? ((double)Progress / (double)fTotal * Width) : 0; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaViewer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaViewer.ascx.cs index 83bdf399..2ee49ac3 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaViewer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/QuotaViewer.ascx.cs @@ -92,7 +92,7 @@ namespace WebsitePanel.Portal private void UpdateControl() { - long total = gauge.Total; + int total = gauge.Total; if (QuotaTypeId == 1) { litValue.Text = (total == 0) ? GetLocalizedString("Text.Disabled") : GetLocalizedString("Text.Enabled"); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx index c7913290..c864299e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx @@ -189,6 +189,8 @@ + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs index 207cc239..45d7380e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs @@ -42,6 +42,8 @@ namespace WebsitePanel.Portal.VPS { protected void Page_Load(object sender, EventArgs e) { + LoadCustomProviderControl(); + if (!IsPostBack) { BindFormControls(); @@ -54,6 +56,26 @@ namespace WebsitePanel.Portal.VPS ToggleControls(); } + private void LoadCustomProviderControl() + { + try + { + LoadProviderControl(PanelSecurity.PackageId, "VPS", providerControl, "Create.ascx"); + } + catch { /* skip */ } + } + + private IVirtualMachineCreateControl CustomProviderControl + { + get + { + if (providerControl.Controls.Count == 0) + return null; + + return (IVirtualMachineCreateControl)providerControl.Controls[0]; + } + } + private void ToggleWizardSteps() { // external network @@ -113,6 +135,13 @@ namespace WebsitePanel.Portal.VPS ddlCpu.SelectedIndex = ddlCpu.Items.Count - 1; // select last (maximum) item + // the custom provider control + if (CustomProviderControl != null) + { + IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)providerControl.Controls[0]; + ctrl.BindItem(new VirtualMachine()); + } + // external network details if (PackagesHelper.IsQuotaEnabled(PanelSecurity.PackageId, Quotas.VPS_EXTERNAL_NETWORK_ENABLED)) { @@ -287,6 +316,15 @@ namespace WebsitePanel.Portal.VPS try { + VirtualMachine virtualMachine = new VirtualMachine(); + + // the custom provider control + if (CustomProviderControl != null) + { + IVirtualMachineCreateControl ctrl = (IVirtualMachineCreateControl)providerControl.Controls[0]; + ctrl.SaveItem(virtualMachine); + } + // collect and prepare data string hostname = String.Format("{0}.{1}", txtHostname.Text.Trim(), txtDomain.Text.Trim()); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.designer.cs index 7f1bb24f..c179bdcf 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.designer.cs @@ -1,38 +1,9 @@ -// Copyright (c) 2015, 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. -// Runtime Version:2.0.50727.3053 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -401,6 +372,15 @@ namespace WebsitePanel.Portal.VPS { /// protected global::System.Web.UI.WebControls.Localize locGB; + /// + /// providerControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.PlaceHolder providerControl; + /// /// secSnapshots control. /// @@ -1354,14 +1334,5 @@ namespace WebsitePanel.Portal.VPS { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Literal litPrivateAddressesList; - - /// - /// FormComments control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Localize FormComments; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index d7218b57..f80d41bc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -195,6 +195,7 @@ + From d31c1210400713542331a95281130df2bfb28e15 Mon Sep 17 00:00:00 2001 From: me Date: Mon, 23 Mar 2015 09:39:13 +0400 Subject: [PATCH 08/36] wsp-10323 Step 8 --- WebsitePanel/Database/update_db.sql | 8 ++++++-- .../WebsitePanel/VPS/VdcCreateServer.ascx.cs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 802718bc..deda7025 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -8860,10 +8860,14 @@ AND ((@GroupName IS NULL) OR (@GroupName IS NOT NULL AND RG.GroupName = @GroupNa RETURN GO --- Hyper-V 2012 R2 +-- Hyper-V 2012 R2 Provider IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [ProviderName] = 'HyperV2012R2') BEGIN -INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (350, 30, N'HyperV2012R2', N'Microsoft Hyper-V 2012 R2', N'WebsitePanel.Providers.Virtualization.HyperV2012R2, WebsitePanel.Providers.Virtualization.HyperV2012R2', N'HyperV', 1) +INSERT [dbo].[Providers] ([ProviderID], [GroupID], [ProviderName], [DisplayName], [ProviderType], [EditorControl], [DisableAutoDiscovery]) VALUES (350, 30, N'HyperV2012R2', N'Microsoft Hyper-V 2012 R2', N'WebsitePanel.Providers.Virtualization.HyperV2012R2, WebsitePanel.Providers.Virtualization.HyperV2012R2', N'HyperV2012R2', 1) +END +ELSE +BEGIN +UPDATE [dbo].[Providers] SET [EditorControl] = N'HyperV2012R2' WHERE [ProviderName] = 'HyperV2012R2' END GO diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs index 45d7380e..4fb5436e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/VdcCreateServer.ascx.cs @@ -343,7 +343,7 @@ namespace WebsitePanel.Portal.VPS // create virtual machine IntResult res = ES.Services.VPS.CreateVirtualMachine(PanelSecurity.PackageId, hostname, listOperatingSystems.SelectedValue, adminPassword, summaryEmail, - Utils.ParseInt(ddlCpu.SelectedValue), Utils.ParseInt(txtRam.Text.Trim()), + virtualMachine.Generation, Utils.ParseInt(ddlCpu.SelectedValue), Utils.ParseInt(txtRam.Text.Trim()), Utils.ParseInt(txtHdd.Text.Trim()), Utils.ParseInt(txtSnapshots.Text.Trim()), chkDvdInstalled.Checked, chkBootFromCd.Checked, chkNumLock.Checked, chkStartShutdown.Checked, chkPauseResume.Checked, chkReboot.Checked, chkReset.Checked, chkReinstall.Checked, From 8158c5369c8abbd1102de0c515839ff9028949f9 Mon Sep 17 00:00:00 2001 From: McMak Date: Mon, 23 Mar 2015 10:55:18 +0200 Subject: [PATCH 09/36] Fix empty grid after double click on lync users form. --- .../DesktopModules/WebsitePanel/Lync/LyncUsers.ascx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUsers.ascx index 926b8780..0535046a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Lync/LyncUsers.ascx @@ -67,7 +67,7 @@ - + From 8729a7f5a956162d37c8711246fe9bfba19cc763 Mon Sep 17 00:00:00 2001 From: McMak Date: Mon, 23 Mar 2015 11:31:27 +0200 Subject: [PATCH 10/36] Fix crash when attempting to sort a grid on lync users form. --- WebsitePanel/Database/update_db.sql | 134 ++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index f3cb07d2..ca90e3a3 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9133,3 +9133,137 @@ BEGIN INSERT INTO [dbo].[Quotas] (QuotaID, GroupID, QuotaOrder, QuotaName, QuotaDescription, QuotaTypeID, ServiceQuota) VALUES (552, @group_id, 3, 'HostedSharePointServer.UseSharedSSL', 'Use shared SSL Root', 1, 0) END + +GO + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetLyncUsers') +DROP PROCEDURE GetLyncUsers +GO + +SET ANSI_NULLS ON +GO +SET QUOTED_IDENTIFIER OFF +GO + +CREATE PROCEDURE [dbo].[GetLyncUsers] +( + @ItemID int, + @SortColumn nvarchar(40), + @SortDirection nvarchar(20), + @StartRow int, + @Count int +) +AS + +CREATE TABLE #TempLyncUsers +( + [ID] [int] IDENTITY(1,1) NOT NULL, + [AccountID] [int], + [ItemID] [int] NOT NULL, + [AccountName] [nvarchar](300) NOT NULL, + [DisplayName] [nvarchar](300) NOT NULL, + [UserPrincipalName] [nvarchar](300) NULL, + [SipAddress] [nvarchar](300) NULL, + [SamAccountName] [nvarchar](100) NULL, + [LyncUserPlanId] [int] NOT NULL, + [LyncUserPlanName] [nvarchar] (300) NOT NULL, +) + +DECLARE @condition nvarchar(700) +SET @condition = '' + +IF (@SortColumn = 'DisplayName') +BEGIN + SET @condition = 'ORDER BY ea.DisplayName' +END + +IF (@SortColumn = 'UserPrincipalName') +BEGIN + SET @condition = 'ORDER BY ea.UserPrincipalName' +END + +IF (@SortColumn = 'SipAddress') +BEGIN + SET @condition = 'ORDER BY ou.SipAddress' +END + +IF (@SortColumn = 'LyncUserPlanName') +BEGIN + SET @condition = 'ORDER BY lp.LyncUserPlanName' +END + +DECLARE @sql nvarchar(3500) + +set @sql = ' + INSERT INTO + #TempLyncUsers + SELECT + ea.AccountID, + ea.ItemID, + ea.AccountName, + ea.DisplayName, + ea.UserPrincipalName, + ou.SipAddress, + ea.SamAccountName, + ou.LyncUserPlanId, + lp.LyncUserPlanName + FROM + ExchangeAccounts ea + INNER JOIN + LyncUsers ou + INNER JOIN + LyncUserPlans lp + ON + ou.LyncUserPlanId = lp.LyncUserPlanId + ON + ea.AccountID = ou.AccountID + WHERE + ea.ItemID = @ItemID ' + @condition + +exec sp_executesql @sql, N'@ItemID int',@ItemID + +DECLARE @RetCount int +SELECT @RetCount = COUNT(ID) FROM #TempLyncUsers + +IF (@SortDirection = 'ASC') +BEGIN + SELECT * FROM #TempLyncUsers + WHERE ID > @StartRow AND ID <= (@StartRow + @Count) +END +ELSE +BEGIN + IF @SortColumn <> '' AND @SortColumn IS NOT NULL + BEGIN + IF (@SortColumn = 'DisplayName') + BEGIN + SELECT * FROM #TempLyncUsers + WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY DisplayName DESC + END + IF (@SortColumn = 'UserPrincipalName') + BEGIN + SELECT * FROM #TempLyncUsers + WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY UserPrincipalName DESC + END + + IF (@SortColumn = 'SipAddress') + BEGIN + SELECT * FROM #TempLyncUsers + WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY SipAddress DESC + END + + IF (@SortColumn = 'LyncUserPlanName') + BEGIN + SELECT * FROM #TempLyncUsers + WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY LyncUserPlanName DESC + END + END + ELSE + BEGIN + SELECT * FROM #TempLyncUsers + WHERE ID >@RetCount - @Count - @StartRow AND ID <= @RetCount- @StartRow ORDER BY UserPrincipalName DESC + END +END + +DROP TABLE #TempLyncUsers + +GO From ad092e2fc60f8675d79d89fc03e82af33f695746 Mon Sep 17 00:00:00 2001 From: McMak Date: Mon, 23 Mar 2015 11:43:09 +0200 Subject: [PATCH 11/36] Fix HO users popup and Organizations.SearchAccounts now populates a IsLyncUser property in OrganizationUser. --- WebsitePanel/Database/update_db.sql | 67 +++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index ca90e3a3..d5bccec6 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9267,3 +9267,70 @@ END DROP TABLE #TempLyncUsers GO + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'SearchOrganizationAccounts') +DROP PROCEDURE SearchOrganizationAccounts +GO +SET ANSI_NULLS ON +GO +SET QUOTED_IDENTIFIER OFF +GO + +CREATE PROCEDURE [dbo].[SearchOrganizationAccounts] +( + @ActorID int, + @ItemID int, + @FilterColumn nvarchar(50) = '', + @FilterValue nvarchar(50) = '', + @SortColumn nvarchar(50), + @IncludeMailboxes bit +) +AS +DECLARE @PackageID int +SELECT @PackageID = PackageID FROM ServiceItems +WHERE ItemID = @ItemID + +-- check rights +IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0 +RAISERROR('You are not allowed to access this package', 16, 1) + +-- start +DECLARE @condition nvarchar(700) +SET @condition = ' +(EA.AccountType = 7 OR (EA.AccountType = 1 AND @IncludeMailboxes = 1) ) +AND EA.ItemID = @ItemID +' + +IF @FilterColumn <> '' AND @FilterColumn IS NOT NULL +AND @FilterValue <> '' AND @FilterValue IS NOT NULL +SET @condition = @condition + ' AND ' + @FilterColumn + ' LIKE ''' + @FilterValue + '''' + +IF @SortColumn IS NULL OR @SortColumn = '' +SET @SortColumn = 'EA.DisplayName ASC' + +DECLARE @sql nvarchar(3500) + +set @sql = ' +SELECT + EA.AccountID, + EA.ItemID, + EA.AccountType, + EA.AccountName, + EA.DisplayName, + EA.PrimaryEmailAddress, + EA.SubscriberNumber, + EA.UserPrincipalName, + (CASE WHEN LU.AccountID IS NULL THEN ''false'' ELSE ''true'' END) as IsLyncUser +FROM ExchangeAccounts AS EA +LEFT JOIN LyncUsers AS LU +ON LU.AccountID = EA.AccountID +WHERE ' + @condition + +print @sql + +exec sp_executesql @sql, N'@ItemID int, @IncludeMailboxes bit', +@ItemID, @IncludeMailboxes + +RETURN + +GO From 1b1748cd86934cec76bf93ec84216bedbc2706e1 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Mon, 23 Mar 2015 03:02:01 -0700 Subject: [PATCH 12/36] Removed old sharepoint service item --- WebsitePanel/Database/update_db.sql | 101 ++++++ .../RDS/RdsServerSetting.cs | 15 + .../RDS/RdsServerSettings.cs | 43 +++ .../Users/UserSettings.cs | 1 + .../WebsitePanel.EnterpriseServer.Base.csproj | 2 + .../RemoteDesktopServicesProxy.cs | 154 ++++++++ .../Data/DataProvider.cs | 17 + .../RemoteDesktopServicesController.cs | 72 ++++ .../esRemoteDesktopServices.asmx.cs | 13 + WebsitePanel/Sources/WebsitePanel.Server.sln | 26 +- .../App_Themes/Default/Styles/Menus.css | 2 +- .../OrganizationMenu.ascx.resx | 2 +- .../SettingsRdsPolicy.ascx.resx | 153 ++++++++ .../UserAccountPolicySettings.ascx.resx | 3 + .../App_LocalResources/Menu.ascx.resx | 2 +- .../WebsitePanel/SettingsRdsPolicy.ascx | 131 +++++++ .../WebsitePanel/SettingsRdsPolicy.ascx.cs | 84 +++++ .../SettingsRdsPolicy.ascx.designer.cs | 339 ++++++++++++++++++ .../UserAccountPolicySettings.ascx | 4 + ...UserAccountPolicySettings.ascx.designer.cs | 37 +- .../WebsitePanel.Portal.Modules.csproj | 9 + 21 files changed, 1154 insertions(+), 56 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSetting.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSettings.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index c1669839..0f289fed 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9129,3 +9129,104 @@ BEGIN INSERT INTO [dbo].[Quotas] (QuotaID, GroupID, QuotaOrder, QuotaName, QuotaDescription, QuotaTypeID, ServiceQuota) VALUES (552, @group_id, 3, 'HostedSharePointServer.UseSharedSSL', 'Use shared SSL Root', 1, 0) END + + +-- RDS GPO + +IF NOT EXISTS(SELECT * FROM SYS.TABLES WHERE name = 'RDSServerSettings') +CREATE TABLE [dbo].[RDSServerSettings]( + [RdsServerId] [int] NOT NULL, + [SettingsName] [nvarchar](50) COLLATE Latin1_General_CI_AS NOT NULL, + [PropertyName] [nvarchar](50) COLLATE Latin1_General_CI_AS NOT NULL, + [PropertyValue] [ntext] COLLATE Latin1_General_CI_AS NULL, + [ApplyUsers] [BIT] NOT NULL, + [ApplyAdministrators] [BIT] NOT NULL + CONSTRAINT [PK_RDSServerSettings] PRIMARY KEY CLUSTERED +( + [RdsServerId] ASC, + [SettingsName] ASC, + [PropertyName] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +) + +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServerSettings') +DROP PROCEDURE GetRDSServerSettings +GO +CREATE PROCEDURE GetRDSServerSettings +( + @ServerId int, + @SettingsName nvarchar(50) +) +AS + SELECT RDSServerId, PropertyName, PropertyValue, ApplyUsers, ApplyAdministrators + FROM RDSServerSettings + WHERE RDSServerId = @ServerId AND SettingsName = @SettingsName +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateRDSServerSettings') +DROP PROCEDURE UpdateRDSServerSettings +GO +CREATE PROCEDURE UpdateRDSServerSettings +( + @ServerId int, + @SettingsName nvarchar(50), + @Xml ntext +) +AS + +BEGIN TRAN +DECLARE @idoc int +EXEC sp_xml_preparedocument @idoc OUTPUT, @xml + +DELETE FROM RDSServerSettings +WHERE RDSServerId = @ServerId AND SettingsName = @SettingsName + +INSERT INTO RDSServerSettings +( + RDSServerId, + SettingsName, + ApplyUsers, + ApplyAdministrators, + PropertyName, + PropertyValue +) +SELECT + @ServerId, + @SettingsName, + ApplyUsers, + ApplyAdministrators, + PropertyName, + PropertyValue +FROM OPENXML(@idoc, '/properties/property',1) WITH +( + PropertyName nvarchar(50) '@name', + PropertyValue ntext '@value', + ApplyUsers BIT '@applyUsers', + ApplyAdministrators BIT '@applyAdministrators' +) as PV + +exec sp_xml_removedocument @idoc + +COMMIT TRAN + +RETURN + +GO + + +IF EXISTS (SELECT * FROM ResourceGroups WHERE GroupName = 'SharePoint') +BEGIN + DECLARE @group_id INT + SELECT @group_id = GroupId FROM ResourceGroups WHERE GroupName = 'SharePoint' + DELETE FROM Providers WHERE GroupID = @group_id + DELETE FROM Quotas WHERE GroupID = @group_id + DELETE FROM VirtualGroups WHERE GroupID = @group_id + DELETE FROM ServiceItemTypes WHERE GroupID = @group_id + DELETE FROM ResourceGroups WHERE GroupID = @group_id +END + +GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSetting.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSetting.cs new file mode 100644 index 00000000..d51b9155 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSetting.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WebsitePanel.EnterpriseServer.Base.RDS +{ + public class RdsServerSetting + { + public string PropertyName { get; set; } + public string PropertyValue { get; set; } + public bool ApplyUsers { get; set; } + public bool ApplyAdministrators { get; set; } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSettings.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSettings.cs new file mode 100644 index 00000000..56862454 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSettings.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Linq; +using System.Text; +using System.Xml.Serialization; + +namespace WebsitePanel.EnterpriseServer.Base.RDS +{ + public class RdsServerSettings + { + private List settings = null; + + public const string LOCK_SCREEN_TIMEOUT = "LockScreenTimeout"; + public const string REMOVE_RUN_COMMAND = "RemoveRunCommand"; + public const string REMOVE_POWERSHELL_COMMAND = "RemovePowershellCommand"; + public const string HIDE_C_DRIVE = "HideCDrive"; + public const string REMOVE_SHUTDOWN_RESTART = "RemoveShutdownRestart"; + public const string DISABLE_TASK_MANAGER = "DisableTaskManager"; + public const string CHANGE_DESKTOP_DISABLED = "ChangingDesktopDisabled"; + public const string SCREEN_SAVER_DISABLED = "ScreenSaverDisabled"; + public const string DRIVE_SPACE_THRESHOLD = "DriveSpaceThreshold"; + + public string SettingsName { get; set; } + public int ServerId { get; set; } + + public List Settings + { + get + { + if (settings == null) + { + settings = new List(); + } + return settings; + } + set + { + settings = value; + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs index bd033937..251d5dbf 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs @@ -64,6 +64,7 @@ namespace WebsitePanel.EnterpriseServer public const string DEFAULT_MAILBOXPLANS = "DefaultMailboxPlans"; public const string DEFAULT_LYNCUSERPLANS = "DefaultLyncUserPlans"; public const string RDS_SETUP_LETTER = "RDSSetupLetter"; + public const string RDS_POLICY = "RdsPolicy"; public int UserId; public string SettingsName; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj index 63f2d7cd..23f8766e 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj @@ -134,6 +134,8 @@ + + Component diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs index 8a8ac9e4..4d1737fe 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs @@ -20,6 +20,7 @@ namespace WebsitePanel.EnterpriseServer { using System.Diagnostics; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.RemoteDesktopServices; + using WebsitePanel.EnterpriseServer.Base.RDS; using WebsitePanel.Providers.Common; @@ -132,6 +133,10 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback SendRdsSetupLetterOperationCompleted; + private System.Threading.SendOrPostCallback GetRdsServerSettingsOperationCompleted; + + private System.Threading.SendOrPostCallback UpdateRdsServerSettingsOperationCompleted; + /// public esRemoteDesktopServices() { this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx"; @@ -290,6 +295,12 @@ namespace WebsitePanel.EnterpriseServer { /// public event SendRdsSetupLetterCompletedEventHandler SendRdsSetupLetterCompleted; + /// + public event GetRdsServerSettingsCompletedEventHandler GetRdsServerSettingsCompleted; + + /// + public event UpdateRdsServerSettingsCompletedEventHandler UpdateRdsServerSettingsCompleted; + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public RdsCollection GetRdsCollection(int collectionId) { @@ -2569,6 +2580,97 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsServerSettings", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public RdsServerSettings GetRdsServerSettings(int serverId, string settingsName) { + object[] results = this.Invoke("GetRdsServerSettings", new object[] { + serverId, + settingsName}); + return ((RdsServerSettings)(results[0])); + } + + /// + public System.IAsyncResult BeginGetRdsServerSettings(int serverId, string settingsName, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetRdsServerSettings", new object[] { + serverId, + settingsName}, callback, asyncState); + } + + /// + public RdsServerSettings EndGetRdsServerSettings(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((RdsServerSettings)(results[0])); + } + + /// + public void GetRdsServerSettingsAsync(int serverId, string settingsName) { + this.GetRdsServerSettingsAsync(serverId, settingsName, null); + } + + /// + public void GetRdsServerSettingsAsync(int serverId, string settingsName, object userState) { + if ((this.GetRdsServerSettingsOperationCompleted == null)) { + this.GetRdsServerSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetRdsServerSettingsOperationCompleted); + } + this.InvokeAsync("GetRdsServerSettings", new object[] { + serverId, + settingsName}, this.GetRdsServerSettingsOperationCompleted, userState); + } + + private void OnGetRdsServerSettingsOperationCompleted(object arg) { + if ((this.GetRdsServerSettingsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetRdsServerSettingsCompleted(this, new GetRdsServerSettingsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/UpdateRdsServerSettings", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public int UpdateRdsServerSettings(int serverId, string settingsName, RdsServerSettings settings) { + object[] results = this.Invoke("UpdateRdsServerSettings", new object[] { + serverId, + settingsName, + settings}); + return ((int)(results[0])); + } + + /// + public System.IAsyncResult BeginUpdateRdsServerSettings(int serverId, string settingsName, RdsServerSettings settings, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("UpdateRdsServerSettings", new object[] { + serverId, + settingsName, + settings}, callback, asyncState); + } + + /// + public int EndUpdateRdsServerSettings(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((int)(results[0])); + } + + /// + public void UpdateRdsServerSettingsAsync(int serverId, string settingsName, RdsServerSettings settings) { + this.UpdateRdsServerSettingsAsync(serverId, settingsName, settings, null); + } + + /// + public void UpdateRdsServerSettingsAsync(int serverId, string settingsName, RdsServerSettings settings, object userState) { + if ((this.UpdateRdsServerSettingsOperationCompleted == null)) { + this.UpdateRdsServerSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateRdsServerSettingsOperationCompleted); + } + this.InvokeAsync("UpdateRdsServerSettings", new object[] { + serverId, + settingsName, + settings}, this.UpdateRdsServerSettingsOperationCompleted, userState); + } + + private void OnUpdateRdsServerSettingsOperationCompleted(object arg) { + if ((this.UpdateRdsServerSettingsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.UpdateRdsServerSettingsCompleted(this, new UpdateRdsServerSettingsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// public new void CancelAsync(object userState) { base.CancelAsync(userState); @@ -3900,4 +4002,56 @@ namespace WebsitePanel.EnterpriseServer { } } } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetRdsServerSettingsCompletedEventHandler(object sender, GetRdsServerSettingsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetRdsServerSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetRdsServerSettingsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public RdsServerSettings Result { + get { + this.RaiseExceptionIfNecessary(); + return ((RdsServerSettings)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void UpdateRdsServerSettingsCompletedEventHandler(object sender, UpdateRdsServerSettingsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class UpdateRdsServerSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal UpdateRdsServerSettingsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public int Result { + get { + this.RaiseExceptionIfNecessary(); + return ((int)(this.results[0])); + } + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index d83c4684..6e183d4d 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs @@ -4676,6 +4676,23 @@ namespace WebsitePanel.EnterpriseServer #region RDS + public static IDataReader GetRdsServerSettings(int serverId, string settingsName) + { + return SqlHelper.ExecuteReader(ConnectionString, CommandType.StoredProcedure, + ObjectQualifier + "GetRDSServerSettings", + new SqlParameter("@ServerId", serverId), + new SqlParameter("@SettingsName", settingsName)); + } + + public static void UpdateRdsServerSettings(int serverId, string settingsName, string xml) + { + SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, + ObjectQualifier + "UpdateRDSServerSettings", + new SqlParameter("@ServerId", serverId), + new SqlParameter("@SettingsName", settingsName), + new SqlParameter("@Xml", xml)); + } + public static int AddRdsCertificate(int serviceId, string content, byte[] hash, string fileName, DateTime? validFrom, DateTime? expiryDate) { SqlParameter rdsCertificateId = new SqlParameter("@RDSCertificateID", SqlDbType.Int); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index 3f1f8a2d..080d0c96 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -45,6 +45,7 @@ using WebsitePanel.Providers.RemoteDesktopServices; using WebsitePanel.Providers.Web; using System.Net.Mail; using System.Collections; +using WebsitePanel.EnterpriseServer.Base.RDS; namespace WebsitePanel.EnterpriseServer { @@ -320,6 +321,77 @@ namespace WebsitePanel.EnterpriseServer return SendRdsSetupLetterInternal(itemId, accountId, to, cc); } + public static RdsServerSettings GetRdsServerSettings(int serverId, string settingsName) + { + return GetRdsServerSettingsInternal(serverId, settingsName); + } + + public static int UpdateRdsServerSettings(int serverId, string settingsName, RdsServerSettings settings) + { + return UpdateRdsServerSettingsInternal(serverId, settingsName, settings); + } + + private static RdsServerSettings GetRdsServerSettingsInternal(int serverId, string settingsName) + { + IDataReader reader = DataProvider.GetRdsServerSettings(serverId, settingsName); + + var settings = new RdsServerSettings(); + settings.ServerId = serverId; + settings.SettingsName = settingsName; + + while (reader.Read()) + { + settings.Settings.Add(new RdsServerSetting + { + PropertyName = (string)reader["PropertyName"], + PropertyValue = (string)reader["PropertyValue"], + ApplyAdministrators = Convert.ToBoolean("ApplyAdministrators"), + ApplyUsers = Convert.ToBoolean("ApplyUsers") + }); + } + + reader.Close(); + + return settings; + } + + private static int UpdateRdsServerSettingsInternal(int serverId, string settingsName, RdsServerSettings settings) + { + TaskManager.StartTask("REMOTE_DESKTOP_SERVICES", "UPDATE_SETTINGS"); + + try + { + XmlDocument doc = new XmlDocument(); + XmlElement nodeProps = doc.CreateElement("properties"); + + if (settings != null) + { + foreach (var setting in settings.Settings) + { + XmlElement nodeProp = doc.CreateElement("property"); + nodeProp.SetAttribute("name", setting.PropertyName); + nodeProp.SetAttribute("value", setting.PropertyValue); + nodeProp.SetAttribute("applyUsers", setting.ApplyUsers ? "1" : "0"); + nodeProp.SetAttribute("applyAdministrators", setting.ApplyAdministrators ? "1" : "0"); + nodeProps.AppendChild(nodeProp); + } + } + + string xml = nodeProps.OuterXml; + DataProvider.UpdateRdsServerSettings(serverId, settingsName, xml); + + return 0; + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + TaskManager.CompleteTask(); + } + } + private static string GetRdsSetupLetterInternal(int itemId, int? accountId) { Organization org = OrganizationController.GetOrganization(itemId); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs index 6471f151..7b977052 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs @@ -39,6 +39,7 @@ using Microsoft.Web.Services3; using WebsitePanel.Providers.Common; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.RemoteDesktopServices; +using WebsitePanel.EnterpriseServer.Base.RDS; namespace WebsitePanel.EnterpriseServer { @@ -367,5 +368,17 @@ namespace WebsitePanel.EnterpriseServer { return RemoteDesktopServicesController.SendRdsSetupLetter(itemId, accountId, to, cc); } + + [WebMethod] + public RdsServerSettings GetRdsServerSettings(int serverId, string settingsName) + { + return RemoteDesktopServicesController.GetRdsServerSettings(serverId, settingsName); + } + + [WebMethod] + public int UpdateRdsServerSettings(int serverId, string settingsName, RdsServerSettings settings) + { + return RemoteDesktopServicesController.UpdateRdsServerSettings(serverId, settingsName, settings); + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Server.sln b/WebsitePanel/Sources/WebsitePanel.Server.sln index 2b573470..c5af78c6 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.sln +++ b/WebsitePanel/Sources/WebsitePanel.Server.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 +VisualStudioVersion = 12.0.30723.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching Application Block", "Caching Application Block", "{C8E6F2E4-A5B8-486A-A56E-92D864524682}" ProjectSection(SolutionItems) = preProject @@ -51,8 +51,6 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WebsitePanel.Providers.Mail EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WebsitePanel.Providers.Mail.Merak", "WebsitePanel.Providers.Mail.Merak\WebsitePanel.Providers.Mail.Merak.vbproj", "{2FA82B71-B32A-47DE-A17B-40DE08D0256D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.SharePoint.Sps20", "WebsitePanel.Providers.SharePoint.Sps20\WebsitePanel.Providers.SharePoint.Sps20.csproj", "{7980CF32-62ED-4BA1-9CAE-8EE7BD164719}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.Mail.AbilityMailServer", "WebsitePanel.Providers.Mail.AbilityMailServer\WebsitePanel.Providers.Mail.AbilityMailServer.csproj", "{54EE4293-6CCB-4859-8B76-90205F7B35A1}" EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WebsitePanel.Providers.Mail.ArgoMail", "WebsitePanel.Providers.Mail.ArgoMail\WebsitePanel.Providers.Mail.ArgoMail.vbproj", "{FCD88E94-349D-4BB2-A726-6E47A4F01DC2}" @@ -63,8 +61,6 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WebsitePanel.Providers.Mail EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WebsitePanel.Providers.Mail.hMailServer43", "WebsitePanel.Providers.Mail.hMailServer43\WebsitePanel.Providers.Mail.hMailServer43.vbproj", "{622E452B-E1EF-4252-8039-A28C2EA25DC1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.SharePoint.Sps30", "WebsitePanel.Providers.SharePoint.Sps30\WebsitePanel.Providers.SharePoint.Sps30.csproj", "{67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.DNS.Bind", "WebsitePanel.Providers.DNS.Bind\WebsitePanel.Providers.DNS.Bind.csproj", "{3ACCBEAE-5E1E-43E5-971C-223539832DD8}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebsitePanel.Providers.FTP.ServU", "WebsitePanel.Providers.FTP.ServU\WebsitePanel.Providers.FTP.ServU.csproj", "{41FEC24A-67A2-4BF4-8889-1D5CD0A2B43D}" @@ -346,16 +342,6 @@ Global {2FA82B71-B32A-47DE-A17B-40DE08D0256D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {2FA82B71-B32A-47DE-A17B-40DE08D0256D}.Release|Mixed Platforms.Build.0 = Release|Any CPU {2FA82B71-B32A-47DE-A17B-40DE08D0256D}.Release|x86.ActiveCfg = Release|Any CPU - {7980CF32-62ED-4BA1-9CAE-8EE7BD164719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7980CF32-62ED-4BA1-9CAE-8EE7BD164719}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7980CF32-62ED-4BA1-9CAE-8EE7BD164719}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {7980CF32-62ED-4BA1-9CAE-8EE7BD164719}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {7980CF32-62ED-4BA1-9CAE-8EE7BD164719}.Debug|x86.ActiveCfg = Debug|Any CPU - {7980CF32-62ED-4BA1-9CAE-8EE7BD164719}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7980CF32-62ED-4BA1-9CAE-8EE7BD164719}.Release|Any CPU.Build.0 = Release|Any CPU - {7980CF32-62ED-4BA1-9CAE-8EE7BD164719}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {7980CF32-62ED-4BA1-9CAE-8EE7BD164719}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {7980CF32-62ED-4BA1-9CAE-8EE7BD164719}.Release|x86.ActiveCfg = Release|Any CPU {54EE4293-6CCB-4859-8B76-90205F7B35A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {54EE4293-6CCB-4859-8B76-90205F7B35A1}.Debug|Any CPU.Build.0 = Debug|Any CPU {54EE4293-6CCB-4859-8B76-90205F7B35A1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -406,16 +392,6 @@ Global {622E452B-E1EF-4252-8039-A28C2EA25DC1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {622E452B-E1EF-4252-8039-A28C2EA25DC1}.Release|Mixed Platforms.Build.0 = Release|Any CPU {622E452B-E1EF-4252-8039-A28C2EA25DC1}.Release|x86.ActiveCfg = Release|Any CPU - {67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}.Debug|x86.ActiveCfg = Debug|Any CPU - {67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}.Release|Any CPU.Build.0 = Release|Any CPU - {67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {67B126AA-56E5-42F7-AC4F-AEE2A7D786F2}.Release|x86.ActiveCfg = Release|Any CPU {3ACCBEAE-5E1E-43E5-971C-223539832DD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3ACCBEAE-5E1E-43E5-971C-223539832DD8}.Debug|Any CPU.Build.0 = Debug|Any CPU {3ACCBEAE-5E1E-43E5-971C-223539832DD8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Menus.css b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Menus.css index 6bb79ad7..bd1b090e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Menus.css +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Themes/Default/Styles/Menus.css @@ -26,7 +26,7 @@ .TopMenu ul.AspNet-Menu li.AspNet-Menu-Hover a, .TopMenu ul.AspNet-Menu li.AspNet-Menu-Hover span {} .TopMenu ul.AspNet-Menu li ul li {margin: 0px; width: 100%;} /*.TopMenu .AspNet-Menu-Horizontal ul.AspNet-Menu ul:before {width:0; height:0; position:absolute; content:" "; top:-8px; left:50%; margin-left:-8px; border-style:solid; border-width:0 8px 8px 8px; border-color:transparent transparent #fff transparent;}*/ -.TopMenu .AspNet-Menu-Horizontal ul.AspNet-Menu ul {position: absolute; top: 100%; left: 0; z-index: 1000; float: left; min-width: 160px; padding: 5px 10px 5px 0; margin: -10px 0 0 0; list-style: none; font-size: 14px; background-color: #FFF; border: 1px solid #CCC; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); background-clip: padding-box;} +.TopMenu .AspNet-Menu-Horizontal ul.AspNet-Menu ul {position: absolute; top: 100%; left: 0; z-index: 1000; float: left; min-width: 180px; padding: 5px 10px 5px 0; margin: -10px 0 0 0; list-style: none; font-size: 14px; background-color: #FFF; border: 1px solid #CCC; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 0; -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); background-clip: padding-box;} .LeftMenu {font-size: 8pt;} .LeftMenu ul {background-color: #D1E9FF;} .LeftMenu ul.AspNet-Menu {width: 190px;} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx index 7d61c423..e7626d44 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/OrganizationMenu.ascx.resx @@ -202,7 +202,7 @@ Setup - SharePoint Foundation Server + SharePoint Foundation SharePoint Server diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx new file mode 100644 index 00000000..91b50033 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Administrators + + + Users + + + Drive Space Threshold + + + Hide C: Drive + + + Remove "Powershell" Command + + + Remove "Run" Command + + + Disable Screen Saver + + + Remove Shutdown and Restart + + + Disable Task Manager + + + Lock Screen Timeout + + + Changing Desktop Disabled + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserAccountPolicySettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserAccountPolicySettings.ascx.resx index 69f57eb1..5dee42e1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserAccountPolicySettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserAccountPolicySettings.ascx.resx @@ -147,6 +147,9 @@ Virtual Private Servers Policy + + Remote Desktop Servers Policy + WEB Policy diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx index 66d28e5b..6563c74a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/UserControls/App_LocalResources/Menu.ascx.resx @@ -166,7 +166,7 @@ Setup - SharePoint Foundation Server + SharePoint Foundation SharePoint Server diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx new file mode 100644 index 00000000..5b860eef --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx @@ -0,0 +1,131 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SettingsRdsPolicy.ascx.cs" Inherits="WebsitePanel.Portal.SettingsRdsPolicy" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="UserControls/CollapsiblePanel.ascx" %> + + + + + + + + + + + +
+ +
+ + + +
+
+
+ + + + + + + +
+ + + +
+
+
+ + + + + + + +
+ + + +
+
+
+ + + + + + + +
+ + + +
+
+
+ + + + + + + +
+ + + +
+
+
+ + + + + + + +
+ + + +
+
+
+ + + + + + + +
+ + + +
+
+
+ + + + + + + +
+ + + +
+
+
+ + + + + + +
+ +
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs new file mode 100644 index 00000000..186ce217 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; + +namespace WebsitePanel.Portal +{ + public partial class SettingsRdsPolicy : WebsitePanelControlBase, IUserSettingsEditorControl + { + private const string LOCK_SCREEN_TIMEOUT_VALUE = "LockScreenTimeoutValue"; + private const string LOCK_SCREEN_TIMEOUT_ADMINISTRATORS = "LockScreenTimeoutAdministrators"; + private const string LOCK_SCREEN_TIMEOUT_USERS = "LockScreenTimeoutUsers"; + private const string REMOVE_RUN_COMMAND_ADMINISTRATORS = "RemoveRunCommandAdministrators"; + private const string REMOVE_RUN_COMMAND_USERS = "RemoveRunCommandUsers"; + private const string REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS = "RemovePowershellCommandAdministrators"; + private const string REMOVE_POWERSHELL_COMMAND_USERS = "RemovePowershellCommandUsers"; + private const string HIDE_C_DRIVE_ADMINISTRATORS = "HideCDriveAdministrators"; + private const string HIDE_C_DRIVE_USERS = "HideCDriveUsers"; + private const string REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS = "RemoveShutdownRestartAdministrators"; + private const string REMOVE_SHUTDOWN_RESTART_USERS = "RemoveShutdownRestartUsers"; + private const string DISABLE_TASK_MANAGER_ADMINISTRATORS = "DisableTaskManagerAdministrators"; + private const string DISABLE_TASK_MANAGER_USERS = "DisableTaskManagerUsers"; + private const string CHANGE_DESKTOP_DISABLED_ADMINISTRATORS = "ChangingDesktopDisabledAdministrators"; + private const string CHANGE_DESKTOP_DISABLED_USERS = "ChangingDesktopDisabledUsers"; + private const string SCREEN_SAVER_DISABLED_ADMINISTRATORS = "ScreenSaverDisabledAdministrators"; + private const string SCREEN_SAVER_DISABLED_USERS = "ScreenSaverDisabledUsers"; + private const string DRIVE_SPACE_THRESHOLD_VALUE = "DriveSpaceThresholdValue"; + + public void BindSettings(UserSettings settings) + { + txtTimeout.Text = settings[LOCK_SCREEN_TIMEOUT_VALUE]; + cbTimeoutAdministrators.Checked = Convert.ToBoolean(settings[LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]); + cbTimeoutUsers.Checked = Convert.ToBoolean(settings[LOCK_SCREEN_TIMEOUT_USERS]); + + cbRunCommandAdministrators.Checked = Convert.ToBoolean(settings[REMOVE_RUN_COMMAND_ADMINISTRATORS]); + cbRunCommandUsers.Checked = Convert.ToBoolean(settings[REMOVE_RUN_COMMAND_USERS]); + + cbPowershellAdministrators.Checked = Convert.ToBoolean(settings[REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS]); + cbPowershellUsers.Checked = Convert.ToBoolean(settings[REMOVE_POWERSHELL_COMMAND_USERS]); + + cbHideCDriveAdministrators.Checked = Convert.ToBoolean(settings[HIDE_C_DRIVE_ADMINISTRATORS]); + cbHideCDriveUsers.Checked = Convert.ToBoolean(settings[HIDE_C_DRIVE_USERS]); + + cbShutdownAdministrators.Checked = Convert.ToBoolean(settings[REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS]); + cbShutdownUsers.Checked = Convert.ToBoolean(settings[REMOVE_SHUTDOWN_RESTART_USERS]); + + cbTaskManagerAdministrators.Checked = Convert.ToBoolean(settings[DISABLE_TASK_MANAGER_ADMINISTRATORS]); + cbTaskManagerUsers.Checked = Convert.ToBoolean(settings[DISABLE_TASK_MANAGER_USERS]); + + cbDesktopAdministrators.Checked = Convert.ToBoolean(settings[CHANGE_DESKTOP_DISABLED_ADMINISTRATORS]); + cbDesktopUsers.Checked = Convert.ToBoolean(settings[CHANGE_DESKTOP_DISABLED_USERS]); + + cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[SCREEN_SAVER_DISABLED_ADMINISTRATORS]); + cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[SCREEN_SAVER_DISABLED_USERS]); + + txtThreshold.Text = settings[DRIVE_SPACE_THRESHOLD_VALUE]; + } + + public void SaveSettings(UserSettings settings) + { + settings[LOCK_SCREEN_TIMEOUT_VALUE] = txtTimeout.Text; + settings[LOCK_SCREEN_TIMEOUT_ADMINISTRATORS] = cbTimeoutAdministrators.Checked.ToString(); + settings[LOCK_SCREEN_TIMEOUT_USERS] = cbTimeoutUsers.Checked.ToString(); + settings[REMOVE_RUN_COMMAND_ADMINISTRATORS] = cbRunCommandAdministrators.Checked.ToString(); + settings[REMOVE_RUN_COMMAND_USERS] = cbRunCommandUsers.Checked.ToString(); + settings[REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS] = cbPowershellAdministrators.Checked.ToString(); + settings[REMOVE_POWERSHELL_COMMAND_USERS] = cbPowershellUsers.Checked.ToString(); + settings[HIDE_C_DRIVE_ADMINISTRATORS] = cbHideCDriveAdministrators.Checked.ToString(); + settings[HIDE_C_DRIVE_USERS] = cbHideCDriveUsers.Checked.ToString(); + settings[REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS] = cbShutdownAdministrators.Checked.ToString(); + settings[REMOVE_SHUTDOWN_RESTART_USERS] = cbShutdownUsers.Checked.ToString(); + settings[DISABLE_TASK_MANAGER_ADMINISTRATORS] = cbTaskManagerAdministrators.Checked.ToString(); + settings[DISABLE_TASK_MANAGER_USERS] = cbTaskManagerUsers.Checked.ToString(); + settings[CHANGE_DESKTOP_DISABLED_ADMINISTRATORS] = cbDesktopAdministrators.Checked.ToString(); + settings[CHANGE_DESKTOP_DISABLED_USERS] = cbDesktopUsers.Checked.ToString(); + settings[SCREEN_SAVER_DISABLED_ADMINISTRATORS] = cbScreenSaverAdministrators.Checked.ToString(); + settings[SCREEN_SAVER_DISABLED_USERS] = cbScreenSaverUsers.Checked.ToString(); + settings[DRIVE_SPACE_THRESHOLD_VALUE] = txtThreshold.Text; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs new file mode 100644 index 00000000..ab5d3f15 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs @@ -0,0 +1,339 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class SettingsRdsPolicy { + + /// + /// secTimeout control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secTimeout; + + /// + /// timeoutPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel timeoutPanel; + + /// + /// txtTimeout control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtTimeout; + + /// + /// cbTimeoutUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbTimeoutUsers; + + /// + /// cbTimeoutAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbTimeoutAdministrators; + + /// + /// secRunCommand control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secRunCommand; + + /// + /// runCommandPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel runCommandPanel; + + /// + /// cbRunCommandUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbRunCommandUsers; + + /// + /// cbRunCommandAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbRunCommandAdministrators; + + /// + /// secPowershellCommand control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPowershellCommand; + + /// + /// powershellCommandPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel powershellCommandPanel; + + /// + /// cbPowershellUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbPowershellUsers; + + /// + /// cbPowershellAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbPowershellAdministrators; + + /// + /// secHideCDrive control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secHideCDrive; + + /// + /// hideCDrivePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel hideCDrivePanel; + + /// + /// cbHideCDriveUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbHideCDriveUsers; + + /// + /// cbHideCDriveAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbHideCDriveAdministrators; + + /// + /// secShutdown control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secShutdown; + + /// + /// shutdownPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel shutdownPanel; + + /// + /// cbShutdownUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbShutdownUsers; + + /// + /// cbShutdownAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbShutdownAdministrators; + + /// + /// secTaskManager control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secTaskManager; + + /// + /// taskManagerPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel taskManagerPanel; + + /// + /// cbTaskManagerUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbTaskManagerUsers; + + /// + /// cbTaskManagerAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbTaskManagerAdministrators; + + /// + /// secChangeDesktop control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secChangeDesktop; + + /// + /// desktopPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel desktopPanel; + + /// + /// cbDesktopUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDesktopUsers; + + /// + /// cbDesktopAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDesktopAdministrators; + + /// + /// secScreenSaver control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secScreenSaver; + + /// + /// screenSaverPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel screenSaverPanel; + + /// + /// cbScreenSaverUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbScreenSaverUsers; + + /// + /// cbScreenSaverAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbScreenSaverAdministrators; + + /// + /// secDriveSpace control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secDriveSpace; + + /// + /// driveSpacePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel driveSpacePanel; + + /// + /// txtThreshold control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtThreshold; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx index 1ea55968..89b1b10b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx @@ -63,6 +63,10 @@ +
  • + +
  • diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx.designer.cs index 708f59a5..4f52623a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountPolicySettings.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2015, 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. @@ -175,6 +147,15 @@ namespace WebsitePanel.Portal { /// protected global::System.Web.UI.WebControls.HyperLink lnkVpsPolicy; + /// + /// lnkRdsPolicy control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink lnkRdsPolicy; + /// /// btnCancel control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 06ce4377..ea79a622 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -517,6 +517,13 @@ SettingsDomainLookupLetter.ascx + + SettingsRdsPolicy.ascx + ASPXCodeBehind + + + SettingsRdsPolicy.ascx + SettingsRdsSetupLetter.ascx ASPXCodeBehind @@ -4558,6 +4565,7 @@ + @@ -4604,6 +4612,7 @@ + From d5b510aa3cfb2eb96c41cdef7cbec293991792a3 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Mon, 23 Mar 2015 06:51:21 -0400 Subject: [PATCH 13/36] Added tag build-2.1.0.621 for changeset 648933cdf289 From 1b967de004bcdecddbd12fff2a0307aa7f604578 Mon Sep 17 00:00:00 2001 From: me Date: Mon, 23 Mar 2015 19:13:25 +0400 Subject: [PATCH 14/36] wsp-10323 Step 9 --- .../VirtualizationServerController.cs | 25 +++- .../esVirtualizationServer.asmx.cs | 2 +- .../HyperV2012R2.cs | 12 +- .../PowerShellManager.cs | 14 +- .../HyperV2012R2_Create.ascx.resx | 132 ++++++++++++++++++ .../ProviderControls/HyperV2012R2_Create.ascx | 20 +++ .../HyperV2012R2_Create.ascx.cs | 51 +++++++ .../HyperV2012R2_Create.ascx.designer.cs | 51 +++++++ .../WebsitePanel.Portal.Modules.csproj | 11 ++ 9 files changed, 298 insertions(+), 20 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Create.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs index fb69ef50..254ff3e9 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Virtualization/VirtualizationServerController.cs @@ -40,6 +40,8 @@ using System.Text; using System.Collections; using System.Net.Mail; using System.Diagnostics; +using System.Linq; +using System.Net; namespace WebsitePanel.EnterpriseServer { @@ -252,6 +254,8 @@ namespace WebsitePanel.EnterpriseServer return res; } + int generation = 1; + // CPU cores int cpuCores = cntx.Quotas[Quotas.VPS_CPU_NUMBER].QuotaAllocatedValue; if (cpuCores == -1) // unlimited is not possible @@ -305,7 +309,7 @@ namespace WebsitePanel.EnterpriseServer // create server and return result return CreateVirtualMachine(packageId, hostname, osTemplate, password, summaryLetterEmail, - cpuCores, ramMB, hddGB, snapshots, + generation, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, externalAddressesNumber, randomExternalAddresses, externalAddresses, @@ -314,7 +318,7 @@ namespace WebsitePanel.EnterpriseServer public static IntResult CreateVirtualMachine(int packageId, string hostname, string osTemplateFile, string password, string summaryLetterEmail, - int cpuCores, int ramMB, int hddGB, int snapshots, + int generation, int cpuCores, int ramMB, int hddGB, int snapshots, bool dvdInstalled, bool bootFromCD, bool numLock, bool startShutdownAllowed, bool pauseResumeAllowed, bool rebootAllowed, bool resetAllowed, bool reinstallAllowed, bool externalNetworkEnabled, int externalAddressesNumber, bool randomExternalAddresses, int[] externalAddresses, @@ -454,6 +458,7 @@ namespace WebsitePanel.EnterpriseServer vm.CurrentTaskId = Guid.NewGuid().ToString("N"); // generate creation task id vm.ProvisioningStatus = VirtualMachineProvisioningStatus.InProgress; + vm.Generation = generation; vm.CpuCores = cpuCores; vm.RamSize = ramMB; vm.HddSize = hddGB; @@ -516,8 +521,9 @@ namespace WebsitePanel.EnterpriseServer } vm.RootFolderPath = EvaluateItemVariables(rootFolderPattern, vm); - vm.OperatingSystemTemplatePath = Path.Combine(templatesPath, osTemplateFile + ".vhd"); - vm.VirtualHardDrivePath = Path.Combine(vm.RootFolderPath, hostname + ".vhd"); + var correctVhdPath = GetCorrectTemplateFilePath(templatesPath, osTemplateFile); + vm.OperatingSystemTemplatePath = correctVhdPath; + vm.VirtualHardDrivePath = Path.Combine(vm.RootFolderPath, hostname + Path.GetExtension(correctVhdPath)); // save meta-item try @@ -577,6 +583,14 @@ namespace WebsitePanel.EnterpriseServer return res; } + private static string GetCorrectTemplateFilePath(string templatesPath, string osTemplateFile) + { + if (osTemplateFile.Trim().EndsWith(".vhdx")) + return Path.Combine(templatesPath, osTemplateFile); + + return Path.Combine(templatesPath, osTemplateFile + ".vhd"); + } + internal static void CreateVirtualMachineInternal(string taskId, VirtualMachine vm, LibraryItem osTemplate, int externalAddressesNumber, bool randomExternalAddresses, int[] externalAddresses, int privateAddressesNumber, bool randomPrivateAddresses, string[] privateAddresses, @@ -1195,7 +1209,8 @@ namespace WebsitePanel.EnterpriseServer // set OS template string templatesPath = settings["OsTemplatesPath"]; - item.OperatingSystemTemplatePath = Path.Combine(templatesPath, osTemplateFile + ".vhd"); + var correctVhdPath = GetCorrectTemplateFilePath(templatesPath, osTemplateFile); + item.OperatingSystemTemplatePath = correctVhdPath; try { LibraryItem[] osTemplates = GetOperatingSystemTemplatesByServiceId(serviceId); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer.asmx.cs index 5ad2523e..8bdf9045 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esVirtualizationServer.asmx.cs @@ -193,7 +193,7 @@ namespace WebsitePanel.EnterpriseServer { return VirtualizationServerController.CreateVirtualMachine(packageId, hostname, osTemplateFile, password, summaryLetterEmail, - cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, + generation, cpuCores, ramMB, hddGB, snapshots, dvdInstalled, bootFromCD, numLock, startShutdownAllowed, pauseResumeAllowed, rebootAllowed, resetAllowed, reinstallAllowed, externalNetworkEnabled, externalAddressesNumber, randomExternalAddresses, externalAddresses, privateNetworkEnabled, privateAddressesNumber, randomPrivateAddresses, privateAddresses); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index b86d832a..cb30af2e 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -315,7 +315,7 @@ namespace WebsitePanel.Providers.Virtualization cmdNew.Parameters.Add("Name", vm.Name); cmdNew.Parameters.Add("Generation", vm.Generation > 1 ? vm.Generation : 1); cmdNew.Parameters.Add("VHDPath", vm.VirtualHardDrivePath); - PowerShell.Execute(cmdNew, true); + PowerShell.Execute(cmdNew, true, true); // Set VM Command cmdSet = new Command("Set-VM"); @@ -512,14 +512,10 @@ namespace WebsitePanel.Providers.Virtualization DeleteSwitch(networkAdapter.SwitchName); } - object[] errors; - Command cmdSet = new Command("Remove-VM"); cmdSet.Parameters.Add("Name", vm.Name); cmdSet.Parameters.Add("Force"); - PowerShell.Execute(cmdSet, false, out errors); - - PowerShellManager.ExceptionIfErrors(errors); + PowerShell.Execute(cmdSet, false, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } @@ -788,9 +784,7 @@ namespace WebsitePanel.Providers.Virtualization if (!string.IsNullOrEmpty(computerName)) cmd.Parameters.Add("ComputerName", computerName); if (!string.IsNullOrEmpty(type)) cmd.Parameters.Add("SwitchType", type); - object[] errors; - Collection result = PowerShell.Execute(cmd, false, out errors); - PowerShellManager.ExceptionIfErrors(errors); + Collection result = PowerShell.Execute(cmd, false, true); foreach (PSObject current in result) { diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs index 74298da0..1f63b104 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/PowerShellManager.cs @@ -66,12 +66,13 @@ namespace WebsitePanel.Providers.Virtualization public Collection Execute(Command cmd, bool addComputerNameParameter) { object[] errors; - return Execute(cmd, addComputerNameParameter, out errors); + return Execute(cmd, addComputerNameParameter, false); } - public Collection Execute(Command cmd, bool addComputerNameParameter, out object[] errors) + public Collection Execute(Command cmd, bool addComputerNameParameter, bool withExceptions) { HostedSolutionLog.LogStart("Execute"); + List errorList = new List(); HostedSolutionLog.DebugCommand(cmd); @@ -110,14 +111,17 @@ namespace WebsitePanel.Providers.Virtualization } } pipeLine = null; - errors = errorList.ToArray(); + + if (withExceptions) + ExceptionIfErrors(errorList); + HostedSolutionLog.LogEnd("Execute"); return results; } - public static void ExceptionIfErrors(object[] errors) + private static void ExceptionIfErrors(List errors) { - if (errors != null && errors.Length > 0) + if (errors != null && errors.Count > 0) throw new Exception("Invoke error: " + string.Join("; ", errors.Select(e => e.ToString()))); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Create.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Create.ascx.resx new file mode 100644 index 00000000..5b5b2e6f --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/App_LocalResources/HyperV2012R2_Create.ascx.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + First + + + Second + + + Generation: + + + Generation + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx new file mode 100644 index 00000000..04e7bb37 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx @@ -0,0 +1,20 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HyperV2012R2_Create.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.HyperV2012R2_Create" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../../UserControls/CollapsiblePanel.ascx" %> + + + + + + + + + +
    + + + 1 + 2 + +
    +
    diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.cs new file mode 100644 index 00000000..18553f3d --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.cs @@ -0,0 +1,51 @@ +// Copyright (c) 2015, 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. + +using System; +using WebsitePanel.Providers.Virtualization; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class HyperV2012R2_Create : WebsitePanelControlBase, IVirtualMachineCreateControl + { + protected void Page_Load(object sender, EventArgs e) + { + } + + public void BindItem(VirtualMachine item) + { + var generation = item.Generation > 1 ? item.Generation : 1; + ddlGeneration.SelectedValue = generation.ToString(); + } + + public void SaveItem(VirtualMachine item) + { + item.Generation = Convert.ToInt32(ddlGeneration.SelectedValue); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.designer.cs new file mode 100644 index 00000000..ffb228ce --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/VPS/ProviderControls/HyperV2012R2_Create.ascx.designer.cs @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class HyperV2012R2_Create { + + /// + /// secGeneration control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secGeneration; + + /// + /// GenerationPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel GenerationPanel; + + /// + /// locGeneration control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locGeneration; + + /// + /// ddlGeneration control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlGeneration; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 18e0b6e0..ca62cd3b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -258,6 +258,13 @@ EnterpriseStorageOwaUsersList.ascx + + HyperV2012R2_Create.ascx + ASPXCodeBehind + + + HyperV2012R2_Create.ascx + SmarterMail100_EditAccount.ascx ASPXCodeBehind @@ -4510,6 +4517,7 @@ + @@ -4559,6 +4567,9 @@ + + Designer + From 73b48c75b4c3f83d49a9698533c1696fef28ae92 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Mon, 23 Mar 2015 22:20:22 -0700 Subject: [PATCH 15/36] Fix after merge --- WebsitePanel/Database/update_db.sql | 101 ++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index d5bccec6..33259a69 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9334,3 +9334,104 @@ exec sp_executesql @sql, N'@ItemID int, @IncludeMailboxes bit', RETURN GO + + +-- RDS GPO + +IF NOT EXISTS(SELECT * FROM SYS.TABLES WHERE name = 'RDSServerSettings') +CREATE TABLE [dbo].[RDSServerSettings]( + [RdsServerId] [int] NOT NULL, + [SettingsName] [nvarchar](50) COLLATE Latin1_General_CI_AS NOT NULL, + [PropertyName] [nvarchar](50) COLLATE Latin1_General_CI_AS NOT NULL, + [PropertyValue] [ntext] COLLATE Latin1_General_CI_AS NULL, + [ApplyUsers] [BIT] NOT NULL, + [ApplyAdministrators] [BIT] NOT NULL + CONSTRAINT [PK_RDSServerSettings] PRIMARY KEY CLUSTERED +( + [RdsServerId] ASC, + [SettingsName] ASC, + [PropertyName] ASC +)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +) + +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServerSettings') +DROP PROCEDURE GetRDSServerSettings +GO +CREATE PROCEDURE GetRDSServerSettings +( + @ServerId int, + @SettingsName nvarchar(50) +) +AS + SELECT RDSServerId, PropertyName, PropertyValue, ApplyUsers, ApplyAdministrators + FROM RDSServerSettings + WHERE RDSServerId = @ServerId AND SettingsName = @SettingsName +GO + + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateRDSServerSettings') +DROP PROCEDURE UpdateRDSServerSettings +GO +CREATE PROCEDURE UpdateRDSServerSettings +( + @ServerId int, + @SettingsName nvarchar(50), + @Xml ntext +) +AS + +BEGIN TRAN +DECLARE @idoc int +EXEC sp_xml_preparedocument @idoc OUTPUT, @xml + +DELETE FROM RDSServerSettings +WHERE RDSServerId = @ServerId AND SettingsName = @SettingsName + +INSERT INTO RDSServerSettings +( + RDSServerId, + SettingsName, + ApplyUsers, + ApplyAdministrators, + PropertyName, + PropertyValue +) +SELECT + @ServerId, + @SettingsName, + ApplyUsers, + ApplyAdministrators, + PropertyName, + PropertyValue +FROM OPENXML(@idoc, '/properties/property',1) WITH +( + PropertyName nvarchar(50) '@name', + PropertyValue ntext '@value', + ApplyUsers BIT '@applyUsers', + ApplyAdministrators BIT '@applyAdministrators' +) as PV + +exec sp_xml_removedocument @idoc + +COMMIT TRAN + +RETURN + +GO + + +IF EXISTS (SELECT * FROM ResourceGroups WHERE GroupName = 'SharePoint') +BEGIN + DECLARE @group_id INT + SELECT @group_id = GroupId FROM ResourceGroups WHERE GroupName = 'SharePoint' + DELETE FROM Providers WHERE GroupID = @group_id + DELETE FROM Quotas WHERE GroupID = @group_id + DELETE FROM VirtualGroups WHERE GroupID = @group_id + DELETE FROM ServiceItemTypes WHERE GroupID = @group_id + DELETE FROM ResourceGroups WHERE GroupID = @group_id +END + +GO \ No newline at end of file From 01d22b6ee4d1bd37fa58263f392636b0a75dcfb0 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Tue, 24 Mar 2015 08:02:41 -0400 Subject: [PATCH 16/36] Added tag build-2.1.0.622 for changeset 4c09b8879c5b From 58b6d34505cb103468cc274484cb276291926759 Mon Sep 17 00:00:00 2001 From: dev_amdtel Date: Wed, 25 Mar 2015 11:03:48 +0300 Subject: [PATCH 17/36] Fix after merge server web.config (add CRM2015 directory) --- WebsitePanel/Sources/WebsitePanel.Server/Web.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Server/Web.config b/WebsitePanel/Sources/WebsitePanel.Server/Web.config index 8074f342..7addb941 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/Web.config +++ b/WebsitePanel/Sources/WebsitePanel.Server/Web.config @@ -162,7 +162,7 @@ - + \ No newline at end of file From 83872d2437fdaf8663e268869837c0e859840497 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Wed, 25 Mar 2015 06:41:35 -0700 Subject: [PATCH 18/36] Foundation Sharepoint Server fixes --- WebsitePanel/Database/update_db.sql | 14 + .../RDS/RdsServerSettings.cs | 29 +- .../HostedSharePointServersProxy.cs | 164 +++---- .../HostedSharePointServerController.cs | 37 +- .../esHostedSharePointServers.asmx.cs | 19 +- .../WebsitePanel_SharedResources.ascx.resx | 8 +- .../HostedSharePointSiteCollectionsHelper.cs | 16 +- ...stedSharePointBackupSiteCollection.ascx.cs | 6 +- ...HostedSharePointEditSiteCollection.ascx.cs | 33 +- ...tedSharePointRestoreSiteCollection.ascx.cs | 7 +- .../HostedSharePointSiteCollections.ascx | 1 + .../HostedSharePointSiteCollections.ascx.cs | 9 +- ...SharePointSiteCollections.ascx.designer.cs | 28 -- .../RDSEditUserExperience.ascx.resx | 153 +++++++ .../RDS/RDSEditUserExperience.ascx | 163 +++++++ .../RDS/RDSEditUserExperience.ascx.cs | 142 +++++++ .../RDSEditUserExperience.ascx.designer.cs | 402 ++++++++++++++++++ .../RDSCollectionTabs.ascx.resx | 3 + .../UserControls/RDSCollectionTabs.ascx.cs | 3 +- .../WebsitePanel/SettingsRdsPolicy.ascx.cs | 96 ++--- .../UserControls/OrganizationMenuControl.cs | 34 +- .../WebsitePanel.Portal.Modules.csproj | 9 + 22 files changed, 1141 insertions(+), 235 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 33259a69..300fb46c 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9434,4 +9434,18 @@ BEGIN DELETE FROM ResourceGroups WHERE GroupID = @group_id END +GO + +IF NOT EXISTS (SELECT * FROM [dbo].[ServiceItemTypes] WHERE DisplayName = 'SharePointFoundationSiteCollection') +BEGIN + DECLARE @group_id AS INT + DECLARE @item_type_id INT + SELECT TOP 1 @item_type_id = ItemTypeId + 1 FROM [dbo].[ServiceItemTypes] ORDER BY ItemTypeId DESC + UPDATE [dbo].[ServiceItemTypes] SET DisplayName = 'SharePointFoundationSiteCollection' WHERE DisplayName = 'SharePointSiteCollection' + SELECT @group_id = GroupId FROM [dbo].[ResourceGroups] WHERE GroupName = 'Sharepoint Server' + + INSERT INTO [dbo].[ServiceItemTypes] (ItemTypeId, GroupId, DisplayName, TypeName, 100, CalculateDiskSpace, CalculateBandwidth, Suspendable, Disposable, Searchable, Importable, Backupable) + (SELECT TOP 1 @item_type_id, @group_id, 'SharePointSiteCollection', TypeName, TypeOrder, CalculateDiskSpace, CalculateBandwidth, Suspendable, Disposable, Searchable, Importable, Backupable FROM [dbo].[ServiceItemTypes] WHERE DisplayName = 'SharePointFoundationSiteCollection') +END + GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSettings.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSettings.cs index 56862454..983ac341 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/RDS/RdsServerSettings.cs @@ -10,16 +10,25 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS public class RdsServerSettings { private List settings = null; - - public const string LOCK_SCREEN_TIMEOUT = "LockScreenTimeout"; - public const string REMOVE_RUN_COMMAND = "RemoveRunCommand"; - public const string REMOVE_POWERSHELL_COMMAND = "RemovePowershellCommand"; - public const string HIDE_C_DRIVE = "HideCDrive"; - public const string REMOVE_SHUTDOWN_RESTART = "RemoveShutdownRestart"; - public const string DISABLE_TASK_MANAGER = "DisableTaskManager"; - public const string CHANGE_DESKTOP_DISABLED = "ChangingDesktopDisabled"; - public const string SCREEN_SAVER_DISABLED = "ScreenSaverDisabled"; - public const string DRIVE_SPACE_THRESHOLD = "DriveSpaceThreshold"; + + public const string LOCK_SCREEN_TIMEOUT_VALUE = "LockScreenTimeoutValue"; + public const string LOCK_SCREEN_TIMEOUT_ADMINISTRATORS = "LockScreenTimeoutAdministrators"; + public const string LOCK_SCREEN_TIMEOUT_USERS = "LockScreenTimeoutUsers"; + public const string REMOVE_RUN_COMMAND_ADMINISTRATORS = "RemoveRunCommandAdministrators"; + public const string REMOVE_RUN_COMMAND_USERS = "RemoveRunCommandUsers"; + public const string REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS = "RemovePowershellCommandAdministrators"; + public const string REMOVE_POWERSHELL_COMMAND_USERS = "RemovePowershellCommandUsers"; + public const string HIDE_C_DRIVE_ADMINISTRATORS = "HideCDriveAdministrators"; + public const string HIDE_C_DRIVE_USERS = "HideCDriveUsers"; + public const string REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS = "RemoveShutdownRestartAdministrators"; + public const string REMOVE_SHUTDOWN_RESTART_USERS = "RemoveShutdownRestartUsers"; + public const string DISABLE_TASK_MANAGER_ADMINISTRATORS = "DisableTaskManagerAdministrators"; + public const string DISABLE_TASK_MANAGER_USERS = "DisableTaskManagerUsers"; + public const string CHANGE_DESKTOP_DISABLED_ADMINISTRATORS = "ChangingDesktopDisabledAdministrators"; + public const string CHANGE_DESKTOP_DISABLED_USERS = "ChangingDesktopDisabledUsers"; + public const string SCREEN_SAVER_DISABLED_ADMINISTRATORS = "ScreenSaverDisabledAdministrators"; + public const string SCREEN_SAVER_DISABLED_USERS = "ScreenSaverDisabledUsers"; + public const string DRIVE_SPACE_THRESHOLD_VALUE = "DriveSpaceThresholdValue"; public string SettingsName { get; set; } public int ServerId { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs index 79deabc2..0a2fb384 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/HostedSharePointServersProxy.cs @@ -1,35 +1,7 @@ -// Copyright (c) 2015, 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. -// Runtime Version:2.0.50727.1433 +// Runtime Version:2.0.50727.7905 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -37,22 +9,21 @@ //------------------------------------------------------------------------------ // -// This source code was auto-generated by wsdl, Version=2.0.50727.42. +// This source code was auto-generated by wsdl, Version=2.0.50727.3038. // -using WebsitePanel.Providers; -using WebsitePanel.Providers.SharePoint; - namespace WebsitePanel.EnterpriseServer { - using System.Diagnostics; + using System.Xml.Serialization; using System.Web.Services; using System.ComponentModel; using System.Web.Services.Protocols; using System; - using System.Xml.Serialization; + using System.Diagnostics; + using WebsitePanel.Providers.SharePoint; + using WebsitePanel.Providers; /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="esHostedSharePointServersSoap", Namespace="http://smbsaas/websitepanel/enterpriseserver")] @@ -91,7 +62,7 @@ namespace WebsitePanel.EnterpriseServer { /// public esHostedSharePointServers() { - this.Url = "http://localhost/WebsitePanelEnterpriseServer/esHostedSharePointServers.asmx"; + this.Url = "http://localhost:9002/esHostedSharePointServers.asmx"; } /// @@ -141,7 +112,7 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetSiteCollectionsPaged", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { + public SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName) { object[] results = this.Invoke("GetSiteCollectionsPaged", new object[] { packageId, organizationId, @@ -149,12 +120,13 @@ namespace WebsitePanel.EnterpriseServer { filterValue, sortColumn, startRow, - maximumRows}); + maximumRows, + groupName}); return ((SharePointSiteCollectionListPaged)(results[0])); } /// - public System.IAsyncResult BeginGetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetSiteCollectionsPaged", new object[] { packageId, organizationId, @@ -162,7 +134,8 @@ namespace WebsitePanel.EnterpriseServer { filterValue, sortColumn, startRow, - maximumRows}, callback, asyncState); + maximumRows, + groupName}, callback, asyncState); } /// @@ -172,12 +145,12 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void GetSiteCollectionsPagedAsync(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) { - this.GetSiteCollectionsPagedAsync(packageId, organizationId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null); + public void GetSiteCollectionsPagedAsync(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName) { + this.GetSiteCollectionsPagedAsync(packageId, organizationId, filterColumn, filterValue, sortColumn, startRow, maximumRows, groupName, null); } /// - public void GetSiteCollectionsPagedAsync(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) { + public void GetSiteCollectionsPagedAsync(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName, object userState) { if ((this.GetSiteCollectionsPagedOperationCompleted == null)) { this.GetSiteCollectionsPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetSiteCollectionsPagedOperationCompleted); } @@ -188,7 +161,8 @@ namespace WebsitePanel.EnterpriseServer { filterValue, sortColumn, startRow, - maximumRows}, this.GetSiteCollectionsPagedOperationCompleted, userState); + maximumRows, + groupName}, this.GetSiteCollectionsPagedOperationCompleted, userState); } private void OnGetSiteCollectionsPagedOperationCompleted(object arg) { @@ -241,18 +215,20 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetSiteCollections", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public SharePointSiteCollection[] GetSiteCollections(int packageId, bool recursive) { + public SharePointSiteCollection[] GetSiteCollections(int packageId, bool recursive, string groupName) { object[] results = this.Invoke("GetSiteCollections", new object[] { packageId, - recursive}); + recursive, + groupName}); return ((SharePointSiteCollection[])(results[0])); } /// - public System.IAsyncResult BeginGetSiteCollections(int packageId, bool recursive, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginGetSiteCollections(int packageId, bool recursive, string groupName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetSiteCollections", new object[] { packageId, - recursive}, callback, asyncState); + recursive, + groupName}, callback, asyncState); } /// @@ -262,18 +238,19 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void GetSiteCollectionsAsync(int packageId, bool recursive) { - this.GetSiteCollectionsAsync(packageId, recursive, null); + public void GetSiteCollectionsAsync(int packageId, bool recursive, string groupName) { + this.GetSiteCollectionsAsync(packageId, recursive, groupName, null); } /// - public void GetSiteCollectionsAsync(int packageId, bool recursive, object userState) { + public void GetSiteCollectionsAsync(int packageId, bool recursive, string groupName, object userState) { if ((this.GetSiteCollectionsOperationCompleted == null)) { this.GetSiteCollectionsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetSiteCollectionsOperationCompleted); } this.InvokeAsync("GetSiteCollections", new object[] { packageId, - recursive}, this.GetSiteCollectionsOperationCompleted, userState); + recursive, + groupName}, this.GetSiteCollectionsOperationCompleted, userState); } private void OnGetSiteCollectionsOperationCompleted(object arg) { @@ -420,16 +397,18 @@ namespace WebsitePanel.EnterpriseServer { /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddSiteCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public int AddSiteCollection(SharePointSiteCollection item) { + public int AddSiteCollection(SharePointSiteCollection item, string groupName) { object[] results = this.Invoke("AddSiteCollection", new object[] { - item}); + item, + groupName}); return ((int)(results[0])); } /// - public System.IAsyncResult BeginAddSiteCollection(SharePointSiteCollection item, System.AsyncCallback callback, object asyncState) { + public System.IAsyncResult BeginAddSiteCollection(SharePointSiteCollection item, string groupName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("AddSiteCollection", new object[] { - item}, callback, asyncState); + item, + groupName}, callback, asyncState); } /// @@ -439,17 +418,18 @@ namespace WebsitePanel.EnterpriseServer { } /// - public void AddSiteCollectionAsync(SharePointSiteCollection item) { - this.AddSiteCollectionAsync(item, null); + public void AddSiteCollectionAsync(SharePointSiteCollection item, string groupName) { + this.AddSiteCollectionAsync(item, groupName, null); } /// - public void AddSiteCollectionAsync(SharePointSiteCollection item, object userState) { + public void AddSiteCollectionAsync(SharePointSiteCollection item, string groupName, object userState) { if ((this.AddSiteCollectionOperationCompleted == null)) { this.AddSiteCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddSiteCollectionOperationCompleted); } this.InvokeAsync("AddSiteCollection", new object[] { - item}, this.AddSiteCollectionOperationCompleted, userState); + item, + groupName}, this.AddSiteCollectionOperationCompleted, userState); } private void OnAddSiteCollectionOperationCompleted(object arg) { @@ -839,16 +819,12 @@ namespace WebsitePanel.EnterpriseServer { } } - - - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetSiteCollectionsPagedCompletedEventHandler(object sender, GetSiteCollectionsPagedCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetSiteCollectionsPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -870,11 +846,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetSupportedLanguagesCompletedEventHandler(object sender, GetSupportedLanguagesCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetSupportedLanguagesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -896,11 +872,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetSiteCollectionsCompletedEventHandler(object sender, GetSiteCollectionsCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetSiteCollectionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -922,11 +898,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void SetStorageSettingsCompletedEventHandler(object sender, SetStorageSettingsCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class SetStorageSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -948,11 +924,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetSiteCollectionCompletedEventHandler(object sender, GetSiteCollectionCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -974,11 +950,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetSiteCollectionByDomainCompletedEventHandler(object sender, GetSiteCollectionByDomainCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetSiteCollectionByDomainCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -1000,11 +976,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void AddSiteCollectionCompletedEventHandler(object sender, AddSiteCollectionCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class AddSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -1026,11 +1002,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void DeleteSiteCollectionCompletedEventHandler(object sender, DeleteSiteCollectionCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class DeleteSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -1052,11 +1028,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void DeleteSiteCollectionsCompletedEventHandler(object sender, DeleteSiteCollectionsCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class DeleteSiteCollectionsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -1078,11 +1054,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void BackupSiteCollectionCompletedEventHandler(object sender, BackupSiteCollectionCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class BackupSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -1104,11 +1080,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void RestoreSiteCollectionCompletedEventHandler(object sender, RestoreSiteCollectionCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class RestoreSiteCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -1130,11 +1106,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void GetBackupBinaryChunkCompletedEventHandler(object sender, GetBackupBinaryChunkCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class GetBackupBinaryChunkCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -1156,11 +1132,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void AppendBackupBinaryChunkCompletedEventHandler(object sender, AppendBackupBinaryChunkCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class AppendBackupBinaryChunkCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -1182,11 +1158,11 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void CalculateSharePointSitesDiskSpaceCompletedEventHandler(object sender, CalculateSharePointSitesDiskSpaceCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class CalculateSharePointSitesDiskSpaceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { @@ -1216,6 +1192,6 @@ namespace WebsitePanel.EnterpriseServer { } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void UpdateQuotaCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs index 95812922..3915a855 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SharePoint/HostedSharePointServerController.cs @@ -58,18 +58,18 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// Row index to start from. /// Maximum number of rows to retrieve. /// Site collections that match. - public static SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + public static SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName = null) { if (IsDemoMode) { SharePointSiteCollectionListPaged demoResult = new SharePointSiteCollectionListPaged(); - demoResult.SiteCollections = GetSiteCollections(1, false); + demoResult.SiteCollections = GetSiteCollections(1, false, null); demoResult.TotalRowCount = demoResult.SiteCollections.Count; return demoResult; } SharePointSiteCollectionListPaged paged = new SharePointSiteCollectionListPaged(); - DataSet result = PackageController.GetRawPackageItemsPaged(packageId, typeof(SharePointSiteCollection), + DataSet result = PackageController.GetRawPackageItemsPaged(packageId, groupName, typeof(SharePointSiteCollection), true, filterColumn, filterValue, sortColumn, startRow, Int32.MaxValue); List items = PackageController.CreateServiceItemsList(result, 1).ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); @@ -149,8 +149,9 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// /// Package that owns site collections. /// A value which shows whether nested spaces must be searched as well. + /// Resource group name. /// List of found site collections. - public static List GetSiteCollections(int packageId, bool recursive) + public static List GetSiteCollections(int packageId, bool recursive, string groupName) { if (IsDemoMode) { @@ -183,7 +184,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } - List items = PackageController.GetPackageItemsByType(packageId, typeof(SharePointSiteCollection), recursive); + List items = PackageController.GetPackageItemsByType(packageId, groupName, typeof(SharePointSiteCollection), recursive); return items.ConvertAll(delegate(ServiceProviderItem item) { return (SharePointSiteCollection)item; }); } @@ -196,7 +197,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint { if (IsDemoMode) { - return GetSiteCollections(1, false)[itemId - 1]; + return GetSiteCollections(1, false, null)[itemId - 1]; } SharePointSiteCollection item = PackageController.GetPackageItem(itemId) as SharePointSiteCollection; @@ -207,8 +208,9 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint /// Adds SharePoint site collection. /// /// Site collection description. + /// Resource group name. /// Created site collection id within metabase. - public static int AddSiteCollection(SharePointSiteCollection item) + public static int AddSiteCollection(SharePointSiteCollection item, string groupName) { // Check account. @@ -236,7 +238,8 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint } // Check if stats resource is available - int serviceId = PackageController.GetPackageServiceId(item.PackageId, ResourceGroups.SharepointFoundationServer); + int serviceId = PackageController.GetPackageServiceId(item.PackageId, groupName); + if (serviceId == 0) { return BusinessErrorCodes.ERROR_SHAREPOINT_RESOURCE_UNAVAILABLE; @@ -271,9 +274,9 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint int counter = 0; item.Name = String.Format("{0}://{1}", rootWebApplicationUri.Scheme, hostNameBase + "-" + counter.ToString() + "." + sslRoot); - siteName = String.Format("{0}", hostNameBase + "-" + counter.ToString() + "." + sslRoot); + siteName = String.Format("{0}", hostNameBase + "-" + counter.ToString() + "." + sslRoot); - while (DataProvider.CheckServiceItemExists(serviceId, item.Name, "WebsitePanel.Providers.SharePoint.SharePointSiteCollection, WebsitePanel.Providers.Base")) + while (CheckServiceItemExists(item.Name, item.PackageId)) { counter++; item.Name = String.Format("{0}://{1}", rootWebApplicationUri.Scheme, hostNameBase + "-" + counter.ToString() + "." + sslRoot); @@ -303,7 +306,7 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint // Check package item with given name already exists. - if (PackageController.GetPackageItemByName(item.PackageId, item.Name, typeof(SharePointSiteCollection)) != null) + if (PackageController.GetPackageItemByName(item.PackageId, groupName, item.Name, typeof(SharePointSiteCollection)) != null) { return BusinessErrorCodes.ERROR_SHAREPOINT_PACKAGE_ITEM_EXISTS; } @@ -1012,5 +1015,17 @@ namespace WebsitePanel.EnterpriseServer.Code.SharePoint return (SecurityContext.CheckAccount(DemandAccount.NotDemo) < 0); } } + + private static bool CheckServiceItemExists(string name, int packageId) + { + bool exists = PackageController.GetPackageItemByName(packageId, ResourceGroups.SharepointFoundationServer, name, typeof(SharePointSiteCollection)) != null; + + if (!exists) + { + exists = PackageController.GetPackageItemByName(packageId, ResourceGroups.SharepointServer, name, typeof(SharePointSiteCollection)) != null; + } + + return exists; + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs index 053f0c83..c99bee6a 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esHostedSharePointServers.asmx.cs @@ -55,13 +55,14 @@ namespace WebsitePanel.EnterpriseServer /// Sort column name. /// Row index to start from. /// Maximum number of rows to retrieve. + /// Resource group name. /// Site collections in raw format. [WebMethod] public SharePointSiteCollectionListPaged GetSiteCollectionsPaged(int packageId, int organizationId, - string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) + string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, string groupName) { return HostedSharePointServerController.GetSiteCollectionsPaged(packageId, organizationId, filterColumn, filterValue, - sortColumn, startRow, maximumRows); + sortColumn, startRow, maximumRows, groupName); } /// @@ -71,7 +72,7 @@ namespace WebsitePanel.EnterpriseServer [WebMethod] public int[] GetSupportedLanguages(int packageId) { - return HostedSharePointServerController.GetSupportedLanguages(packageId); + return HostedSharePointServerController.GetSupportedLanguages(packageId); } /// @@ -79,11 +80,12 @@ namespace WebsitePanel.EnterpriseServer /// /// Package that owns site collections. /// A value which shows whether nested spaces must be searched as well. + /// Resource group name. /// List of found site collections. [WebMethod] - public List GetSiteCollections(int packageId, bool recursive) + public List GetSiteCollections(int packageId, bool recursive, string groupName) { - return HostedSharePointServerController.GetSiteCollections(packageId, recursive); + return HostedSharePointServerController.GetSiteCollections(packageId, recursive, groupName); } [WebMethod] @@ -114,7 +116,7 @@ namespace WebsitePanel.EnterpriseServer public SharePointSiteCollection GetSiteCollectionByDomain(int organizationId, string domain) { DomainInfo domainInfo = ServerController.GetDomain(domain); - SharePointSiteCollectionListPaged existentSiteCollections = this.GetSiteCollectionsPaged(domainInfo.PackageId, organizationId, "ItemName", String.Format("%{0}", domain), String.Empty, 0, Int32.MaxValue); + SharePointSiteCollectionListPaged existentSiteCollections = this.GetSiteCollectionsPaged(domainInfo.PackageId, organizationId, "ItemName", String.Format("%{0}", domain), String.Empty, 0, Int32.MaxValue, null); foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) { Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); @@ -131,11 +133,12 @@ namespace WebsitePanel.EnterpriseServer /// Adds SharePoint site collection. /// /// Site collection description. + /// Resource group name. /// Created site collection id within metabase. [WebMethod] - public int AddSiteCollection(SharePointSiteCollection item) + public int AddSiteCollection(SharePointSiteCollection item, string groupName) { - return HostedSharePointServerController.AddSiteCollection(item); + return HostedSharePointServerController.AddSiteCollection(item, groupName); } /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index da7f2675..cbff0b24 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5703,6 +5703,12 @@ RDS User logging off error - GEtting RDS User sessions error + Getting RDS User sessions error + + + Updating RDS User experience error + + + RDS User experience has been updated \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointSiteCollectionsHelper.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointSiteCollectionsHelper.cs index 6f0dd712..50a0078e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointSiteCollectionsHelper.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Code/Helpers/HostedSharePointSiteCollectionsHelper.cs @@ -37,6 +37,7 @@ using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using WebsitePanel.Providers.SharePoint; using System.Collections.Generic; +using WebsitePanel.EnterpriseServer; namespace WebsitePanel.Portal { @@ -44,19 +45,28 @@ namespace WebsitePanel.Portal { SharePointSiteCollectionListPaged result; - public int GetSharePointSiteCollectionPagedCount(int packageId, int organizationId, string filterColumn, string filterValue) + public int GetSharePointSiteCollectionPagedCount(int packageId, int organizationId, string groupName, string filterColumn, string filterValue) { return result.TotalRowCount; } - public List GetSharePointSiteCollectionPaged(int packageId, int organizationId, string filterColumn, string filterValue, int maximumRows, int startRowIndex, string sortColumn) + public List GetSharePointSiteCollectionPaged(int packageId, int organizationId, string groupName, string filterColumn, string filterValue, int maximumRows, int startRowIndex, string sortColumn) { if (!String.IsNullOrEmpty(filterValue)) { filterValue = filterValue + "%"; } - result = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(packageId, organizationId, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows); + if (ResourceGroups.SharepointFoundationServer.Replace(" ", "").Equals(groupName)) + { + groupName = ResourceGroups.SharepointFoundationServer; + } + else if (ResourceGroups.SharepointServer.Replace(" ", "").Equals(groupName)) + { + groupName = ResourceGroups.SharepointServer; + } + + result = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(packageId, organizationId, filterColumn, filterValue, sortColumn, startRowIndex, maximumRows, groupName); return result.SiteCollections; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs index e87365b0..4171ea68 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointBackupSiteCollection.ascx.cs @@ -61,6 +61,10 @@ namespace WebsitePanel.Portal } } + public static string GroupName + { + get { return HttpContext.Current.Request["GroupName"]; } + } protected void Page_Load(object sender, EventArgs e) { @@ -163,7 +167,7 @@ namespace WebsitePanel.Portal private void RedirectBack() { - HttpContext.Current.Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + HttpContext.Current.Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName)); } protected void chkZipBackup_CheckedChanged(object sender, EventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs index c4fc460a..0a35bcfc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointEditSiteCollection.ascx.cs @@ -30,6 +30,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; +using System.Web; using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.DNS; @@ -43,6 +44,11 @@ namespace WebsitePanel.Portal { SharePointSiteCollection item = null; + public static string GroupName + { + get { return HttpContext.Current.Request["GroupName"]; } + } + private int OrganizationId { get @@ -224,7 +230,7 @@ namespace WebsitePanel.Portal /// Reserved disk space vallue. private int GetReservedDiskStorageSpace() { - var existingCollections = ES.Services.HostedSharePointServers.GetSiteCollections(PanelSecurity.PackageId, false); + var existingCollections = ES.Services.HostedSharePointServers.GetSiteCollections(PanelSecurity.PackageId, false, GroupName); return (int)existingCollections.Sum(siteCollection => siteCollection.MaxSiteStorage); } @@ -251,9 +257,20 @@ namespace WebsitePanel.Portal { item = new SharePointSiteCollection(); - if (!UseSharedSLL(PanelSecurity.PackageId)) + string groupName = GroupName; + + if (ResourceGroups.SharepointFoundationServer.Replace(" ", "").Equals(groupName)) { - SharePointSiteCollectionListPaged existentSiteCollections = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(PanelSecurity.PackageId, this.OrganizationId, "ItemName", String.Format("%{0}", this.domain.DomainName), String.Empty, 0, Int32.MaxValue); + groupName = ResourceGroups.SharepointFoundationServer; + } + else if (ResourceGroups.SharepointServer.Replace(" ", "").Equals(groupName)) + { + groupName = ResourceGroups.SharepointServer; + } + + if (!UseSharedSLL(PanelSecurity.PackageId)) + { + SharePointSiteCollectionListPaged existentSiteCollections = ES.Services.HostedSharePointServers.GetSiteCollectionsPaged(PanelSecurity.PackageId, this.OrganizationId, "ItemName", String.Format("%{0}", this.domain.DomainName), String.Empty, 0, Int32.MaxValue, groupName); foreach (SharePointSiteCollection existentSiteCollection in existentSiteCollections.SiteCollections) { Uri existentSiteCollectionUri = new Uri(existentSiteCollection.Name); @@ -284,9 +301,9 @@ namespace WebsitePanel.Portal item.MaxSiteStorage = maxStorage.QuotaValue; - item.WarningStorage = warningStorage.QuotaValue; + item.WarningStorage = warningStorage.QuotaValue; - int result = ES.Services.HostedSharePointServers.AddSiteCollection(item); + int result = ES.Services.HostedSharePointServers.AddSiteCollection(item, groupName); if (result < 0) { localMessageBox.ShowResultMessage(result); @@ -373,19 +390,19 @@ namespace WebsitePanel.Portal protected void btnBackup_Click(object sender, EventArgs e) { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_backup_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_backup_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName)); } protected void btnRestore_Click(object sender, EventArgs e) { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_restore_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_restore_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName)); } private void RedirectToSiteCollectionsList() { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_sitecollections", "ItemID=" + PanelRequest.ItemID.ToString())); + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_sitecollections", "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName)); } private bool UseSharedSLL(int packageID) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs index b91e7606..74c9be70 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointRestoreSiteCollection.ascx.cs @@ -59,6 +59,11 @@ namespace WebsitePanel.Portal } } + public static string GroupName + { + get { return HttpContext.Current.Request["GroupName"]; } + } + protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) @@ -166,7 +171,7 @@ namespace WebsitePanel.Portal private void RedirectBack() { - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString())); + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + this.SiteCollectionId, "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName)); } protected void radioUpload_CheckedChanged(object sender, EventArgs e) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx index 05459837..a1734e43 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx @@ -76,6 +76,7 @@ function confirmation() + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs index 3b0c4cb3..0bd9b7b0 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.cs @@ -44,6 +44,11 @@ namespace WebsitePanel.Portal { public partial class HostedSharePointSiteCollections : WebsitePanelModuleBase { + public static string GroupName + { + get { return HttpContext.Current.Request["GroupName"]; } + } + protected void Page_Load(object sender, EventArgs e) { this.BindStats(); @@ -62,14 +67,14 @@ namespace WebsitePanel.Portal protected void btnCreateSiteCollection_Click(object sender, EventArgs e) { - Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "sharepoint_edit_sitecollection", "SpaceID=" + PanelSecurity.PackageId.ToString())); + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "sharepoint_edit_sitecollection", "SpaceID=" + PanelSecurity.PackageId.ToString(), "GroupName=" + GroupName)); } public string GetSiteCollectionEditUrl(string siteCollectionId) { return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "sharepoint_edit_sitecollection", "SiteCollectionID=" + siteCollectionId, - "ItemID=" + PanelRequest.ItemID.ToString()); + "ItemID=" + PanelRequest.ItemID.ToString(), "GroupName=" + GroupName); } protected void odsSharePointSiteCollectionPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.designer.cs index d8c16907..2e8763e8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/HostedSharePointSiteCollections.ascx.designer.cs @@ -1,31 +1,3 @@ -// Copyright (c) 2015, 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. diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx new file mode 100644 index 00000000..91b50033 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditUserExperience.ascx.resx @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Administrators + + + Users + + + Drive Space Threshold + + + Hide C: Drive + + + Remove "Powershell" Command + + + Remove "Run" Command + + + Disable Screen Saver + + + Remove Shutdown and Restart + + + Disable Task Manager + + + Lock Screen Timeout + + + Changing Desktop Disabled + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx new file mode 100644 index 00000000..cb177a39 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx @@ -0,0 +1,163 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSEditUserExperience.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSEditUserExperience" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> +<%@ Register Src="UserControls/RDSCollectionTabs.ascx" TagName="CollectionTabs" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> +<%@ Register Src="../UserControls/ItemButtonPanel.ascx" TagName="ItemButtonPanel" TagPrefix="wsp" %> + + + + +
    +
    +
    +
    +
    +
    +
    + + + - + +
    +
    + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +
    + + + + + + + +
    + + + +
    +
    +
    + + + + + + + +
    + + + +
    +
    +
    + + + + + + + +
    + + + +
    +
    +
    + + + + + + + +
    + + + +
    +
    +
    + + + + + + + +
    + + + +
    +
    +
    + + + + + + + +
    + + + +
    +
    +
    + + + + + + + +
    + + + +
    +
    +
    + + + + + + +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs new file mode 100644 index 00000000..8fcb7797 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; +using WebsitePanel.EnterpriseServer.Base.RDS; + +namespace WebsitePanel.Portal.RDS +{ + public partial class RDSEditUserExperience : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + litCollectionName.Text = collection.DisplayName; + BindSettings(); + } + } + + private void BindSettings() + { + var serverSettings = ES.Services.RDS.GetRdsServerSettings(PanelRequest.CollectionID, string.Format("Collection-{0}-Settings", PanelRequest.CollectionID)); + + if (serverSettings == null) + { + var defaultSettings = ES.Services.Users.GetUserSettings(PanelSecurity.LoggedUserId, UserSettings.RDS_POLICY); + BindDefaultSettings(defaultSettings); + } + else + { + BindSettings(serverSettings); + } + } + + private void BindSettings(RdsServerSettings settings) + { + + } + + private RdsServerSettings GetSettings() + { + //settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE] = txtTimeout.Text; + //settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS] = cbTimeoutAdministrators.Checked.ToString(); + //settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS] = cbTimeoutUsers.Checked.ToString(); + //settings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS] = cbRunCommandAdministrators.Checked.ToString(); + //settings[RdsServerSettings.REMOVE_RUN_COMMAND_USERS] = cbRunCommandUsers.Checked.ToString(); + //settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS] = cbPowershellAdministrators.Checked.ToString(); + //settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_USERS] = cbPowershellUsers.Checked.ToString(); + //settings[RdsServerSettings.HIDE_C_DRIVE_ADMINISTRATORS] = cbHideCDriveAdministrators.Checked.ToString(); + //settings[RdsServerSettings.HIDE_C_DRIVE_USERS] = cbHideCDriveUsers.Checked.ToString(); + //settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS] = cbShutdownAdministrators.Checked.ToString(); + //settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_USERS] = cbShutdownUsers.Checked.ToString(); + //settings[RdsServerSettings.DISABLE_TASK_MANAGER_ADMINISTRATORS] = cbTaskManagerAdministrators.Checked.ToString(); + //settings[RdsServerSettings.DISABLE_TASK_MANAGER_USERS] = cbTaskManagerUsers.Checked.ToString(); + //settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_ADMINISTRATORS] = cbDesktopAdministrators.Checked.ToString(); + //settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS] = cbDesktopUsers.Checked.ToString(); + //settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS] = cbScreenSaverAdministrators.Checked.ToString(); + //settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS] = cbScreenSaverUsers.Checked.ToString(); + //settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE] = txtThreshold.Text; + + var settings = new RdsServerSettings(); + //settings.Settings.Add(new RdsServerSetting{ + // PropertyName = RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE, + // PropertyValue = txtTimeout.Text + //}) + + return settings; + } + + private void BindDefaultSettings(UserSettings settings) + { + txtTimeout.Text = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE]; + cbTimeoutAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]); + cbTimeoutUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS]); + + cbRunCommandAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS]); + cbRunCommandUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_RUN_COMMAND_USERS]); + + cbPowershellAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS]); + cbPowershellUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_USERS]); + + cbHideCDriveAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.HIDE_C_DRIVE_ADMINISTRATORS]); + cbHideCDriveUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.HIDE_C_DRIVE_USERS]); + + cbShutdownAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS]); + cbShutdownUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_USERS]); + + cbTaskManagerAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_TASK_MANAGER_ADMINISTRATORS]); + cbTaskManagerUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_TASK_MANAGER_USERS]); + + cbDesktopAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_ADMINISTRATORS]); + cbDesktopUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS]); + + cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]); + cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]); + + txtThreshold.Text = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; + } + + private bool SaveServerSettings() + { + try + { + ES.Services.RDS.UpdateRdsServerSettings(PanelRequest.CollectionID, string.Format("Collection-{0}-Settings", PanelRequest.CollectionID), GetSettings()); + } + catch (Exception ex) + { + ShowErrorMessage("RDSLOCALADMINS_NOT_ADDED", ex); + return false; + } + + return true; + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + { + return; + } + + SaveServerSettings(); + } + + protected void btnSaveExit_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + { + return; + } + + if (SaveServerSettings()) + { + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId)); + } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs new file mode 100644 index 00000000..a743b041 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx.designer.cs @@ -0,0 +1,402 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS { + + + public partial class RDSEditUserExperience { + + /// + /// asyncTasks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks; + + /// + /// imgEditRDSCollection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgEditRDSCollection; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// litCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Literal litCollectionName; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// tabs control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.RDS.UserControls.RdsServerTabs tabs; + + /// + /// secTimeout control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secTimeout; + + /// + /// timeoutPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel timeoutPanel; + + /// + /// txtTimeout control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtTimeout; + + /// + /// cbTimeoutUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbTimeoutUsers; + + /// + /// cbTimeoutAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbTimeoutAdministrators; + + /// + /// secRunCommand control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secRunCommand; + + /// + /// runCommandPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel runCommandPanel; + + /// + /// cbRunCommandUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbRunCommandUsers; + + /// + /// cbRunCommandAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbRunCommandAdministrators; + + /// + /// secPowershellCommand control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secPowershellCommand; + + /// + /// powershellCommandPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel powershellCommandPanel; + + /// + /// cbPowershellUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbPowershellUsers; + + /// + /// cbPowershellAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbPowershellAdministrators; + + /// + /// secHideCDrive control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secHideCDrive; + + /// + /// hideCDrivePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel hideCDrivePanel; + + /// + /// cbHideCDriveUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbHideCDriveUsers; + + /// + /// cbHideCDriveAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbHideCDriveAdministrators; + + /// + /// secShutdown control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secShutdown; + + /// + /// shutdownPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel shutdownPanel; + + /// + /// cbShutdownUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbShutdownUsers; + + /// + /// cbShutdownAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbShutdownAdministrators; + + /// + /// secTaskManager control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secTaskManager; + + /// + /// taskManagerPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel taskManagerPanel; + + /// + /// cbTaskManagerUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbTaskManagerUsers; + + /// + /// cbTaskManagerAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbTaskManagerAdministrators; + + /// + /// secChangeDesktop control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secChangeDesktop; + + /// + /// desktopPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel desktopPanel; + + /// + /// cbDesktopUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDesktopUsers; + + /// + /// cbDesktopAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbDesktopAdministrators; + + /// + /// secScreenSaver control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secScreenSaver; + + /// + /// screenSaverPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel screenSaverPanel; + + /// + /// cbScreenSaverUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbScreenSaverUsers; + + /// + /// cbScreenSaverAdministrators control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbScreenSaverAdministrators; + + /// + /// secDriveSpace control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secDriveSpace; + + /// + /// driveSpacePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel driveSpacePanel; + + /// + /// txtThreshold control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtThreshold; + + /// + /// buttonPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.ItemButtonPanel buttonPanel; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionTabs.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionTabs.ascx.resx index 2cd1fa14..59445e3d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionTabs.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionTabs.ascx.resx @@ -138,4 +138,7 @@ Setup Instructions + + User Experience + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs index f57fd491..57e12294 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionTabs.ascx.cs @@ -26,7 +26,8 @@ namespace WebsitePanel.Portal.RDS.UserControls tabsList.Add(CreateTab("rds_collection_edit_users", "Tab.RdsUsers")); tabsList.Add(CreateTab("rds_collection_user_sessions", "Tab.UserSessions")); tabsList.Add(CreateTab("rds_collection_local_admins", "Tab.LocalAdmins")); - tabsList.Add(CreateTab("rds_setup_letter", "Tab.RdsSetupLetter")); + tabsList.Add(CreateTab("rds_collection_user_experience", "Tab.UserExperience")); + tabsList.Add(CreateTab("rds_setup_letter", "Tab.RdsSetupLetter")); int idx = 0; diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs index 186ce217..c7cc46ff 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs @@ -5,80 +5,62 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; +using WebsitePanel.EnterpriseServer.Base.RDS; namespace WebsitePanel.Portal { public partial class SettingsRdsPolicy : WebsitePanelControlBase, IUserSettingsEditorControl - { - private const string LOCK_SCREEN_TIMEOUT_VALUE = "LockScreenTimeoutValue"; - private const string LOCK_SCREEN_TIMEOUT_ADMINISTRATORS = "LockScreenTimeoutAdministrators"; - private const string LOCK_SCREEN_TIMEOUT_USERS = "LockScreenTimeoutUsers"; - private const string REMOVE_RUN_COMMAND_ADMINISTRATORS = "RemoveRunCommandAdministrators"; - private const string REMOVE_RUN_COMMAND_USERS = "RemoveRunCommandUsers"; - private const string REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS = "RemovePowershellCommandAdministrators"; - private const string REMOVE_POWERSHELL_COMMAND_USERS = "RemovePowershellCommandUsers"; - private const string HIDE_C_DRIVE_ADMINISTRATORS = "HideCDriveAdministrators"; - private const string HIDE_C_DRIVE_USERS = "HideCDriveUsers"; - private const string REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS = "RemoveShutdownRestartAdministrators"; - private const string REMOVE_SHUTDOWN_RESTART_USERS = "RemoveShutdownRestartUsers"; - private const string DISABLE_TASK_MANAGER_ADMINISTRATORS = "DisableTaskManagerAdministrators"; - private const string DISABLE_TASK_MANAGER_USERS = "DisableTaskManagerUsers"; - private const string CHANGE_DESKTOP_DISABLED_ADMINISTRATORS = "ChangingDesktopDisabledAdministrators"; - private const string CHANGE_DESKTOP_DISABLED_USERS = "ChangingDesktopDisabledUsers"; - private const string SCREEN_SAVER_DISABLED_ADMINISTRATORS = "ScreenSaverDisabledAdministrators"; - private const string SCREEN_SAVER_DISABLED_USERS = "ScreenSaverDisabledUsers"; - private const string DRIVE_SPACE_THRESHOLD_VALUE = "DriveSpaceThresholdValue"; - + { public void BindSettings(UserSettings settings) - { - txtTimeout.Text = settings[LOCK_SCREEN_TIMEOUT_VALUE]; - cbTimeoutAdministrators.Checked = Convert.ToBoolean(settings[LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]); - cbTimeoutUsers.Checked = Convert.ToBoolean(settings[LOCK_SCREEN_TIMEOUT_USERS]); + { + txtTimeout.Text = settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE]; + cbTimeoutAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]); + cbTimeoutUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS]); - cbRunCommandAdministrators.Checked = Convert.ToBoolean(settings[REMOVE_RUN_COMMAND_ADMINISTRATORS]); - cbRunCommandUsers.Checked = Convert.ToBoolean(settings[REMOVE_RUN_COMMAND_USERS]); + cbRunCommandAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS]); + cbRunCommandUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_RUN_COMMAND_USERS]); - cbPowershellAdministrators.Checked = Convert.ToBoolean(settings[REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS]); - cbPowershellUsers.Checked = Convert.ToBoolean(settings[REMOVE_POWERSHELL_COMMAND_USERS]); + cbPowershellAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS]); + cbPowershellUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_USERS]); - cbHideCDriveAdministrators.Checked = Convert.ToBoolean(settings[HIDE_C_DRIVE_ADMINISTRATORS]); - cbHideCDriveUsers.Checked = Convert.ToBoolean(settings[HIDE_C_DRIVE_USERS]); + cbHideCDriveAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.HIDE_C_DRIVE_ADMINISTRATORS]); + cbHideCDriveUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.HIDE_C_DRIVE_USERS]); - cbShutdownAdministrators.Checked = Convert.ToBoolean(settings[REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS]); - cbShutdownUsers.Checked = Convert.ToBoolean(settings[REMOVE_SHUTDOWN_RESTART_USERS]); + cbShutdownAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS]); + cbShutdownUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_USERS]); - cbTaskManagerAdministrators.Checked = Convert.ToBoolean(settings[DISABLE_TASK_MANAGER_ADMINISTRATORS]); - cbTaskManagerUsers.Checked = Convert.ToBoolean(settings[DISABLE_TASK_MANAGER_USERS]); + cbTaskManagerAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_TASK_MANAGER_ADMINISTRATORS]); + cbTaskManagerUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_TASK_MANAGER_USERS]); - cbDesktopAdministrators.Checked = Convert.ToBoolean(settings[CHANGE_DESKTOP_DISABLED_ADMINISTRATORS]); - cbDesktopUsers.Checked = Convert.ToBoolean(settings[CHANGE_DESKTOP_DISABLED_USERS]); + cbDesktopAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_ADMINISTRATORS]); + cbDesktopUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS]); - cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[SCREEN_SAVER_DISABLED_ADMINISTRATORS]); - cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[SCREEN_SAVER_DISABLED_USERS]); + cbScreenSaverAdministrators.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]); + cbScreenSaverUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]); - txtThreshold.Text = settings[DRIVE_SPACE_THRESHOLD_VALUE]; + txtThreshold.Text = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; } public void SaveSettings(UserSettings settings) { - settings[LOCK_SCREEN_TIMEOUT_VALUE] = txtTimeout.Text; - settings[LOCK_SCREEN_TIMEOUT_ADMINISTRATORS] = cbTimeoutAdministrators.Checked.ToString(); - settings[LOCK_SCREEN_TIMEOUT_USERS] = cbTimeoutUsers.Checked.ToString(); - settings[REMOVE_RUN_COMMAND_ADMINISTRATORS] = cbRunCommandAdministrators.Checked.ToString(); - settings[REMOVE_RUN_COMMAND_USERS] = cbRunCommandUsers.Checked.ToString(); - settings[REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS] = cbPowershellAdministrators.Checked.ToString(); - settings[REMOVE_POWERSHELL_COMMAND_USERS] = cbPowershellUsers.Checked.ToString(); - settings[HIDE_C_DRIVE_ADMINISTRATORS] = cbHideCDriveAdministrators.Checked.ToString(); - settings[HIDE_C_DRIVE_USERS] = cbHideCDriveUsers.Checked.ToString(); - settings[REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS] = cbShutdownAdministrators.Checked.ToString(); - settings[REMOVE_SHUTDOWN_RESTART_USERS] = cbShutdownUsers.Checked.ToString(); - settings[DISABLE_TASK_MANAGER_ADMINISTRATORS] = cbTaskManagerAdministrators.Checked.ToString(); - settings[DISABLE_TASK_MANAGER_USERS] = cbTaskManagerUsers.Checked.ToString(); - settings[CHANGE_DESKTOP_DISABLED_ADMINISTRATORS] = cbDesktopAdministrators.Checked.ToString(); - settings[CHANGE_DESKTOP_DISABLED_USERS] = cbDesktopUsers.Checked.ToString(); - settings[SCREEN_SAVER_DISABLED_ADMINISTRATORS] = cbScreenSaverAdministrators.Checked.ToString(); - settings[SCREEN_SAVER_DISABLED_USERS] = cbScreenSaverUsers.Checked.ToString(); - settings[DRIVE_SPACE_THRESHOLD_VALUE] = txtThreshold.Text; + settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE] = txtTimeout.Text; + settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS] = cbTimeoutAdministrators.Checked.ToString(); + settings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS] = cbTimeoutUsers.Checked.ToString(); + settings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS] = cbRunCommandAdministrators.Checked.ToString(); + settings[RdsServerSettings.REMOVE_RUN_COMMAND_USERS] = cbRunCommandUsers.Checked.ToString(); + settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS] = cbPowershellAdministrators.Checked.ToString(); + settings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_USERS] = cbPowershellUsers.Checked.ToString(); + settings[RdsServerSettings.HIDE_C_DRIVE_ADMINISTRATORS] = cbHideCDriveAdministrators.Checked.ToString(); + settings[RdsServerSettings.HIDE_C_DRIVE_USERS] = cbHideCDriveUsers.Checked.ToString(); + settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS] = cbShutdownAdministrators.Checked.ToString(); + settings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_USERS] = cbShutdownUsers.Checked.ToString(); + settings[RdsServerSettings.DISABLE_TASK_MANAGER_ADMINISTRATORS] = cbTaskManagerAdministrators.Checked.ToString(); + settings[RdsServerSettings.DISABLE_TASK_MANAGER_USERS] = cbTaskManagerUsers.Checked.ToString(); + settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_ADMINISTRATORS] = cbDesktopAdministrators.Checked.ToString(); + settings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS] = cbDesktopUsers.Checked.ToString(); + settings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS] = cbScreenSaverAdministrators.Checked.ToString(); + settings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS] = cbScreenSaverUsers.Checked.ToString(); + settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE] = txtThreshold.Text; } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs index 6c5f08d9..95925257 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/OrganizationMenuControl.cs @@ -96,10 +96,10 @@ namespace WebsitePanel.Portal.UserControls //SharePoint menu group; if (Cntx.Groups.ContainsKey(ResourceGroups.SharepointFoundationServer)) - PrepareSharePointMenuRoot(items, GetLocalizedString("Text.SharePointFoundationServerGroup")); + PrepareSharePointMenuRoot(items, GetLocalizedString("Text.SharePointFoundationServerGroup"), ResourceGroups.SharepointFoundationServer.Replace(" ", "")); if (Cntx.Groups.ContainsKey(ResourceGroups.SharepointServer)) - PrepareSharePointMenuRoot(items, GetLocalizedString("Text.SharePointServerGroup")); + PrepareSharePointMenuRoot(items, GetLocalizedString("Text.SharePointServerGroup"), ResourceGroups.SharepointServer.Replace(" ", "")); //CRM Menu if (Cntx.Groups.ContainsKey(ResourceGroups.HostedCRM2013)) @@ -362,11 +362,11 @@ namespace WebsitePanel.Portal.UserControls bbItems.Add(CreateMenuItem("BlackBerryUsers", "blackberry_users", @"Icons/blackberry_users_48.png")); } - private void PrepareSharePointMenuRoot(MenuItemCollection items, string menuItemText) + private void PrepareSharePointMenuRoot(MenuItemCollection items, string menuItemText, string group) { if (ShortMenu) { - PrepareSharePointMenu(items); + PrepareSharePointMenu(items, group); } else { @@ -374,7 +374,7 @@ namespace WebsitePanel.Portal.UserControls item.Selectable = false; - PrepareSharePointMenu(item.ChildItems); + PrepareSharePointMenu(item.ChildItems, group); if (item.ChildItems.Count > 0) { @@ -383,14 +383,28 @@ namespace WebsitePanel.Portal.UserControls } } - private void PrepareSharePointMenu(MenuItemCollection spItems) + private void PrepareSharePointMenu(MenuItemCollection spItems, string group) + { + spItems.Add(CreateSharepointMenuItem("Text.SiteCollections", "sharepoint_sitecollections", @"Icons/sharepoint_sitecollections_48.png", group)); + spItems.Add(CreateSharepointMenuItem("Text.StorageUsage", "sharepoint_storage_usage", @"Icons/sharepoint_storage_usage_48.png", group)); + spItems.Add(CreateSharepointMenuItem("Text.StorageLimits", "sharepoint_storage_settings", @"Icons/sharepoint_storage_settings_48.png", group)); + } + + private MenuItem CreateSharepointMenuItem(string text, string key, string img, string group) { - spItems.Add(CreateMenuItem("SiteCollections", "sharepoint_sitecollections", @"Icons/sharepoint_sitecollections_48.png")); + MenuItem item = new MenuItem(); + string PID_SPACE_EXCHANGE_SERVER = "SpaceExchangeServer"; + item.Text = GetLocalizedString(text); + item.NavigateUrl = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGE_SERVER, "ItemID", ItemID.ToString(), + PortalUtils.SPACE_ID_PARAM + "=" + PackageId, DefaultPage.CONTROL_ID_PARAM + "=" + key, "GroupName=" + group, + "moduleDefId=exchangeserver"); - //if (ShortMenu) return; + if (ShowImg) + { + item.ImageUrl = PortalUtils.GetThemedIcon(img); + } - spItems.Add(CreateMenuItem("StorageUsage", "sharepoint_storage_usage", @"Icons/sharepoint_storage_usage_48.png")); - spItems.Add(CreateMenuItem("StorageLimits", "sharepoint_storage_settings", @"Icons/sharepoint_storage_settings_48.png")); + return item; } private void PrepareOCSMenuRoot(MenuItemCollection items) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index ac69faed..66e46186 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -429,6 +429,13 @@ RDSCollections.ascx + + RDSEditUserExperience.ascx + ASPXCodeBehind + + + RDSEditUserExperience.ascx + RDSLocalAdmins.ascx ASPXCodeBehind @@ -4578,6 +4585,7 @@ + @@ -4605,6 +4613,7 @@ + ResXFileCodeGenerator DomainLookupView.ascx.Designer.cs From edf8d678e9137cbfb65c00fc046edf141886a540 Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 25 Mar 2015 10:23:55 -0400 Subject: [PATCH 19/36] Added tag build-2.1.0.623 for changeset 9415d2fb40f4 From 492c0289f6bb303f0172feda02a771e686108817 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Wed, 25 Mar 2015 07:35:52 -0700 Subject: [PATCH 20/36] Update_DB.sql fix --- WebsitePanel/Database/update_db.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 300fb46c..49945dca 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9444,8 +9444,8 @@ BEGIN UPDATE [dbo].[ServiceItemTypes] SET DisplayName = 'SharePointFoundationSiteCollection' WHERE DisplayName = 'SharePointSiteCollection' SELECT @group_id = GroupId FROM [dbo].[ResourceGroups] WHERE GroupName = 'Sharepoint Server' - INSERT INTO [dbo].[ServiceItemTypes] (ItemTypeId, GroupId, DisplayName, TypeName, 100, CalculateDiskSpace, CalculateBandwidth, Suspendable, Disposable, Searchable, Importable, Backupable) - (SELECT TOP 1 @item_type_id, @group_id, 'SharePointSiteCollection', TypeName, TypeOrder, CalculateDiskSpace, CalculateBandwidth, Suspendable, Disposable, Searchable, Importable, Backupable FROM [dbo].[ServiceItemTypes] WHERE DisplayName = 'SharePointFoundationSiteCollection') + INSERT INTO [dbo].[ServiceItemTypes] (ItemTypeId, GroupId, DisplayName, TypeName, TypeOrder, CalculateDiskSpace, CalculateBandwidth, Suspendable, Disposable, Searchable, Importable, Backupable) + (SELECT TOP 1 @item_type_id, @group_id, 'SharePointSiteCollection', TypeName, 100, CalculateDiskSpace, CalculateBandwidth, Suspendable, Disposable, Searchable, Importable, Backupable FROM [dbo].[ServiceItemTypes] WHERE DisplayName = 'SharePointFoundationSiteCollection') END GO \ No newline at end of file From bd80c0d19d55fad12967bef285dcf66091a5c14c Mon Sep 17 00:00:00 2001 From: Virtuworks Date: Wed, 25 Mar 2015 10:50:36 -0400 Subject: [PATCH 21/36] Added tag build-2.1.0.624 for changeset f5e7af79085f From 9fcad0455de3629698e30f8bfb8607e7f924b64c Mon Sep 17 00:00:00 2001 From: me Date: Wed, 25 Mar 2015 20:46:35 +0400 Subject: [PATCH 22/36] wsp-10323 Step 10 final --- .../Virtualization/MountedDiskInfo.cs | 1 + .../Extensions/StringExtensions.cs | 73 ++ .../Helpers/VdsHelper.cs | 294 +++++++ .../HyperV2012R2.cs | 344 +------- ...oviders.Virtualization.HyperV2012R2.csproj | 2 + .../HyperV2012R2_Settings.ascx.resx | 404 +++++++++ .../HyperV2012R2_Settings.ascx | 408 +++++++++ .../HyperV2012R2_Settings.ascx.cs | 227 +++++ .../HyperV2012R2_Settings.ascx.designer.cs | 825 ++++++++++++++++++ .../WebsitePanel.Portal.Modules.csproj | 11 + 10 files changed, 2270 insertions(+), 319 deletions(-) create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/StringExtensions.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VdsHelper.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/HyperV2012R2_Settings.ascx.resx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.cs create mode 100644 WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.designer.cs diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MountedDiskInfo.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MountedDiskInfo.cs index 8dd324e9..f44247b1 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MountedDiskInfo.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/Virtualization/MountedDiskInfo.cs @@ -34,6 +34,7 @@ namespace WebsitePanel.Providers.Virtualization { public class MountedDiskInfo { + public int DiskNumber { get; set; } public string DiskAddress { get; set; } public string[] DiskVolumes { get; set; } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/StringExtensions.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/StringExtensions.cs new file mode 100644 index 00000000..cc295c7c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Extensions/StringExtensions.cs @@ -0,0 +1,73 @@ +using System; +using System.Text.RegularExpressions; + +namespace WebsitePanel.Providers.Virtualization.Extensions +{ + public static class StringExtensions + { + public static string[] ParseExact( + this string data, + string format) + { + return ParseExact(data, format, false); + } + + public static string[] ParseExact( + this string data, + string format, + bool ignoreCase) + { + string[] values; + + if (TryParseExact(data, format, out values, ignoreCase)) + return values; + else + throw new ArgumentException("Format not compatible with value."); + } + + public static bool TryExtract( + this string data, + string format, + out string[] values) + { + return TryParseExact(data, format, out values, false); + } + + public static bool TryParseExact( + this string data, + string format, + out string[] values, + bool ignoreCase) + { + int tokenCount = 0; + format = Regex.Escape(format).Replace("\\{", "{"); + + for (tokenCount = 0; ; tokenCount++) + { + string token = string.Format("{{{0}}}", tokenCount); + if (!format.Contains(token)) break; + format = format.Replace(token, + string.Format("(?'group{0}'.*)", tokenCount)); + } + + RegexOptions options = + ignoreCase ? RegexOptions.IgnoreCase : RegexOptions.None; + + Match match = new Regex(format, options).Match(data); + + if (tokenCount != (match.Groups.Count - 1)) + { + values = new string[] { }; + return false; + } + else + { + values = new string[tokenCount]; + for (int index = 0; index < tokenCount; index++) + values[index] = + match.Groups[string.Format("group{0}", index)].Value; + return true; + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VdsHelper.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VdsHelper.cs new file mode 100644 index 00000000..2d9f614e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/Helpers/VdsHelper.cs @@ -0,0 +1,294 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IO; +using System.Management; +using System.Threading; +using Microsoft.Storage.Vds; +using Microsoft.Storage.Vds.Advanced; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.Virtualization.Extensions; +using Path = System.IO.Path; + +namespace WebsitePanel.Providers.Virtualization +{ + public static class VdsHelper + { + public static MountedDiskInfo GetMountedDiskInfo(string serverName, int driveNumber) + { + MountedDiskInfo diskInfo = new MountedDiskInfo { DiskNumber = driveNumber }; + + // find mounted disk using VDS + AdvancedDisk advancedDisk = null; + Pack diskPack = null; + + // first attempt + Thread.Sleep(3000); + HostedSolutionLog.LogInfo("Trying to find mounted disk - first attempt"); + FindVdsDisk(serverName, diskInfo.DiskNumber, out advancedDisk, out diskPack); + + // second attempt + if (advancedDisk == null) + { + Thread.Sleep(20000); + HostedSolutionLog.LogInfo("Trying to find mounted disk - second attempt"); + FindVdsDisk(serverName, diskInfo.DiskNumber, out advancedDisk, out diskPack); + } + + if (advancedDisk == null) + throw new Exception("Could not find mounted disk"); + + // Set disk address + diskInfo.DiskAddress = advancedDisk.DiskAddress; + var addressParts = diskInfo.DiskAddress.ParseExact("Port{0}Path{1}Target{2}Lun{3}"); + var portNumber = addressParts[0]; + var targetId = addressParts[2]; + var lun = addressParts[3]; + + // check if DiskPart must be used to bring disk online and clear read-only flag + bool useDiskPartToClearReadOnly = false; + if (ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null) + useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]); + + // determine disk index for DiskPart + Wmi cimv2 = new Wmi(serverName, Constants.WMI_CIMV2_NAMESPACE); + ManagementObject objDisk = cimv2.GetWmiObject("win32_diskdrive", + "Model='Msft Virtual Disk SCSI Disk Device' and ScsiTargetID={0} and ScsiLogicalUnit={1} and scsiPort={2}", + targetId, lun, portNumber); + + if (useDiskPartToClearReadOnly) + { + // *** Clear Read-Only and bring disk online with DiskPart *** + HostedSolutionLog.LogInfo("Clearing disk Read-only flag and bringing disk online"); + + if (objDisk != null) + { + // disk found + // run DiskPart + string diskPartResult = RunDiskPart(serverName, String.Format(@"select disk {0} +attributes disk clear readonly +online disk +exit", Convert.ToInt32(objDisk["Index"]))); + + HostedSolutionLog.LogInfo("DiskPart Result: " + diskPartResult); + } + } + else + { + // *** Clear Read-Only and bring disk online with VDS *** + // clear Read-Only + if ((advancedDisk.Flags & DiskFlags.ReadOnly) == DiskFlags.ReadOnly) + { + HostedSolutionLog.LogInfo("Clearing disk Read-only flag"); + advancedDisk.ClearFlags(DiskFlags.ReadOnly); + while ((advancedDisk.Flags & DiskFlags.ReadOnly) == DiskFlags.ReadOnly) + { + Thread.Sleep(100); + advancedDisk.Refresh(); + } + } + + // bring disk ONLINE + if (advancedDisk.Status == DiskStatus.Offline) + { + HostedSolutionLog.LogInfo("Bringing disk online"); + advancedDisk.Online(); + while (advancedDisk.Status == DiskStatus.Offline) + { + Thread.Sleep(100); + advancedDisk.Refresh(); + } + } + } + + // small pause after getting disk online + Thread.Sleep(3000); + + // get disk again + FindVdsDisk(serverName, diskInfo.DiskNumber, out advancedDisk, out diskPack); + + // find volumes using VDS + List volumes = new List(); + HostedSolutionLog.LogInfo("Querying disk volumes with VDS"); + foreach (Volume volume in diskPack.Volumes) + { + string letter = volume.DriveLetter.ToString(); + if (letter != "") + volumes.Add(letter); + } + + // find volumes using WMI + if (volumes.Count == 0 && objDisk != null) + { + HostedSolutionLog.LogInfo("Querying disk volumes with WMI"); + foreach (ManagementObject objPartition in objDisk.GetRelated("Win32_DiskPartition")) + { + foreach (ManagementObject objVolume in objPartition.GetRelated("Win32_LogicalDisk")) + { + volumes.Add(objVolume["Name"].ToString().TrimEnd(':')); + } + } + } + + HostedSolutionLog.LogInfo("Volumes found: " + volumes.Count); + + // Set volumes + diskInfo.DiskVolumes = volumes.ToArray(); + + return diskInfo; + } + + public static void FindVdsDisk(string serverName, int driveNumber, out AdvancedDisk advancedDisk, out Pack diskPack) + { + Func compareFunc = disk => disk.Name.EndsWith("PhysicalDrive" + driveNumber); + FindVdsDisk(serverName, compareFunc, out advancedDisk, out diskPack); + } + public static void FindVdsDisk(string serverName, string diskAddress, out AdvancedDisk advancedDisk, out Pack diskPack) + { + Func compareFunc = disk => disk.DiskAddress == diskAddress; + FindVdsDisk(serverName, compareFunc, out advancedDisk, out diskPack); + } + + private static void FindVdsDisk(string serverName, Func compareFunc, out AdvancedDisk advancedDisk, out Pack diskPack) + { + advancedDisk = null; + diskPack = null; + + ServiceLoader serviceLoader = new ServiceLoader(); + Service vds = serviceLoader.LoadService(serverName); + vds.WaitForServiceReady(); + + foreach (Disk disk in vds.UnallocatedDisks) + { + if (compareFunc(disk)) + { + advancedDisk = (AdvancedDisk) disk; + break; + } + } + + if (advancedDisk == null) + { + vds.HardwareProvider = false; + vds.SoftwareProvider = true; + + foreach (SoftwareProvider provider in vds.Providers) + foreach (Pack pack in provider.Packs) + foreach (Disk disk in pack.Disks) + if (compareFunc(disk)) + { + diskPack = pack; + advancedDisk = (AdvancedDisk) disk; + break; + } + } + } + + // obsolete and currently is not used + private static string RunDiskPart(string serverName, string script) + { + // create temp script file name + string localPath = Path.Combine(GetTempRemoteFolder(serverName), Guid.NewGuid().ToString("N")); + + // save script to remote temp file + string remotePath = ConvertToUNC(serverName, localPath); + File.AppendAllText(remotePath, script); + + // run diskpart + ExecuteRemoteProcess(serverName, "DiskPart /s " + localPath); + + // delete temp script + try + { + File.Delete(remotePath); + } + catch + { + // TODO + } + + return ""; + } + + public static string ConvertToUNC(string serverName, string path) + { + if (String.IsNullOrEmpty(serverName) + || path.StartsWith(@"\\")) + return path; + + return String.Format(@"\\{0}\{1}", serverName, path.Replace(":", "$")); + } + + public static string GetTempRemoteFolder(string serverName) + { + Wmi cimv2 = new Wmi(serverName, "root\\cimv2"); + ManagementObject objOS = cimv2.GetWmiObject("win32_OperatingSystem"); + string sysPath = (string)objOS["SystemDirectory"]; + + // remove trailing slash + if (sysPath.EndsWith("\\")) + sysPath = sysPath.Substring(0, sysPath.Length - 1); + + sysPath = sysPath.Substring(0, sysPath.LastIndexOf("\\") + 1) + "Temp"; + + return sysPath; + } + + public static void ExecuteRemoteProcess(string serverName, string command) + { + Wmi cimv2 = new Wmi(serverName, "root\\cimv2"); + ManagementClass objProcess = cimv2.GetWmiClass("Win32_Process"); + + // run process + object[] methodArgs = { command, null, null, 0 }; + objProcess.InvokeMethod("Create", methodArgs); + + // process ID + int processId = Convert.ToInt32(methodArgs[3]); + + // wait until finished + // Create event query to be notified within 1 second of + // a change in a service + WqlEventQuery query = + new WqlEventQuery("__InstanceDeletionEvent", + new TimeSpan(0, 0, 1), + "TargetInstance isa \"Win32_Process\""); + + // Initialize an event watcher and subscribe to events + // that match this query + ManagementEventWatcher watcher = new ManagementEventWatcher(cimv2.GetScope(), query); + // times out watcher.WaitForNextEvent in 20 seconds + watcher.Options.Timeout = new TimeSpan(0, 0, 20); + + // Block until the next event occurs + // Note: this can be done in a loop if waiting for + // more than one occurrence + while (true) + { + ManagementBaseObject e = null; + + try + { + // wait untill next process finish + e = watcher.WaitForNextEvent(); + } + catch + { + // nothing has been finished in timeout period + return; // exit + } + + // check process id + int pid = Convert.ToInt32(((ManagementBaseObject)e["TargetInstance"])["ProcessID"]); + if (pid == processId) + { + //Cancel the subscription + watcher.Stop(); + + // exit + return; + } + } + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs index cb30af2e..cb14f1d2 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/HyperV2012R2.cs @@ -52,6 +52,7 @@ using WebsitePanel.Server.Utils; using Vds = Microsoft.Storage.Vds; using System.Configuration; using System.Linq; +using WebsitePanel.Providers.Virtualization.Extensions; namespace WebsitePanel.Providers.Virtualization { @@ -855,7 +856,7 @@ namespace WebsitePanel.Providers.Virtualization Command cmd = new Command("Remove-VMSwitch"); cmd.Parameters.Add("Name", switchId); cmd.Parameters.Add("Force"); - PowerShell.Execute(cmd, true); + PowerShell.Execute(cmd, true, false); } catch (Exception ex) { @@ -874,7 +875,7 @@ namespace WebsitePanel.Providers.Virtualization path = Path.Combine(FileUtils.EvaluateSystemVariables(path), Constants.LIBRARY_INDEX_FILE_NAME); // convert to UNC if it is a remote computer - path = ConvertToUNC(path); + path = VdsHelper.ConvertToUNC(ServerNameSettings, path); if (!File.Exists(path)) { @@ -1176,184 +1177,27 @@ namespace WebsitePanel.Providers.Virtualization public MountedDiskInfo MountVirtualHardDisk(string vhdPath) { - //MountedDiskInfo diskInfo = new MountedDiskInfo(); - //vhdPath = FileUtils.EvaluateSystemVariables(vhdPath); + vhdPath = FileUtils.EvaluateSystemVariables(vhdPath); - //// Mount disk - //Command cmd = new Command("Mount-VHD"); + // Mount disk + Command cmd = new Command("Mount-VHD"); - //cmd.Parameters.Add("Path", vhdPath); - //cmd.Parameters.Add("PassThru"); + cmd.Parameters.Add("Path", vhdPath); + cmd.Parameters.Add("PassThru"); - //// Get disk address - //var result = PowerShell.Execute(cmd, true); - - //try - //{ - // if (result == null || result.Count == 0) - // throw new Exception("Failed to mount disk"); - - // diskInfo.DiskAddress = result[0].GetString("DiskNumber"); - - // // Get disk volumes - - //} - //catch (Exception ex) - //{ - // // unmount disk - // UnmountVirtualHardDisk(vhdPath); - - // // throw error - // throw ex; - //} - - //return diskInfo; - - ManagementObject objImgSvc = GetImageManagementService(); - - // get method params - ManagementBaseObject inParams = objImgSvc.GetMethodParameters("Mount"); - inParams["Path"] = FileUtils.EvaluateSystemVariables(vhdPath); - - ManagementBaseObject outParams = (ManagementBaseObject)objImgSvc.InvokeMethod("Mount", inParams, null); - JobResult result = CreateJobResultFromWmiMethodResults(outParams); - - // load storage job - if (result.ReturnValue != ReturnCode.JobStarted) - throw new Exception("Failed to start Mount job with the following error: " + result.ReturnValue); ; - - ManagementObject objJob = wmi.GetWmiObject("msvm_StorageJob", "InstanceID = '{0}'", result.Job.Id); - - if (!JobCompleted(result.Job)) - throw new Exception("Failed to complete Mount job with the following error: " + result.Job.ErrorDescription); + // Get mounted disk + var result = PowerShell.Execute(cmd, true, true); try { - List volumes = new List(); + if (result == null || result.Count == 0) + throw new Exception("Failed to mount disk"); - // load output data - ManagementObject objImage = wmi.GetRelatedWmiObject(objJob, "Msvm_MountedStorageImage"); + var diskNumber = result[0].GetInt("DiskNumber"); - int pathId = Convert.ToInt32(objImage["PathId"]); - int portNumber = Convert.ToInt32(objImage["PortNumber"]); - int targetId = Convert.ToInt32(objImage["TargetId"]); - int lun = Convert.ToInt32(objImage["Lun"]); - - string diskAddress = String.Format("Port{0}Path{1}Target{2}Lun{3}", portNumber, pathId, targetId, lun); - - HostedSolutionLog.LogInfo("Disk address: " + diskAddress); - - // find mounted disk using VDS - Vds.Advanced.AdvancedDisk advancedDisk = null; - Vds.Pack diskPack = null; - - // first attempt - System.Threading.Thread.Sleep(3000); - HostedSolutionLog.LogInfo("Trying to find mounted disk - first attempt"); - FindVdsDisk(diskAddress, out advancedDisk, out diskPack); - - // second attempt - if (advancedDisk == null) - { - System.Threading.Thread.Sleep(20000); - HostedSolutionLog.LogInfo("Trying to find mounted disk - second attempt"); - FindVdsDisk(diskAddress, out advancedDisk, out diskPack); - } - - if (advancedDisk == null) - throw new Exception("Could not find mounted disk"); - - // check if DiskPart must be used to bring disk online and clear read-only flag - bool useDiskPartToClearReadOnly = false; - if (ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG] != null) - useDiskPartToClearReadOnly = Boolean.Parse(ConfigurationManager.AppSettings[Constants.CONFIG_USE_DISKPART_TO_CLEAR_READONLY_FLAG]); - - // determine disk index for DiskPart - Wmi cimv2 = new Wmi(ServerNameSettings, Constants.WMI_CIMV2_NAMESPACE); - ManagementObject objDisk = cimv2.GetWmiObject("win32_diskdrive", - "Model='Msft Virtual Disk SCSI Disk Device' and ScsiTargetID={0} and ScsiLogicalUnit={1} and scsiPort={2}", - targetId, lun, portNumber); - - if (useDiskPartToClearReadOnly) - { - // *** Clear Read-Only and bring disk online with DiskPart *** - HostedSolutionLog.LogInfo("Clearing disk Read-only flag and bringing disk online"); - - if (objDisk != null) - { - // disk found - // run DiskPart - string diskPartResult = RunDiskPart(String.Format(@"select disk {0} -attributes disk clear readonly -online disk -exit", Convert.ToInt32(objDisk["Index"]))); - - HostedSolutionLog.LogInfo("DiskPart Result: " + diskPartResult); - } - } - else - { - // *** Clear Read-Only and bring disk online with VDS *** - // clear Read-Only - if ((advancedDisk.Flags & Vds.DiskFlags.ReadOnly) == Vds.DiskFlags.ReadOnly) - { - HostedSolutionLog.LogInfo("Clearing disk Read-only flag"); - advancedDisk.ClearFlags(Vds.DiskFlags.ReadOnly); - while ((advancedDisk.Flags & Vds.DiskFlags.ReadOnly) == Vds.DiskFlags.ReadOnly) - { - System.Threading.Thread.Sleep(100); - advancedDisk.Refresh(); - } - } - - // bring disk ONLINE - if (advancedDisk.Status == Vds.DiskStatus.Offline) - { - HostedSolutionLog.LogInfo("Bringing disk online"); - advancedDisk.Online(); - while (advancedDisk.Status == Vds.DiskStatus.Offline) - { - System.Threading.Thread.Sleep(100); - advancedDisk.Refresh(); - } - } - } - - // small pause after getting disk online - System.Threading.Thread.Sleep(3000); - - // get disk again - FindVdsDisk(diskAddress, out advancedDisk, out diskPack); - - // find volumes using VDS - HostedSolutionLog.LogInfo("Querying disk volumes with VDS"); - foreach (Vds.Volume volume in diskPack.Volumes) - { - string letter = volume.DriveLetter.ToString(); - if (letter != "") - volumes.Add(letter); - } - - // find volumes using WMI - if (volumes.Count == 0 && objDisk != null) - { - HostedSolutionLog.LogInfo("Querying disk volumes with WMI"); - foreach (ManagementObject objPartition in objDisk.GetRelated("Win32_DiskPartition")) - { - foreach (ManagementObject objVolume in objPartition.GetRelated("Win32_LogicalDisk")) - { - volumes.Add(objVolume["Name"].ToString().TrimEnd(':')); - } - } - } - - HostedSolutionLog.LogInfo("Volumes found: " + volumes.Count); - - // info object - MountedDiskInfo info = new MountedDiskInfo(); - info.DiskAddress = diskAddress; - info.DiskVolumes = volumes.ToArray(); - return info; + var diskInfo = VdsHelper.GetMountedDiskInfo(ServerNameSettings, diskNumber); + + return diskInfo; } catch (Exception ex) { @@ -1365,41 +1209,6 @@ exit", Convert.ToInt32(objDisk["Index"]))); } } - private void FindVdsDisk(string diskAddress, out Vds.Advanced.AdvancedDisk advancedDisk, out Vds.Pack diskPack) - { - advancedDisk = null; - diskPack = null; - - Vds.ServiceLoader serviceLoader = new Vds.ServiceLoader(); - Vds.Service vds = serviceLoader.LoadService(ServerNameSettings); - vds.WaitForServiceReady(); - - foreach (Vds.Disk disk in vds.UnallocatedDisks) - { - if (disk.DiskAddress == diskAddress) - { - advancedDisk = (Vds.Advanced.AdvancedDisk)disk; - break; - } - } - - if (advancedDisk == null) - { - vds.HardwareProvider = false; - vds.SoftwareProvider = true; - - foreach (Vds.SoftwareProvider provider in vds.Providers) - foreach (Vds.Pack pack in provider.Packs) - foreach (Vds.Disk disk in pack.Disks) - if (disk.DiskAddress == diskAddress) - { - diskPack = pack; - advancedDisk = (Vds.Advanced.AdvancedDisk)disk; - break; - } - } - } - public ReturnCode UnmountVirtualHardDisk(string vhdPath) { Command cmd = new Command("Dismount-VHD"); @@ -1417,7 +1226,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); cmd.Parameters.Add("Path", FileUtils.EvaluateSystemVariables(vhdPath)); cmd.Parameters.Add("SizeBytes", sizeGB * Constants.Size1G); - PowerShell.Execute(cmd, true); + PowerShell.Execute(cmd, true, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } @@ -1443,7 +1252,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); cmd.Parameters.Add("DestinationPath", destinationPath); cmd.Parameters.Add("VHDType", diskType.ToString()); - PowerShell.Execute(cmd, true); + PowerShell.Execute(cmd, true, true); return JobHelper.CreateSuccessResult(ReturnCode.JobStarted); } catch (Exception ex) @@ -1467,7 +1276,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); Vds.Advanced.AdvancedDisk advancedDisk = null; Vds.Pack diskPack = null; - FindVdsDisk(diskAddress, out advancedDisk, out diskPack); + VdsHelper.FindVdsDisk(ServerNameSettings, diskAddress, out advancedDisk, out diskPack); if (advancedDisk == null) throw new Exception("Could not find mounted disk"); @@ -1522,36 +1331,11 @@ exit", Convert.ToInt32(objDisk["Index"]))); diskVolume.EndExtend(extendEvent); } - // obsolete and currently is not used - private string RunDiskPart(string script) - { - // create temp script file name - string localPath = Path.Combine(GetTempRemoteFolder(), Guid.NewGuid().ToString("N")); - - // save script to remote temp file - string remotePath = ConvertToUNC(localPath); - File.AppendAllText(remotePath, script); - - // run diskpart - ExecuteRemoteProcess("DiskPart /s " + localPath); - - // delete temp script - try - { - File.Delete(remotePath); - } - catch - { - // TODO - } - - return ""; - } - + public string ReadRemoteFile(string path) { // temp file name on "system" drive available through hidden share - string tempPath = Path.Combine(GetTempRemoteFolder(), Guid.NewGuid().ToString("N")); + string tempPath = Path.Combine(VdsHelper.GetTempRemoteFolder(ServerNameSettings), Guid.NewGuid().ToString("N")); HostedSolutionLog.LogInfo("Read remote file: " + path); HostedSolutionLog.LogInfo("Local file temp path: " + tempPath); @@ -1561,7 +1345,7 @@ exit", Convert.ToInt32(objDisk["Index"]))); return null; // read content of temp file - string remoteTempPath = ConvertToUNC(tempPath); + string remoteTempPath = VdsHelper.ConvertToUNC(ServerNameSettings, tempPath); HostedSolutionLog.LogInfo("Remote file temp path: " + remoteTempPath); string content = File.ReadAllText(remoteTempPath); @@ -1575,10 +1359,10 @@ exit", Convert.ToInt32(objDisk["Index"]))); public void WriteRemoteFile(string path, string content) { // temp file name on "system" drive available through hidden share - string tempPath = Path.Combine(GetTempRemoteFolder(), Guid.NewGuid().ToString("N")); + string tempPath = Path.Combine(VdsHelper.GetTempRemoteFolder(ServerNameSettings), Guid.NewGuid().ToString("N")); // write to temp file - string remoteTempPath = ConvertToUNC(tempPath); + string remoteTempPath = VdsHelper.ConvertToUNC(ServerNameSettings, tempPath); File.WriteAllText(remoteTempPath, content); // delete file (WMI) @@ -1925,14 +1709,6 @@ exit", Convert.ToInt32(objDisk["Index"]))); wmi.GetWmiObject("Msvm_VirtualSystemSettingData", "InstanceID = '{0}'", "Microsoft:" + snapshotId); } - private string ConvertToUNC(string path) - { - if (String.IsNullOrEmpty(ServerNameSettings) - || path.StartsWith(@"\\")) - return path; - - return String.Format(@"\\{0}\{1}", ServerNameSettings, path.Replace(":", "$")); - } private ConcreteJob CreateJobFromWmiObject(ManagementBaseObject objJob) { @@ -2136,80 +1912,10 @@ exit", Convert.ToInt32(objDisk["Index"]))); public void CreateFolder(string path) { - ExecuteRemoteProcess(String.Format("cmd.exe /c md \"{0}\"", path)); + VdsHelper.ExecuteRemoteProcess(ServerNameSettings, String.Format("cmd.exe /c md \"{0}\"", path)); } - public void ExecuteRemoteProcess(string command) - { - Wmi cimv2 = new Wmi(ServerNameSettings, "root\\cimv2"); - ManagementClass objProcess = cimv2.GetWmiClass("Win32_Process"); - // run process - object[] methodArgs = { command, null, null, 0 }; - objProcess.InvokeMethod("Create", methodArgs); - - // process ID - int processId = Convert.ToInt32(methodArgs[3]); - - // wait until finished - // Create event query to be notified within 1 second of - // a change in a service - WqlEventQuery query = - new WqlEventQuery("__InstanceDeletionEvent", - new TimeSpan(0, 0, 1), - "TargetInstance isa \"Win32_Process\""); - - // Initialize an event watcher and subscribe to events - // that match this query - ManagementEventWatcher watcher = new ManagementEventWatcher(cimv2.GetScope(), query); - // times out watcher.WaitForNextEvent in 20 seconds - watcher.Options.Timeout = new TimeSpan(0, 0, 20); - - // Block until the next event occurs - // Note: this can be done in a loop if waiting for - // more than one occurrence - while (true) - { - ManagementBaseObject e = null; - - try - { - // wait untill next process finish - e = watcher.WaitForNextEvent(); - } - catch - { - // nothing has been finished in timeout period - return; // exit - } - - // check process id - int pid = Convert.ToInt32(((ManagementBaseObject)e["TargetInstance"])["ProcessID"]); - if (pid == processId) - { - //Cancel the subscription - watcher.Stop(); - - // exit - return; - } - } - } - - public string GetTempRemoteFolder() - { - Wmi cimv2 = new Wmi(ServerNameSettings, "root\\cimv2"); - ManagementObject objOS = cimv2.GetWmiObject("win32_OperatingSystem"); - string sysPath = (string)objOS["SystemDirectory"]; - - // remove trailing slash - if (sysPath.EndsWith("\\")) - sysPath = sysPath.Substring(0, sysPath.Length - 1); - - sysPath = sysPath.Substring(0, sysPath.LastIndexOf("\\") + 1) + "Temp"; - - return sysPath; - } #endregion #region Hyper-V Cloud diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj index 65ec14ae..aa20c15c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Virtualization.HyperV-2012R2/WebsitePanel.Providers.Virtualization.HyperV2012R2.csproj @@ -55,7 +55,9 @@ + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/HyperV2012R2_Settings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/HyperV2012R2_Settings.ascx.resx new file mode 100644 index 00000000..3c34e5ff --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/App_LocalResources/HyperV2012R2_Settings.ascx.resx @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + User name + + + Both reseller account passwords should match + + + Enter default gateway IP + + + Enter DVD library folder + + + Enter path for storing exported VPS + + + Enter host name pattern + + + Alternate Name Server: + + + Default Gateway: + + + Disk Type: + + + WebsitePanel Reseller Account + + + DVD Library path: + + + Existing password: + + + Exported VPS path: + + + External Network + + + Connect to Network: + + + General Settings + + + VPS Host name + + + Host name pattern: + + + IP Addresses Format: + + + DVD Media Library + + + Network Adapter + + + OS Templates path: + + + When user is not allowed to specify their custom host name the system will generate the host name for new VPS based on this pattern.<br/><br/> +The following substitution variables can be used in the pattern:<br/> +[USERNAME], [USER_ID], [SPACE_ID] + + + Preferred Name Server: + + + Private Network + + + For automatic provisioning of WebsitePanel control panel inside VPS please enter WebsitePanel reseller account details below: + + + Confirm password: + + + Password: + + + Username: + + + seconds + + + Automatic Start Action + + + What do you want VPS to do when the physical computer starts? + + + Startup delay: + + + Specify a startup delay to reduce resource contention between virtual machines. + + + Automatic Stop Action + + + What do you want VPS to do when the physical shuts down? + + + Subnet Mask: + + + Virtual Hard Drive + + + VPS folder includes: + + + VPS root folder: + + + 10.0.0.1/8 + + + 172.16.0.1/12 + + + 192.168.0.1/16 + + + Always start VPS automatically + + + Nothing + + + Automatically start if it was running when the service stopped + + + Save VPS state + + + Shut down VPS operating system + + + Turn off VPS + + + Dynamically expanding + + + Fixed size + + + VPS identifier, for example "843FA-A0B2-34404" + + + VPS host name, for example "vps1.domain.com" + + + Enter VPS root folder + + + Startup delay could not be blank + + + Enter subnet mask + + + Enter OS templates folder + + + Enter processor limit per VPS + + + Enter processor reserve per VPS + + + Enter relative processor weight per VPS + + + Virtual machine limit: + + + Virtual machine reserve: + + + Relative weight: + + + The following variables are supported: [VPS_HOSTNAME], [USERNAME], [USER_ID], [SPACE_ID] + + + Processor Resource Settings + + + Connect + + + <Cannot read networks list> + + + <br/><b>Unable to connect to Hyper-V server</b><br/><br/>Possible reasons:<ol><li>You are going to manage remote Hyper-V server (either Server Core or Hyper-V Server 2008 machine) where WebsitePanel Server is not installed. Type the correct server name at the top of this form and then click "Connect" button.</li><li>WebsitePanel Server has insufficient permissions to connect remote Hyper-V server. Please refer administrator guide for client and server setup instructions.</li><li>Lost connectivity with WebsitePanel Server installed on Hyper-V virtualization server. Check connectivity and open service properties page once again.</li></ol> + + + Hyper-V Server + + + Server name: + + + <b>Local</b> - Hyper-V role is installed on this server + + + <b>Remote</b> - Remote Windows 2008 Server Core or Hyper-V Server 2008 + + + Enter server name + + + <Do not connect VPS to Management Network> + + + Management Network + + + Connect to Network: + + + DHCP + + + IP Addresses Pool + + + Custom + + + Network Card Configuration: + + + IP Address / CIDR: + + + Enter subnet mask in CIDR format + + + Automatically assign IP addresses to the space on creation + + + Core Svc Endpoint + + + SCCM Endpoint + + + SCCM Server + + + SCDPM Endpoint + + + SCDPM Server + + + SCOM Endpoint + + + SCOM Server + + + SCVMM Endpoint + + + SCVMM Server + + + Storage Endpoint + + + Hyper-V Cloud + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx new file mode 100644 index 00000000..cdca54c5 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx @@ -0,0 +1,408 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HyperV2012R2_Settings.ascx.cs" Inherits="WebsitePanel.Portal.ProviderControls.HyperV2012R2_Settings" %> +<%@ Register Src="../UserControls/EditIPAddressControl.ascx" TagName="EditIPAddressControl" TagPrefix="wsp" %> + + + +
    + + + + + + + + + + + + + +
    + + Local + Remote + +
    + + + + + +
    + +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + +
    +
    +
    + + + + +
    + + + + +
    +
    +
    + +
    + + + + + + + + + + + + + + + + +
    + + + + % + +
    + + + + % + +
    + + + + +
    +
    +
    + +
    + + + + + + + + +
    + + + + +
    +
    +
    + +
    + + + + + + + + +
    + + + + Dynamic + Fixed + +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + +
    + +
    +
    +
    + + + + +
    + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + + POOL + DHCP + +
    + + + +
    + + + +
    +
    + +
    +
    +
    + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + Custom + 192.168.0.1 + 172.16.0.1 + 10.0.0.1 + +
    + + + + / + + +
    + + + +
    + + + +
    + + + +
    +
    +
    +
    +
    + +
    + + + + + + + + +
    + + + + +
    +

    + +

    +
    +
    + +
    + + + + + + + + + + + + + + + + + +
    + +
    + + Nothing + Start + AlwaysStart + +
    + +
    + + + + +
    +
    +
    + +
    + + + + + + + + + + + +
    + +
    + + Save + TurnOff + ShutDown + +
    +
    +
    \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.cs new file mode 100644 index 00000000..88742012 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.cs @@ -0,0 +1,227 @@ +// Copyright (c) 2015, 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. + +using System; +using System.Collections; +using System.Configuration; +using System.Data; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Collections.Specialized; +using WebsitePanel.Providers.Virtualization; +using WebsitePanel.EnterpriseServer; +using System.Web.UI.MobileControls; +using System.Collections.Generic; + +namespace WebsitePanel.Portal.ProviderControls +{ + public partial class HyperV2012R2_Settings : WebsitePanelControlBase, IHostingServiceProviderSettings + { + protected void Page_Load(object sender, EventArgs e) + { + } + + void IHostingServiceProviderSettings.BindSettings(StringDictionary settings) + { + txtServerName.Text = settings["ServerName"]; + radioServer.SelectedIndex = (txtServerName.Text == "") ? 0 : 1; + + // bind networks + BindNetworksList(); + + // general settings + txtVpsRootFolder.Text = settings["RootFolder"]; + txtOSTemplatesPath.Text = settings["OsTemplatesPath"]; + txtExportedVpsPath.Text = settings["ExportedVpsPath"]; + + // CPU + txtCpuLimit.Text = settings["CpuLimit"]; + txtCpuReserve.Text = settings["CpuReserve"]; + txtCpuWeight.Text = settings["CpuWeight"]; + + // DVD library + txtDvdLibraryPath.Text = settings["DvdLibraryPath"]; + + // VHD type + radioVirtualDiskType.SelectedValue = settings["VirtualDiskType"]; + + // External network + ddlExternalNetworks.SelectedValue = settings["ExternalNetworkId"]; + externalPreferredNameServer.Text = settings["ExternalPreferredNameServer"]; + externalAlternateNameServer.Text = settings["ExternalAlternateNameServer"]; + chkAssignIPAutomatically.Checked = Utils.ParseBool(settings["AutoAssignExternalIP"], true); + + // Private network + ddlPrivateNetworkFormat.SelectedValue = settings["PrivateNetworkFormat"]; + privateIPAddress.Text = settings["PrivateIPAddress"]; + privateSubnetMask.Text = settings["PrivateSubnetMask"]; + privateDefaultGateway.Text = settings["PrivateDefaultGateway"]; + privatePreferredNameServer.Text = settings["PrivatePreferredNameServer"]; + privateAlternateNameServer.Text = settings["PrivateAlternateNameServer"]; + + // Management network + ddlManagementNetworks.SelectedValue = settings["ManagementNetworkId"]; + ddlManageNicConfig.SelectedValue = settings["ManagementNicConfig"]; + managePreferredNameServer.Text = settings["ManagementPreferredNameServer"]; + manageAlternateNameServer.Text = settings["ManagementAlternateNameServer"]; + + // host name + txtHostnamePattern.Text = settings["HostnamePattern"]; + + // start action + radioStartAction.SelectedValue = settings["StartAction"]; + txtStartupDelay.Text = settings["StartupDelay"]; + + // stop + radioStopAction.SelectedValue = settings["StopAction"]; + + ToggleControls(); + } + + void IHostingServiceProviderSettings.SaveSettings(StringDictionary settings) + { + settings["ServerName"] = txtServerName.Text.Trim(); + + // general settings + settings["RootFolder"] = txtVpsRootFolder.Text.Trim(); + settings["OsTemplatesPath"] = txtOSTemplatesPath.Text.Trim(); + settings["ExportedVpsPath"] = txtExportedVpsPath.Text.Trim(); + + // CPU + settings["CpuLimit"] = txtCpuLimit.Text.Trim(); + settings["CpuReserve"] = txtCpuReserve.Text.Trim(); + settings["CpuWeight"] = txtCpuWeight.Text.Trim(); + + // DVD library + settings["DvdLibraryPath"] = txtDvdLibraryPath.Text.Trim(); + + // VHD type + settings["VirtualDiskType"] = radioVirtualDiskType.SelectedValue; + + // External network + settings["ExternalNetworkId"] = ddlExternalNetworks.SelectedValue; + settings["ExternalPreferredNameServer"] = externalPreferredNameServer.Text; + settings["ExternalAlternateNameServer"] = externalAlternateNameServer.Text; + settings["AutoAssignExternalIP"] = chkAssignIPAutomatically.Checked.ToString(); + + // Private network + settings["PrivateNetworkFormat"] = ddlPrivateNetworkFormat.SelectedValue; + settings["PrivateIPAddress"] = ddlPrivateNetworkFormat.SelectedIndex == 0 ? privateIPAddress.Text : ""; + settings["PrivateSubnetMask"] = ddlPrivateNetworkFormat.SelectedIndex == 0 ? privateSubnetMask.Text : ""; + settings["PrivateDefaultGateway"] = privateDefaultGateway.Text; + settings["PrivatePreferredNameServer"] = privatePreferredNameServer.Text; + settings["PrivateAlternateNameServer"] = privateAlternateNameServer.Text; + + // Management network + settings["ManagementNetworkId"] = ddlManagementNetworks.SelectedValue; + settings["ManagementNicConfig"] = ddlManageNicConfig.SelectedValue; + settings["ManagementPreferredNameServer"] = ddlManageNicConfig.SelectedIndex == 0 ? managePreferredNameServer.Text : ""; + settings["ManagementAlternateNameServer"] = ddlManageNicConfig.SelectedIndex == 0 ? manageAlternateNameServer.Text : ""; + + // host name + settings["HostnamePattern"] = txtHostnamePattern.Text.Trim(); + + // start action + settings["StartAction"] = radioStartAction.SelectedValue; + settings["StartupDelay"] = Utils.ParseInt(txtStartupDelay.Text.Trim(), 0).ToString(); + + // stop + settings["StopAction"] = radioStopAction.SelectedValue; + } + + private void BindNetworksList() + { + try + { + VirtualSwitch[] switches = ES.Services.VPS.GetExternalSwitches(PanelRequest.ServiceId, txtServerName.Text.Trim()); + + ddlExternalNetworks.DataSource = switches; + ddlExternalNetworks.DataBind(); + + ddlManagementNetworks.DataSource = switches; + ddlManagementNetworks.DataBind(); + ddlManagementNetworks.Items.Insert(0, new ListItem(GetLocalizedString("ddlManagementNetworks.Text"), "")); + + locErrorReadingNetworksList.Visible = false; + } + catch + { + ddlExternalNetworks.Items.Add(new ListItem(GetLocalizedString("ErrorReadingNetworksList.Text"), "")); + ddlManagementNetworks.Items.Add(new ListItem(GetLocalizedString("ErrorReadingNetworksList.Text"), "")); + locErrorReadingNetworksList.Visible = true; + } + } + + private void ToggleControls() + { + ServerNameRow.Visible = (radioServer.SelectedIndex == 1); + + if (radioServer.SelectedIndex == 0) + { + txtServerName.Text = ""; + } + + // private network + PrivCustomFormatRow.Visible = (ddlPrivateNetworkFormat.SelectedIndex == 0); + + // management network + ManageNicConfigRow.Visible = (ddlManagementNetworks.SelectedIndex > 0); + ManageAlternateNameServerRow.Visible = ManageNicConfigRow.Visible && (ddlManageNicConfig.SelectedIndex == 0); + ManagePreferredNameServerRow.Visible = ManageNicConfigRow.Visible && (ddlManageNicConfig.SelectedIndex == 0); + } + + protected void radioServer_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + protected void btnConnect_Click(object sender, EventArgs e) + { + BindNetworksList(); + } + + protected void ddlPrivateNetworkFormat_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + protected void ddlManageNicConfig_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + + protected void ddlManagementNetworks_SelectedIndexChanged(object sender, EventArgs e) + { + ToggleControls(); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.designer.cs new file mode 100644 index 00000000..40718603 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ProviderControls/HyperV2012R2_Settings.ascx.designer.cs @@ -0,0 +1,825 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.ProviderControls { + + + public partial class HyperV2012R2_Settings { + + /// + /// ValidationSummary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary; + + /// + /// locHyperVServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locHyperVServer; + + /// + /// radioServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButtonList radioServer; + + /// + /// ServerNameRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow ServerNameRow; + + /// + /// locServerName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locServerName; + + /// + /// txtServerName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtServerName; + + /// + /// btnConnect control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnConnect; + + /// + /// ServerNameValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator ServerNameValidator; + + /// + /// ServerErrorRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow ServerErrorRow; + + /// + /// locErrorReadingNetworksList control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label locErrorReadingNetworksList; + + /// + /// locGeneralSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locGeneralSettings; + + /// + /// locVpsRootFolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locVpsRootFolder; + + /// + /// txtVpsRootFolder control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtVpsRootFolder; + + /// + /// RootFolderValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator RootFolderValidator; + + /// + /// locFolderVariables control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locFolderVariables; + + /// + /// locOSTemplatesPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locOSTemplatesPath; + + /// + /// txtOSTemplatesPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtOSTemplatesPath; + + /// + /// TemplatesPathValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator TemplatesPathValidator; + + /// + /// locExportedVpsPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locExportedVpsPath; + + /// + /// txtExportedVpsPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtExportedVpsPath; + + /// + /// ExportedVpsPathValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator ExportedVpsPathValidator; + + /// + /// locProcessorSettings control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locProcessorSettings; + + /// + /// locCpuReserve control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCpuReserve; + + /// + /// txtCpuReserve control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCpuReserve; + + /// + /// CpuReserveValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator CpuReserveValidator; + + /// + /// locCpuLimit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCpuLimit; + + /// + /// txtCpuLimit control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCpuLimit; + + /// + /// CpuLimitValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator CpuLimitValidator; + + /// + /// locCpuWeight control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCpuWeight; + + /// + /// txtCpuWeight control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCpuWeight; + + /// + /// CpuWeightValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator CpuWeightValidator; + + /// + /// locMediaLibrary control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMediaLibrary; + + /// + /// locDvdIsoPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDvdIsoPath; + + /// + /// txtDvdLibraryPath control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtDvdLibraryPath; + + /// + /// DvdLibraryPathValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator DvdLibraryPathValidator; + + /// + /// locVhd control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locVhd; + + /// + /// locDiskType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locDiskType; + + /// + /// radioVirtualDiskType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButtonList radioVirtualDiskType; + + /// + /// locExternalNetwork control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locExternalNetwork; + + /// + /// locExternalNetworkName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locExternalNetworkName; + + /// + /// ddlExternalNetworks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlExternalNetworks; + + /// + /// locPreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPreferredNameServer; + + /// + /// externalPreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl externalPreferredNameServer; + + /// + /// locAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locAlternateNameServer; + + /// + /// externalAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl externalAlternateNameServer; + + /// + /// chkAssignIPAutomatically control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkAssignIPAutomatically; + + /// + /// ManageUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel ManageUpdatePanel; + + /// + /// locManagementNetwork control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locManagementNetwork; + + /// + /// locManagementNetworkName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locManagementNetworkName; + + /// + /// ddlManagementNetworks control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlManagementNetworks; + + /// + /// ManageNicConfigRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow ManageNicConfigRow; + + /// + /// locManageNicConfig control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locManageNicConfig; + + /// + /// ddlManageNicConfig control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlManageNicConfig; + + /// + /// ManagePreferredNameServerRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow ManagePreferredNameServerRow; + + /// + /// locManagePreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locManagePreferredNameServer; + + /// + /// managePreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl managePreferredNameServer; + + /// + /// ManageAlternateNameServerRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow ManageAlternateNameServerRow; + + /// + /// locManageAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locManageAlternateNameServer; + + /// + /// manageAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl manageAlternateNameServer; + + /// + /// PrivUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel PrivUpdatePanel; + + /// + /// locPrivateNetwork control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrivateNetwork; + + /// + /// locIPFormat control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locIPFormat; + + /// + /// ddlPrivateNetworkFormat control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPrivateNetworkFormat; + + /// + /// PrivCustomFormatRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow PrivCustomFormatRow; + + /// + /// locPrivCustomFormat control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrivCustomFormat; + + /// + /// privateIPAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl privateIPAddress; + + /// + /// privateSubnetMask control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox privateSubnetMask; + + /// + /// privateSubnetMaskValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator privateSubnetMaskValidator; + + /// + /// locPrivDefaultGateway control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrivDefaultGateway; + + /// + /// privateDefaultGateway control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl privateDefaultGateway; + + /// + /// locPrivPreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrivPreferredNameServer; + + /// + /// privatePreferredNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl privatePreferredNameServer; + + /// + /// locPrivAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPrivAlternateNameServer; + + /// + /// privateAlternateNameServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.EditIPAddressControl privateAlternateNameServer; + + /// + /// locHostname control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locHostname; + + /// + /// locHostnamePattern control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locHostnamePattern; + + /// + /// txtHostnamePattern control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtHostnamePattern; + + /// + /// HostnamePatternValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator HostnamePatternValidator; + + /// + /// locPatternText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locPatternText; + + /// + /// locStartAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStartAction; + + /// + /// locStartOptionsText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStartOptionsText; + + /// + /// radioStartAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButtonList radioStartAction; + + /// + /// locStartupDelayText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStartupDelayText; + + /// + /// locStartupDelay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStartupDelay; + + /// + /// txtStartupDelay control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtStartupDelay; + + /// + /// locSeconds control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locSeconds; + + /// + /// StartupDelayValidator control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator StartupDelayValidator; + + /// + /// locStopAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStopAction; + + /// + /// locStopActionText control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locStopActionText; + + /// + /// radioStopAction control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButtonList radioStopAction; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index ca62cd3b..388618e7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -258,6 +258,13 @@ EnterpriseStorageOwaUsersList.ascx + + HyperV2012R2_Settings.ascx + ASPXCodeBehind + + + HyperV2012R2_Settings.ascx + HyperV2012R2_Create.ascx ASPXCodeBehind @@ -4517,6 +4524,7 @@ + @@ -4570,6 +4578,9 @@ Designer + + Designer + From aeec78ac02cb391ea41159ff6b0d589c55562485 Mon Sep 17 00:00:00 2001 From: me Date: Fri, 27 Mar 2015 16:10:35 +0400 Subject: [PATCH 23/36] Merge2 --- .../WebsitePanel/WebsitePanel.Portal.Modules.csproj | 5 ----- 1 file changed, 5 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 50cbc343..ed34810f 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -4593,11 +4593,6 @@ Designer - - Designer - - Designer - Designer From dd5fc131bc6bb5de54dd5038578553364037e30e Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Fri, 27 Mar 2015 05:14:53 -0700 Subject: [PATCH 24/36] RDS GPO --- WebsitePanel/Database/update_db.sql | 11 + .../WebsitePanel.EnterpriseServer.Base.csproj | 6 +- .../RemoteDesktopServicesProxy.cs | 4 +- .../Data/DataProvider.cs | 10 + .../RemoteDesktopServicesController.cs | 87 +++++- .../IRemoteDesktopServices.cs | 2 + .../RdsServerSetting.cs | 0 .../RdsServerSettings.cs | 12 +- .../WebsitePanel.Providers.Base.csproj | 2 + .../Windows2012.cs | 250 +++++++++++++++++- .../RemoteDesktopServicesProxy.cs | 53 ++++ .../RemoteDesktopServices.asmx.cs | 17 ++ .../ESModule_ControlsHierarchy.config | 1 + .../App_Data/WebsitePanel_Modules.config | 1 + .../RDS/RDSEditUserExperience.ascx.cs | 138 ++++++++-- 15 files changed, 556 insertions(+), 38 deletions(-) rename WebsitePanel/Sources/{WebsitePanel.EnterpriseServer.Base/RDS => WebsitePanel.Providers.Base/RemoteDesktopServices}/RdsServerSetting.cs (100%) rename WebsitePanel/Sources/{WebsitePanel.EnterpriseServer.Base/RDS => WebsitePanel.Providers.Base/RemoteDesktopServices}/RdsServerSettings.cs (75%) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 49945dca..8829cb8d 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9371,6 +9371,17 @@ AS WHERE RDSServerId = @ServerId AND SettingsName = @SettingsName GO +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteRDSServerSettings') +DROP PROCEDURE DeleteRDSServerSettings +GO +CREATE PROCEDURE DeleteRDSServerSettings +( + @ServerId int +) +AS + DELETE FROM RDSServerSettings WHERE RDSServerId = @ServerId +GO + IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateRDSServerSettings') DROP PROCEDURE UpdateRDSServerSettings diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj index 23f8766e..9f9c3763 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj @@ -134,8 +134,6 @@ - - Component @@ -244,7 +242,9 @@ true - + + +