diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 8b609c0f..8565b32c 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -5428,9 +5428,7 @@ GO /*Remote Desktop Services*/ /*Remote Desktop Services Tables*/ -IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollectionUsers') -DROP TABLE RDSCollectionUsers -GO +IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollectionUsers') CREATE TABLE RDSCollectionUsers ( ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY, @@ -5440,9 +5438,7 @@ CREATE TABLE RDSCollectionUsers GO -IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSServers') -DROP TABLE RDSServers -GO +IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSServers') CREATE TABLE RDSServers ( ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY, @@ -5456,9 +5452,7 @@ CREATE TABLE RDSServers GO -IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollections') -DROP TABLE RDSCollections -GO +IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollections') CREATE TABLE RDSCollections ( ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY, diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index 130f395d..3179899a 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -284,6 +284,7 @@ namespace WebsitePanel.EnterpriseServer catch (Exception ex) { result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_COLLECTION", ex); + throw TaskManager.WriteError(ex); } finally { diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index c15e2c69..c845f1ab 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -213,26 +213,26 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } public bool CreateCollection(string organizationId, RdsCollection collection) - { + { var result = true; Runspace runSpace = null; try - { - runSpace = OpenRunspace(); + { + runSpace = OpenRunspace(); foreach (var server in collection.Servers) { //If server will restart it will not be added to collection - //Do not install feature here + //Do not install feature here if (!ExistRdsServerInDeployment(runSpace, server)) - { - AddRdsServerToDeployment(runSpace, server); + { + AddRdsServerToDeployment(runSpace, server); } } - + Command cmd = new Command("New-RDSessionCollection"); cmd.Parameters.Add("CollectionName", collection.Name); cmd.Parameters.Add("SessionHost", collection.Servers.Select(x => x.FqdName).ToArray()); @@ -243,7 +243,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices cmd.Parameters.Add("CollectionDescription", collection.Description); } - var collectionPs = ExecuteShellCommand(runSpace, cmd, false).FirstOrDefault(); + var collectionPs = ExecuteShellCommand(runSpace, cmd, false).FirstOrDefault(); if (collectionPs == null) { @@ -293,11 +293,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer); } - } - catch (Exception e) - { - result = false; - } + } finally { CloseRunspace(runSpace); @@ -934,7 +930,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices runSpace = OpenRunspace(); var feature = AddFeature(runSpace, hostName, "RDS-RD-Server", true, true); installationResult = (bool)GetPSObjectProperty(feature, "Success"); - } + } finally { CloseRunspace(runSpace); @@ -1425,10 +1421,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices if (pipeLine.Error != null && pipeLine.Error.Count > 0) { foreach (object item in pipeLine.Error.ReadToEnd()) - { + { errorList.Add(item); string errorMessage = string.Format("Invoke error: {0}", item); - Log.WriteWarning(errorMessage); + Log.WriteWarning(errorMessage); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx index b7bd03b5..bb59568c 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/AddRDSServer.ascx @@ -28,7 +28,7 @@
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx index a90b852a..0afe155d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx @@ -37,7 +37,7 @@