diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index 80ce0ea2..8d31d923 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -1111,7 +1111,7 @@ namespace WebsitePanel.EnterpriseServer var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); var collection = GetRdsCollection(collectionId); - result.AddRange(rds.GetApplicationUsers(collection.Name, remoteApp.DisplayName)); + result.AddRange(rds.GetApplicationUsers(collection.Name, remoteApp.Alias)); return result; } @@ -1130,7 +1130,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var collection = GetRdsCollection(collectionId); + var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(collectionId)); var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); rds.SetApplicationUsers(collection.Name, remoteApp, users.ToArray()); } @@ -1214,7 +1214,6 @@ namespace WebsitePanel.EnterpriseServer } remoteApp.ShowInWebAccess = true; - rds.AddRemoteApplication(collection.Name, remoteApp); } catch (Exception ex) @@ -1319,13 +1318,14 @@ namespace WebsitePanel.EnterpriseServer } List existingCollectionApps = GetCollectionRemoteApplications(itemId, collection.Name); - List remoteAppsToAdd = remoteApps.Where(x => !existingCollectionApps.Select(p => p.DisplayName).Contains(x.DisplayName)).ToList(); + List remoteAppsToAdd = remoteApps.Where(x => !existingCollectionApps.Select(p => p.Alias).Contains(x.Alias)).ToList(); foreach (var app in remoteAppsToAdd) - { + { + app.ShowInWebAccess = true; AddRemoteApplicationToCollection(itemId, collection, app); } - List remoteAppsToRemove = existingCollectionApps.Where(x => !remoteApps.Select(p => p.DisplayName).Contains(x.DisplayName)).ToList(); + List remoteAppsToRemove = existingCollectionApps.Where(x => !remoteApps.Select(p => p.Alias).Contains(x.Alias)).ToList(); foreach (var app in remoteAppsToRemove) { RemoveRemoteApplicationFromCollection(itemId, collection, app); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs index afdee244..3070ae50 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs @@ -34,5 +34,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices public string FilePath { get; set; } public string FileVirtualPath { get; set; } public string RequiredCommandLine { get; set; } + public string Alias { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index 875c9844..2a0bd0c7 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -643,7 +643,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices Command cmd = new Command("Get-RDRemoteApp"); cmd.Parameters.Add("CollectionName", collectionName); cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); - cmd.Parameters.Add("DisplayName", applicationName); + cmd.Parameters.Add("Alias", applicationName); var application = ExecuteShellCommand(runspace, cmd, false).FirstOrDefault(); @@ -899,21 +899,34 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { RemoveRdRap(runSpace, gatewayHost, policyName); } - - Log.WriteWarning(gatewayHost); + var userGroupParametr = string.Format("@({0})", string.Join(",", groups.Select(x => string.Format("\"{0}@{1}\"", x, RootDomain)).ToArray())); var computerGroupParametr = string.Format("\"{0}@{1}\"", GetComputersGroupName(collectionName), RootDomain); Command rdRapCommand = new Command("New-Item"); rdRapCommand.Parameters.Add("Path", string.Format("\"{0}\"", RapPath)); rdRapCommand.Parameters.Add("Name", string.Format("\"{0}\"", policyName)); - rdRapCommand.Parameters.Add("UserGroups", userGroupParametr); + rdRapCommand.Parameters.Add("UserGroups", userGroupParametr); rdRapCommand.Parameters.Add("ComputerGroupType", 1); - rdRapCommand.Parameters.Add("ComputerGroup", computerGroupParametr); - Log.WriteWarning("User Group:" + userGroupParametr); - Log.WriteWarning("Computer Group:" + computerGroupParametr); - ExecuteRemoteShellCommand(runSpace, gatewayHost, rdRapCommand, RdsModuleName); - Log.WriteWarning("RD RAP Added"); + rdRapCommand.Parameters.Add("ComputerGroup", computerGroupParametr); + + object[] errors; + + for (int i = 0; i < 3; i++) + { + Log.WriteWarning(string.Format("Adding RD RAP ... {0}\r\nGateway Host\t{1}\r\nUser Group\t{2}\r\nComputer Group\t{3}", i + 1, gatewayHost, userGroupParametr, computerGroupParametr)); + ExecuteRemoteShellCommand(runSpace, gatewayHost, rdRapCommand, out errors, RdsModuleName); + + if (errors == null || !errors.Any()) + { + Log.WriteWarning("RD RAP Added Successfully"); + break; + } + else + { + Log.WriteWarning(string.Join("\r\n", errors.Select(e => e.ToString()).ToArray())); + } + } } internal void RemoveRdRap(Runspace runSpace, string gatewayHost, string name) @@ -1179,6 +1192,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices FileVirtualPath = Convert.ToString(GetPSObjectProperty(psObject, "FileVirtualPath")) }; + remoteApp.Alias = remoteApp.DisplayName; + return remoteApp; } @@ -1493,6 +1508,12 @@ namespace WebsitePanel.Providers.RemoteDesktopServices } internal Collection ExecuteRemoteShellCommand(Runspace runSpace, string hostName, Command cmd, params string[] moduleImports) + { + object[] errors; + return ExecuteRemoteShellCommand(runSpace, hostName, cmd, out errors, moduleImports); + } + + internal Collection ExecuteRemoteShellCommand(Runspace runSpace, string hostName, Command cmd, out object[] errors, params string[] moduleImports) { Command invokeCommand = new Command("Invoke-Command"); invokeCommand.Parameters.Add("ComputerName", hostName); @@ -1512,9 +1533,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices ScriptBlock sb = invoke.Invoke(string.Format("{{{0}}}", commandString))[0].BaseObject as ScriptBlock; - invokeCommand.Parameters.Add("ScriptBlock", sb); + invokeCommand.Parameters.Add("ScriptBlock", sb); - return ExecuteShellCommand(runSpace, invokeCommand, false); + return ExecuteShellCommand(runSpace, invokeCommand, false, out errors); } internal Collection ExecuteRemoteShellCommand(Runspace runSpace, string hostName, List scripts, params string[] moduleImports) @@ -1779,12 +1800,28 @@ namespace WebsitePanel.Providers.RemoteDesktopServices prop.SetValue(session, GetPSObjectProperty(userSession, prop.Name).ToString(), null); } + session.UserName = GetUserFullName(session.DomainName, session.UserName, runSpace); result.Add(session); } return result; } + private string GetUserFullName(string domain, string userName, Runspace runspace) + { + Command cmd = new Command("Get-WmiObject"); + cmd.Parameters.Add("Class", "win32_useraccount"); + cmd.Parameters.Add("Filter", string.Format("Domain = '{0}' AND Name = '{1}'", domain, userName)); + var names = ExecuteShellCommand(runspace, cmd, false); + + if (names.Any()) + { + return names.First().Members["FullName"].Value.ToString(); + } + + return ""; + } + #endregion } } 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 9e50d93c..92c1740b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -5641,6 +5641,9 @@ RDS Collection settings not updated + + Remote application users not updated + RDS User logging off error diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx index 7e96a0d6..eb391f90 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSEditApplicationUsers.ascx.resx @@ -127,10 +127,10 @@ - Edit RDS Application + Edit RDS Collection - Edit RDS Application + Edit RDS Collection Collection Name: @@ -144,4 +144,13 @@ Application Name: + + Users + + + + + + Application Name + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx index 9169f231..6095f06d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx @@ -2,6 +2,9 @@ <%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> <%@ Register Src="UserControls/RDSCollectionUsers.ascx" TagName="CollectionUsers" 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" %> @@ -12,40 +15,50 @@
-
+
- + + - +
- - - - - - - - - - - -
- -
- -
- -
- + + + + + + + +
+ + + + + +
+ + + + +
+
+
+ + + + +
-
-
- -
- - -
-
+
+ +
+ +
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs index 72317ca2..6190b880 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.cs @@ -44,17 +44,38 @@ namespace WebsitePanel.Portal.RDS { var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); var applications = ES.Services.RDS.GetCollectionRemoteApplications(PanelRequest.ItemID, collection.Name); - var remoteApp = applications.Where(x => x.DisplayName.Equals(PanelRequest.ApplicationID, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); - var collectionUsers = ES.Services.RDS.GetRdsCollectionUsers(PanelRequest.CollectionID); + var remoteApp = applications.Where(x => x.Alias.Equals(PanelRequest.ApplicationID, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); + var organizationUsers = ES.Services.Organizations.GetOrganizationUsersPaged(PanelRequest.ItemID, null, null, null, 0, Int32.MaxValue).PageUsers; var applicationUsers = ES.Services.RDS.GetApplicationUsers(PanelRequest.ItemID, PanelRequest.CollectionID, remoteApp); - locCName.Text = collection.Name; - locAppName.Text = remoteApp.DisplayName; + litCollectionName.Text = collection.Name; + txtApplicationName.Text = remoteApp.DisplayName; + var remoteAppUsers = organizationUsers.Where(x => applicationUsers.Contains(x.DomainUserName)); - users.SetUsers(collectionUsers.Where(x => applicationUsers.Contains(x.SamAccountName)).ToArray()); + users.SetUsers(remoteAppUsers.ToArray()); } } + private bool SaveApplicationUsers() + { + try + { + var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); + var applications = ES.Services.RDS.GetCollectionRemoteApplications(PanelRequest.ItemID, collection.Name); + var remoteApp = applications.Where(x => x.Alias.Equals(PanelRequest.ApplicationID, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); + remoteApp.DisplayName = txtApplicationName.Text; + ES.Services.RDS.SetApplicationUsers(PanelRequest.ItemID, PanelRequest.CollectionID, remoteApp, users.GetUsers().Select(x => x.AccountName).ToArray()); + } + catch (Exception ex) + { + ShowErrorMessage("REMOTEAPPUSERS_NOT_UPDATED", ex); + + return false; + } + + return true; + } + protected void btnSave_Click(object sender, EventArgs e) { if (!Page.IsValid) @@ -62,17 +83,19 @@ namespace WebsitePanel.Portal.RDS return; } - try - { - var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); - var applications = ES.Services.RDS.GetCollectionRemoteApplications(PanelRequest.ItemID, collection.Name); - var remoteApp = applications.Where(x => x.DisplayName.Equals(PanelRequest.ApplicationID, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); - ES.Services.RDS.SetApplicationUsers(PanelRequest.ItemID, PanelRequest.CollectionID, remoteApp, users.GetUsers().Select(x => x.AccountName).ToArray()); + SaveApplicationUsers(); + } - Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_collection_edit_apps", "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID)); - } - catch (Exception) + protected void btnSaveExit_Click(object sender, EventArgs e) + { + if (!Page.IsValid) { + return; + } + + if (SaveApplicationUsers()) + { + Response.Redirect(EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "rds_collection_edit_apps", "CollectionId=" + PanelRequest.CollectionID, "ItemID=" + PanelRequest.ItemID)); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs index edb35ca6..fd65d541 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditApplicationUsers.ascx.designer.cs @@ -40,67 +40,94 @@ namespace WebsitePanel.Portal.RDS { protected global::System.Web.UI.WebControls.Localize locTitle; /// - /// messageBox control. + /// litCollectionName control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + protected global::System.Web.UI.WebControls.Literal litCollectionName; /// - /// locCollectionName control. + /// SimpleMessageBox1 control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Localize locCollectionName; + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox SimpleMessageBox1; /// - /// locCName control. + /// tabs control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Localize locCName; + protected global::WebsitePanel.Portal.RDS.UserControls.RdsServerTabs tabs; /// - /// locApplicationName control. + /// secRdsApplicationEdit control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Localize locApplicationName; + protected global::WebsitePanel.Portal.CollapsiblePanel secRdsApplicationEdit; /// - /// locAppName control. + /// panelRdsApplicationEdit control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Localize locAppName; + protected global::System.Web.UI.WebControls.Panel panelRdsApplicationEdit; /// - /// UsersPanel control. + /// locLblApplicationName control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl UsersPanel; + protected global::System.Web.UI.WebControls.Localize locLblApplicationName; /// - /// locUsersSection control. + /// txtApplicationName control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Localize locUsersSection; + protected global::System.Web.UI.WebControls.TextBox txtApplicationName; + + /// + /// valApplicationName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valApplicationName; + + /// + /// secRdsApplicationUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secRdsApplicationUsers; + + /// + /// panelRdsApplicationUsers control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel panelRdsApplicationUsers; /// /// users control. @@ -112,21 +139,12 @@ namespace WebsitePanel.Portal.RDS { protected global::WebsitePanel.Portal.RDS.UserControls.RDSCollectionUsers users; /// - /// btnSave control. + /// buttonPanel control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Button btnSave; - - /// - /// valSummary control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.ValidationSummary valSummary; + protected global::WebsitePanel.Portal.ItemButtonPanel buttonPanel; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx index 33aab7ff..642ed06a 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx @@ -42,7 +42,7 @@ - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx index 0adb8a73..f5d024dc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/App_LocalResources/RDSCollectionApps.ascx.resx @@ -153,4 +153,7 @@ Available Remote Applications + + ShowProgressDialog('Loading ...'); + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx index 088d5153..782d0213 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx @@ -24,16 +24,11 @@ - + - - - - Users - - +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs index ba781532..22651296 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx.cs @@ -113,8 +113,8 @@ namespace WebsitePanel.Portal.RDS.UserControls var sessionHosts = ES.Services.RDS.GetRdsCollectionSessionHosts(PanelRequest.CollectionID); var addedApplications = GetApps(); - var displayNames = addedApplications.Select(p => p.DisplayName); - apps = apps.Where(x => !displayNames.Contains(x.DisplayName)).ToList(); + var aliases = addedApplications.Select(p => p.Alias); + apps = apps.Where(x => !aliases.Contains(x.Alias)).ToList(); if (Direction == SortDirection.Ascending) { @@ -132,7 +132,7 @@ namespace WebsitePanel.Portal.RDS.UserControls foreach (var host in sessionHosts) { if (!requiredParams.Contains(string.Format("/v:{0}", host.ToLower()))) - { + { var fullRemote = new StartMenuApp { DisplayName = string.Format("Full Desktop - {0}", host.ToLower()), @@ -140,6 +140,15 @@ namespace WebsitePanel.Portal.RDS.UserControls RequiredCommandLine = string.Format("/v:{0}", host.ToLower()) }; + var sessionHost = collection.Servers.Where(s => s.FqdName.Equals(host, StringComparison.CurrentCultureIgnoreCase)).First(); + + if (sessionHost != null) + { + fullRemote.DisplayName = string.Format("Full Desktop - {0}", sessionHost.Name.ToLower()); + } + + fullRemote.Alias = fullRemote.DisplayName.Replace(" ", ""); + if (apps.Count > 0) { apps.Insert(0, fullRemote); @@ -201,7 +210,7 @@ namespace WebsitePanel.Portal.RDS.UserControls RemoteApplication app = new RemoteApplication(); app.Alias = (string)gvApps.DataKeys[i][0]; - app.DisplayName = ((Literal)row.FindControl("litDisplayName")).Text; + app.DisplayName = ((HyperLink)row.FindControl("lnkDisplayName")).Text; app.FilePath = ((HiddenField)row.FindControl("hfFilePath")).Value; app.RequiredCommandLine = ((HiddenField)row.FindControl("hfRequiredCommandLine")).Value;