diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index 87ea9dac..8a9f9136 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -1300,6 +1300,11 @@ namespace WebsitePanel.EnterpriseServer List remoteAppsToAdd = remoteApps.Where(x => !existingCollectionApps.Select(p => p.DisplayName).Contains(x.DisplayName)).ToList(); foreach (var app in remoteAppsToAdd) { + if (!string.IsNullOrEmpty(app.RequiredCommandLine)) + { + app.RequiredCommandLine = string.Format("/v:{0}", collection.Servers.First().FqdName); + } + AddRemoteApplicationToCollection(itemId, collection, app); } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs index 8b03a51b..8c3e9729 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsUserSession.cs @@ -12,5 +12,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices public string UnifiedSessionId { get; set; } public string SessionState { get; set; } public string HostServer { get; set; } + public string DomainName { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RemoteApplication.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RemoteApplication.cs index f15a5fe1..300f8b47 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RemoteApplication.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RemoteApplication.cs @@ -35,5 +35,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices public string FilePath { get; set; } public string FileVirtualPath { get; set; } public bool ShowInWebAccess { get; set; } + public string RequiredCommandLine { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs index b6195e49..afdee244 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/StartMenuApp.cs @@ -33,5 +33,6 @@ namespace WebsitePanel.Providers.RemoteDesktopServices public string DisplayName { get; set; } public string FilePath { get; set; } public string FileVirtualPath { get; set; } + public string RequiredCommandLine { get; set; } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index 508b691c..15cadff0 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -742,6 +742,12 @@ namespace WebsitePanel.Providers.RemoteDesktopServices cmd.Parameters.Add("FilePath", remoteApp.FilePath); cmd.Parameters.Add("ShowInWebAccess", remoteApp.ShowInWebAccess); + if (!string.IsNullOrEmpty(remoteApp.RequiredCommandLine)) + { + cmd.Parameters.Add("CommandLineSetting", "Require"); + cmd.Parameters.Add("RequiredCommandLine", remoteApp.RequiredCommandLine); + } + ExecuteShellCommand(runSpace, cmd, false); result = true; @@ -1157,6 +1163,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices ShowInWebAccess = Convert.ToBoolean(GetPSObjectProperty(psObject, "ShowInWebAccess")) }; + var requiredCommandLine = GetPSObjectProperty(psObject, "RequiredCommandLine"); + remoteApp.RequiredCommandLine = requiredCommandLine == null ? null : requiredCommandLine.ToString(); + return remoteApp; } @@ -1729,9 +1738,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices Command cmd = new Command("Get-RDUserSession"); cmd.Parameters.Add("CollectionName", collectionName); cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); - var userSessions = ExecuteShellCommand(runSpace, cmd, false, out errors); - - //var userSessions = ExecuteShellCommand(runSpace, scripts, out errors); + var userSessions = ExecuteShellCommand(runSpace, cmd, false, out errors); var properties = typeof(RdsUserSession).GetProperties(); foreach(var userSession in userSessions) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx index 53c766e3..e8f7f85d 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSUserSessions.ascx.resx @@ -147,4 +147,7 @@ Log Off + + Refresh + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx index cb81c5b5..33aab7ff 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx @@ -22,51 +22,58 @@
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- -
+ + + +
+
+ +
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs index 24873e88..79e37ea8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.cs @@ -1,4 +1,5 @@ -using System; +using AjaxControlToolkit; +using System; using System.Collections.Generic; using System.Linq; using System.Web; @@ -17,7 +18,7 @@ namespace WebsitePanel.Portal.RDS if (!IsPostBack) { var collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); - litCollectionName.Text = collection.Name; + litCollectionName.Text = collection.DisplayName; BindGrid(); } } @@ -34,7 +35,7 @@ namespace WebsitePanel.Portal.RDS { ES.Services.RDS.LogOffRdsUser(PanelRequest.ItemID, unifiedSessionId, hostServer); BindGrid(); - + ((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide(); } catch (Exception ex) { @@ -49,6 +50,8 @@ namespace WebsitePanel.Portal.RDS { return; } + + BindGrid(); } protected void btnSaveExit_Click(object sender, EventArgs e) @@ -61,6 +64,17 @@ namespace WebsitePanel.Portal.RDS Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId)); } + protected void btnRefresh_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + { + return; + } + + BindGrid(); + ((ModalPopupExtender)asyncTasks.FindControl("ModalPopupProperties")).Hide(); + } + private void BindGrid() { var userSessions = new List(); @@ -74,6 +88,16 @@ namespace WebsitePanel.Portal.RDS ShowErrorMessage("REMOTE_DESKTOP_SERVICES_USER_SESSIONS", ex); } + foreach(var userSession in userSessions) + { + var states = userSession.SessionState.Split('_'); + + if (states.Length == 2) + { + userSession.SessionState = states[1]; + } + } + gvRDSUserSessions.DataSource = userSessions; gvRDSUserSessions.DataBind(); } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs index 9f276bcc..e9944d67 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSUserSessions.ascx.designer.cs @@ -66,6 +66,24 @@ namespace WebsitePanel.Portal.RDS { /// protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + /// + /// RDAppsUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel RDAppsUpdatePanel; + + /// + /// btnRefresh control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnRefresh; + /// /// secRdsUserSessions control. /// 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 ecae4947..088d5153 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionApps.ascx @@ -5,7 +5,7 @@
- +
+ @@ -74,6 +75,7 @@ + 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 2bcf719d..403eea17 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 @@ -50,7 +50,7 @@ namespace WebsitePanel.Portal.RDS.UserControls } public void SetApps(RemoteApplication[] apps) - { + { BindApps(apps, false); } @@ -104,30 +104,52 @@ namespace WebsitePanel.Portal.RDS.UserControls List selectedApps = GetPopUpGridViewApps(); BindApps(selectedApps.ToArray(), true); - - } + } protected void BindPopupApps() { RdsCollection collection = ES.Services.RDS.GetRdsCollection(PanelRequest.CollectionID); - StartMenuApp[] apps = ES.Services.RDS.GetAvailableRemoteApplications(PanelRequest.ItemID, collection.Name); + List apps = ES.Services.RDS.GetAvailableRemoteApplications(PanelRequest.ItemID, collection.Name).ToList(); + + var fullRemote = new StartMenuApp + { + DisplayName = "Session Host", + FilePath = "%SystemRoot%\\system32\\mstsc.exe", + RequiredCommandLine = string.Format("/v:{0}", collection.Servers.First().FqdName) + }; + + var displayNames = GetApps().Select(p => p.DisplayName); + apps = apps.Where(x => !displayNames.Contains(x.DisplayName)).ToList(); - apps = apps.Where(x => !GetApps().Select(p => p.DisplayName).Contains(x.DisplayName)).ToArray(); - Array.Sort(apps, CompareAccount); if (Direction == SortDirection.Ascending) { - Array.Reverse(apps); + apps = apps.OrderBy(a => a.DisplayName).ToList(); Direction = SortDirection.Descending; } else + { + apps = apps.OrderByDescending(a => a.DisplayName).ToList(); Direction = SortDirection.Ascending; + } + + if (!displayNames.Contains(fullRemote.DisplayName)) + { + if (apps.Count > 0) + { + apps.Insert(0, fullRemote); + } + else + { + apps.Add(fullRemote); + } + } gvPopupApps.DataSource = apps; gvPopupApps.DataBind(); } protected void BindApps(RemoteApplication[] newApps, bool preserveExisting) - { + { // get binded addresses List apps = new List(); if(preserveExisting) @@ -154,7 +176,7 @@ namespace WebsitePanel.Portal.RDS.UserControls apps.Add(newApp); } - } + } gvApps.DataSource = apps; gvApps.DataBind(); @@ -174,6 +196,7 @@ namespace WebsitePanel.Portal.RDS.UserControls app.Alias = (string)gvApps.DataKeys[i][0]; app.DisplayName = ((Literal)row.FindControl("litDisplayName")).Text; app.FilePath = ((HiddenField)row.FindControl("hfFilePath")).Value; + app.RequiredCommandLine = ((HiddenField)row.FindControl("hfRequiredCommandLine")).Value; if (state == SelectedState.All || (state == SelectedState.Selected && chkSelect.Checked) || @@ -200,7 +223,8 @@ namespace WebsitePanel.Portal.RDS.UserControls { Alias = (string)gvPopupApps.DataKeys[i][0], DisplayName = ((Literal)row.FindControl("litName")).Text, - FilePath = ((HiddenField)row.FindControl("hfFilePathPopup")).Value + FilePath = ((HiddenField)row.FindControl("hfFilePathPopup")).Value, + RequiredCommandLine = ((HiddenField)row.FindControl("hfRequiredCommandLinePopup")).Value }); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx index b2dc9efc..8f2bbf36 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/UserControls/RDSCollectionUsers.ascx @@ -21,7 +21,7 @@ - + @@ -75,14 +75,14 @@ - + - +