Update_DB RDS tables fix
This commit is contained in:
parent
8cc464668a
commit
c0fecdcf33
5 changed files with 18 additions and 27 deletions
|
@ -5428,9 +5428,7 @@ GO
|
||||||
/*Remote Desktop Services*/
|
/*Remote Desktop Services*/
|
||||||
|
|
||||||
/*Remote Desktop Services Tables*/
|
/*Remote Desktop Services Tables*/
|
||||||
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollectionUsers')
|
IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollectionUsers')
|
||||||
DROP TABLE RDSCollectionUsers
|
|
||||||
GO
|
|
||||||
CREATE TABLE RDSCollectionUsers
|
CREATE TABLE RDSCollectionUsers
|
||||||
(
|
(
|
||||||
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||||
|
@ -5440,9 +5438,7 @@ CREATE TABLE RDSCollectionUsers
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
|
||||||
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSServers')
|
IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSServers')
|
||||||
DROP TABLE RDSServers
|
|
||||||
GO
|
|
||||||
CREATE TABLE RDSServers
|
CREATE TABLE RDSServers
|
||||||
(
|
(
|
||||||
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||||
|
@ -5456,9 +5452,7 @@ CREATE TABLE RDSServers
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
|
||||||
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollections')
|
IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollections')
|
||||||
DROP TABLE RDSCollections
|
|
||||||
GO
|
|
||||||
CREATE TABLE RDSCollections
|
CREATE TABLE RDSCollections
|
||||||
(
|
(
|
||||||
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||||
|
|
|
@ -284,6 +284,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_COLLECTION", ex);
|
result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_COLLECTION", ex);
|
||||||
|
throw TaskManager.WriteError(ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -213,26 +213,26 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateCollection(string organizationId, RdsCollection collection)
|
public bool CreateCollection(string organizationId, RdsCollection collection)
|
||||||
{
|
{
|
||||||
var result = true;
|
var result = true;
|
||||||
|
|
||||||
Runspace runSpace = null;
|
Runspace runSpace = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
runSpace = OpenRunspace();
|
runSpace = OpenRunspace();
|
||||||
|
|
||||||
foreach (var server in collection.Servers)
|
foreach (var server in collection.Servers)
|
||||||
{
|
{
|
||||||
//If server will restart it will not be added to collection
|
//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))
|
if (!ExistRdsServerInDeployment(runSpace, server))
|
||||||
{
|
{
|
||||||
AddRdsServerToDeployment(runSpace, server);
|
AddRdsServerToDeployment(runSpace, server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Command cmd = new Command("New-RDSessionCollection");
|
Command cmd = new Command("New-RDSessionCollection");
|
||||||
cmd.Parameters.Add("CollectionName", collection.Name);
|
cmd.Parameters.Add("CollectionName", collection.Name);
|
||||||
cmd.Parameters.Add("SessionHost", collection.Servers.Select(x => x.FqdName).ToArray());
|
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);
|
cmd.Parameters.Add("CollectionDescription", collection.Description);
|
||||||
}
|
}
|
||||||
|
|
||||||
var collectionPs = ExecuteShellCommand(runSpace, cmd, false).FirstOrDefault();
|
var collectionPs = ExecuteShellCommand(runSpace, cmd, false).FirstOrDefault();
|
||||||
|
|
||||||
if (collectionPs == null)
|
if (collectionPs == null)
|
||||||
{
|
{
|
||||||
|
@ -293,11 +293,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
{
|
{
|
||||||
AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer);
|
AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
CloseRunspace(runSpace);
|
CloseRunspace(runSpace);
|
||||||
|
@ -934,7 +930,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
runSpace = OpenRunspace();
|
runSpace = OpenRunspace();
|
||||||
var feature = AddFeature(runSpace, hostName, "RDS-RD-Server", true, true);
|
var feature = AddFeature(runSpace, hostName, "RDS-RD-Server", true, true);
|
||||||
installationResult = (bool)GetPSObjectProperty(feature, "Success");
|
installationResult = (bool)GetPSObjectProperty(feature, "Success");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
CloseRunspace(runSpace);
|
CloseRunspace(runSpace);
|
||||||
|
@ -1425,10 +1421,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||||
if (pipeLine.Error != null && pipeLine.Error.Count > 0)
|
if (pipeLine.Error != null && pipeLine.Error.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (object item in pipeLine.Error.ReadToEnd())
|
foreach (object item in pipeLine.Error.ReadToEnd())
|
||||||
{
|
{
|
||||||
errorList.Add(item);
|
errorList.Add(item);
|
||||||
string errorMessage = string.Format("Invoke error: {0}", item);
|
string errorMessage = string.Format("Invoke error: {0}", item);
|
||||||
Log.WriteWarning(errorMessage);
|
Log.WriteWarning(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="FormFooterClean">
|
<div class="FormFooterClean">
|
||||||
<asp:Button id="btnAdd" runat="server" Text="Add" CssClass="Button1" meta:resourcekey="btnAdd" ValidationGroup="AddRDSServer" OnClick="btnAdd_Click"></asp:Button>
|
<asp:Button id="btnAdd" runat="server" Text="Add" CssClass="Button1" meta:resourcekey="btnAdd" ValidationGroup="AddRDSServer" OnClick="btnAdd_Click" OnClientClick="ShowProgressDialog('Adding server...');"></asp:Button>
|
||||||
<asp:ValidationSummary ID="valSummary" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="AddRDSServer" />
|
<asp:ValidationSummary ID="valSummary" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="AddRDSServer" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<div class="FormFooter">
|
<div class="FormFooter">
|
||||||
<asp:Button id="btnSave" runat="server" Text="Save" CssClass="Button1" meta:resourcekey="btnSave" OnClick="btnSave_Click" ValidationGroup="SaveRDSCollection"></asp:Button>
|
<asp:Button id="btnSave" runat="server" Text="Save" CssClass="Button1" meta:resourcekey="btnSave" OnClick="btnSave_Click" OnClientClick="ShowProgressDialog('Adding collection...');" ValidationGroup="SaveRDSCollection"></asp:Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue