diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql
index 8829cb8d..228701b7 100644
--- a/WebsitePanel/Database/update_db.sql
+++ b/WebsitePanel/Database/update_db.sql
@@ -9459,4 +9459,6 @@ BEGIN
(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
+GO
+
+UPDATE [dbo].[Quotas] SET GroupID = 45 WHERE QuotaName = 'EnterpriseStorage.DriveMaps'
\ No newline at end of file
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs
index d5b90304..f15a1b1c 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs
@@ -20,8 +20,8 @@ namespace WebsitePanel.EnterpriseServer {
using System.Diagnostics;
using WebsitePanel.Providers.RemoteDesktopServices;
using WebsitePanel.Providers.Common;
- using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.EnterpriseServer.Base.RDS;
+ using WebsitePanel.Providers.HostedSolution;
///
@@ -137,6 +137,8 @@ namespace WebsitePanel.EnterpriseServer {
private System.Threading.SendOrPostCallback UpdateRdsServerSettingsOperationCompleted;
+ private System.Threading.SendOrPostCallback ShadowSessionOperationCompleted;
+
///
public esRemoteDesktopServices() {
this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx";
@@ -301,6 +303,9 @@ namespace WebsitePanel.EnterpriseServer {
///
public event UpdateRdsServerSettingsCompletedEventHandler UpdateRdsServerSettingsCompleted;
+ ///
+ public event ShadowSessionCompletedEventHandler ShadowSessionCompleted;
+
///
[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) {
@@ -2671,6 +2676,53 @@ namespace WebsitePanel.EnterpriseServer {
}
}
+ ///
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/ShadowSession", 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 ShadowSession(int itemId, string sessionId, bool control) {
+ object[] results = this.Invoke("ShadowSession", new object[] {
+ itemId,
+ sessionId,
+ control});
+ return ((ResultObject)(results[0]));
+ }
+
+ ///
+ public System.IAsyncResult BeginShadowSession(int itemId, string sessionId, bool control, System.AsyncCallback callback, object asyncState) {
+ return this.BeginInvoke("ShadowSession", new object[] {
+ itemId,
+ sessionId,
+ control}, callback, asyncState);
+ }
+
+ ///
+ public ResultObject EndShadowSession(System.IAsyncResult asyncResult) {
+ object[] results = this.EndInvoke(asyncResult);
+ return ((ResultObject)(results[0]));
+ }
+
+ ///
+ public void ShadowSessionAsync(int itemId, string sessionId, bool control) {
+ this.ShadowSessionAsync(itemId, sessionId, control, null);
+ }
+
+ ///
+ public void ShadowSessionAsync(int itemId, string sessionId, bool control, object userState) {
+ if ((this.ShadowSessionOperationCompleted == null)) {
+ this.ShadowSessionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnShadowSessionOperationCompleted);
+ }
+ this.InvokeAsync("ShadowSession", new object[] {
+ itemId,
+ sessionId,
+ control}, this.ShadowSessionOperationCompleted, userState);
+ }
+
+ private void OnShadowSessionOperationCompleted(object arg) {
+ if ((this.ShadowSessionCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.ShadowSessionCompleted(this, new ShadowSessionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
///
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@@ -4054,4 +4106,30 @@ namespace WebsitePanel.EnterpriseServer {
}
}
}
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
+ public delegate void ShadowSessionCompletedEventHandler(object sender, ShadowSessionCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.ComponentModel.DesignerCategoryAttribute("code")]
+ public partial class ShadowSessionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ internal ShadowSessionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ ///
+ public ResultObject Result {
+ get {
+ this.RaiseExceptionIfNecessary();
+ return ((ResultObject)(this.results[0]));
+ }
+ }
+ }
}
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs
index 7d585e28..9595fbab 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs
@@ -331,6 +331,49 @@ namespace WebsitePanel.EnterpriseServer
return UpdateRdsServerSettingsInternal(serverId, settingsName, settings);
}
+ public static ResultObject ShadowSession(int itemId, string sessionId, bool control)
+ {
+ return ShadowSessionInternal(itemId, sessionId, control);
+ }
+
+ private static ResultObject ShadowSessionInternal(int itemId, string sessionId, bool control)
+ {
+ var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "SHADOW_RDS_SESSION");
+
+ try
+ {
+ Organization org = OrganizationController.GetOrganization(itemId);
+
+ if (org == null)
+ {
+ result.IsSuccess = false;
+ result.AddError("SHADOW_RDS_SESSION", new NullReferenceException("Organization not found"));
+
+ return result;
+ }
+
+ var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
+ rds.ShadowSession(sessionId, control);
+ }
+ catch (Exception ex)
+ {
+ result.AddError("REMOTE_DESKTOP_SERVICES_SHADOW_RDS_SESSION", ex);
+ }
+ finally
+ {
+ if (!result.IsSuccess)
+ {
+ TaskManager.CompleteResultTask(result);
+ }
+ else
+ {
+ TaskManager.CompleteResultTask();
+ }
+ }
+
+ return result;
+ }
+
private static RdsServerSettings GetRdsServerSettingsInternal(int serverId, string settingsName)
{
IDataReader reader = DataProvider.GetRdsServerSettings(serverId, settingsName);
@@ -363,7 +406,8 @@ namespace WebsitePanel.EnterpriseServer
{
var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(serverId));
var rds = GetRemoteDesktopServices(GetRdsServiceId(collection.ItemId));
- rds.ApplyGPO(collection.Name, settings);
+ Organization org = OrganizationController.GetOrganization(collection.ItemId);
+ rds.ApplyGPO(org.OrganizationId, collection.Name, settings);
XmlDocument doc = new XmlDocument();
XmlElement nodeProps = doc.CreateElement("properties");
@@ -748,7 +792,7 @@ namespace WebsitePanel.EnterpriseServer
};
rds.CreateCollection(org.OrganizationId, collection);
- rds.ApplyGPO(collection.Name, GetDefaultGpoSettings());
+ rds.ApplyGPO(org.OrganizationId, collection.Name, GetDefaultGpoSettings());
collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description, collection.DisplayName);
collection.Settings.RdsCollectionId = collection.Id;
diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs
index 7b977052..b99ea321 100644
--- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs
@@ -380,5 +380,11 @@ namespace WebsitePanel.EnterpriseServer
{
return RemoteDesktopServicesController.UpdateRdsServerSettings(serverId, settingsName, settings);
}
+
+ [WebMethod]
+ public ResultObject ShadowSession(int itemId, string sessionId, bool control)
+ {
+ return RemoteDesktopServicesController.ShadowSession(itemId, sessionId, control);
+ }
}
}
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs
index 1d5b04b4..a2113c2e 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs
@@ -81,6 +81,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
void RemoveRdsServerFromTenantOU(string hostName, string organizationId);
void InstallCertificate(byte[] certificate, string password, List hostNames);
void MoveSessionHostToRdsOU(string hostName);
- void ApplyGPO(string collectionName, RdsServerSettings serverSettings);
+ void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings);
+ void ShadowSession(string sessionId, bool control);
}
}
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs
index be32aaa8..beddb245 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs
@@ -38,7 +38,13 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS
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 const string DRIVE_SPACE_THRESHOLD_VALUE = "DriveSpaceThresholdValue";
+ public const string RDS_VIEW_WITHOUT_PERMISSION = "RDSViewWithoutPermission";
+ public const string RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS = "RDSViewWithoutPermissionAdministrators";
+ public const string RDS_VIEW_WITHOUT_PERMISSION_Users = "RDSViewWithoutPermissionUsers";
+ public const string RDS_CONTROL_WITHOUT_PERMISSION = "RDSControlWithoutPermission";
+ public const string RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS = "RDSControlWithoutPermissionAdministrators";
+ public const string RDS_CONTROL_WITHOUT_PERMISSION_Users = "RDSControlWithoutPermissionUsers";
public string SettingsName { get; set; }
public int ServerId { get; set; }
diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs
index 58bc5ab0..1f3b46ce 100644
--- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs
@@ -93,6 +93,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
private const string DisableTaskManagerGpoValueName = "DisableTaskMgr";
private const string HideCDriveGpoKey = @"HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer";
private const string HideCDriveGpoValueName = "NoDrives";
+ private const string RDSSessionGpoKey = @"HKCU\Software\Policies\Microsoft\Windows NT\Terminal Services";
+ private const string RDSSessionGpoValueName = "Shadow";
#endregion
@@ -371,6 +373,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
CreatePolicy(runSpace, organizationId, string.Format("{0}-administrators", collection.Name), new DirectoryEntry(GetGroupPath(organizationId, collection.Name, GetLocalAdminsGroupName(collection.Name))), collection.Name);
CreatePolicy(runSpace, organizationId, string.Format("{0}-users", collection.Name), new DirectoryEntry(GetUsersGroupPath(organizationId, collection.Name)), collection.Name);
+ CreateHelpDeskPolicy(runSpace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, collection.Name);
}
finally
{
@@ -516,6 +519,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
DeleteGpo(runSpace, string.Format("{0}-administrators", collectionName));
DeleteGpo(runSpace, string.Format("{0}-users", collectionName));
+ DeleteHelpDeskPolicy(runSpace, collectionName);
var capPolicyName = GetPolicyName(organizationId, collectionName, RdsPolicyTypes.RdCap);
var rapPolicyName = GetPolicyName(organizationId, collectionName, RdsPolicyTypes.RdRap);
@@ -1116,7 +1120,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
#region GPO
- public void ApplyGPO(string collectionName, RdsServerSettings serverSettings)
+ public void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings)
{
string administratorsGpo = string.Format("{0}-administrators", collectionName);
string usersGpo = string.Format("{0}-users", collectionName);
@@ -1126,6 +1130,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
{
runspace = OpenRunspace();
+ CreateHelpDeskPolicy(runspace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, collectionName);
RemoveRegistryValue(runspace, ScreenSaverGpoKey, administratorsGpo);
RemoveRegistryValue(runspace, ScreenSaverGpoKey, usersGpo);
RemoveRegistryValue(runspace, RemoveRestartGpoKey, administratorsGpo);
@@ -1133,34 +1138,73 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
RemoveRegistryValue(runspace, DisableTaskManagerGpoKey, administratorsGpo);
RemoveRegistryValue(runspace, DisableTaskManagerGpoKey, usersGpo);
- var setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.SCREEN_SAVER_DISABLED));
- SetRegistryValue(setting, runspace, ScreenSaverGpoKey, administratorsGpo, usersGpo, ScreenSaverValueName, "0", "string");
+ var setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.SCREEN_SAVER_DISABLED));
+ SetRegistryValue(setting, runspace, ScreenSaverGpoKey, administratorsGpo, usersGpo, ScreenSaverValueName, "0", "string");
- setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_SHUTDOWN_RESTART));
- SetRegistryValue(setting, runspace, RemoveRestartGpoKey, administratorsGpo, usersGpo, RemoveRestartGpoValueName, "1", "DWord");
+ setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_SHUTDOWN_RESTART));
+ SetRegistryValue(setting, runspace, RemoveRestartGpoKey, administratorsGpo, usersGpo, RemoveRestartGpoValueName, "1", "DWord");
- setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_RUN_COMMAND));
+ setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.REMOVE_RUN_COMMAND));
SetRegistryValue(setting, runspace, RemoveRunGpoKey, administratorsGpo, usersGpo, RemoveRunGpoValueName, "1", "DWord");
- setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.DISABLE_TASK_MANAGER));
+ setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.DISABLE_TASK_MANAGER));
SetRegistryValue(setting, runspace, DisableTaskManagerGpoKey, administratorsGpo, usersGpo, DisableTaskManagerGpoValueName, "1", "DWord");
- setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.HIDE_C_DRIVE));
- SetRegistryValue(setting, runspace, HideCDriveGpoKey, administratorsGpo, usersGpo, HideCDriveGpoValueName, "4", "DWord");
-
- setting = serverSettings.Settings.First(s => s.PropertyName.Equals(RdsServerSettings.LOCK_SCREEN_TIMEOUT));
+ setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.HIDE_C_DRIVE));
+ SetRegistryValue(setting, runspace, HideCDriveGpoKey, administratorsGpo, usersGpo, HideCDriveGpoValueName, "4", "DWord");
+
+ setting = serverSettings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.LOCK_SCREEN_TIMEOUT));
double result;
- if (!string.IsNullOrEmpty(setting.PropertyValue) && double.TryParse(setting.PropertyValue, out result))
+ if (setting != null && !string.IsNullOrEmpty(setting.PropertyValue) && double.TryParse(setting.PropertyValue, out result))
{
SetRegistryValue(setting, runspace, ScreenSaverTimeoutGpoKey, administratorsGpo, usersGpo, ScreenSaverTimeoutValueName, setting.PropertyValue, "string");
}
+
+ SetRdsSessionHostPermissions(runspace, serverSettings, usersGpo, administratorsGpo);
}
finally
{
CloseRunspace(runspace);
}
- }
+ }
+
+ private void SetRdsSessionHostPermissions(Runspace runspace, RdsServerSettings settings, string usersGpo, string administratorsGpo)
+ {
+ var viewSetting = settings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION));
+ var controlSetting = settings.Settings.FirstOrDefault(s => s.PropertyName.Equals(RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION));
+
+ if (viewSetting == null || controlSetting == null)
+ {
+ return;
+ }
+
+ if (controlSetting.ApplyUsers)
+ {
+ SetRegistryValue(runspace, RDSSessionGpoKey, usersGpo, "2", RDSSessionGpoValueName, "DWord");
+ }
+ else if (viewSetting.ApplyUsers)
+ {
+ SetRegistryValue(runspace, RDSSessionGpoKey, usersGpo, "4", RDSSessionGpoValueName, "DWord");
+ }
+ else
+ {
+ SetRegistryValue(runspace, RDSSessionGpoKey, usersGpo, "3", RDSSessionGpoValueName, "DWord");
+ }
+
+ if (controlSetting.ApplyAdministrators)
+ {
+ SetRegistryValue(runspace, RDSSessionGpoKey, administratorsGpo, "2", RDSSessionGpoValueName, "DWord");
+ }
+ else if (viewSetting.ApplyAdministrators)
+ {
+ SetRegistryValue(runspace, RDSSessionGpoKey, administratorsGpo, "4", RDSSessionGpoValueName, "DWord");
+ }
+ else
+ {
+ SetRegistryValue(runspace, RDSSessionGpoKey, administratorsGpo, "3", RDSSessionGpoValueName, "DWord");
+ }
+ }
private void RemoveRegistryValue(Runspace runspace, string key, string gpoName)
{
@@ -1173,6 +1217,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
private void SetRegistryValue(RdsServerSetting setting, Runspace runspace, string key, string administratorsGpo, string usersGpo, string valueName, string value, string type)
{
+ if (setting == null)
+ {
+ return;
+ }
+
if (setting.ApplyAdministrators)
{
SetRegistryValue(runspace, key, administratorsGpo, value, valueName, type);
@@ -1196,6 +1245,19 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
Collection result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd);
}
+ private void CreateHelpDeskPolicy(Runspace runspace, DirectoryEntry entry, string organizationId, string collectionName)
+ {
+ string gpoName = string.Format("{0}-HelpDesk", collectionName);
+ string gpoId = GetPolicyId(runspace, gpoName);
+
+ if (string.IsNullOrEmpty(gpoId))
+ {
+ gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId, collectionName);
+ SetPolicyPermissions(runspace, gpoName, entry);
+ SetRegistryValue(runspace, RDSSessionGpoKey, gpoName, "2", RDSSessionGpoValueName, "DWord");
+ }
+ }
+
private string CreatePolicy(Runspace runspace, string organizationId, string gpoName, DirectoryEntry entry, string collectionName)
{
string gpoId = GetPolicyId(runspace, gpoName);
@@ -1209,6 +1271,12 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
return gpoId;
}
+ private void DeleteHelpDeskPolicy(Runspace runspace, string collectionName)
+ {
+ string gpoName = string.Format("{0}-HelpDesk", collectionName);
+ DeleteGpo(runspace, gpoName);
+ }
+
private void DeleteGpo(Runspace runspace, string gpoName)
{
Command cmd = new Command("Remove-GPO");
@@ -1235,7 +1303,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
try
{
- var entry = new DirectoryEntry(GetCollectionOUPath(organizationId, string.Format("{0}-OU", collectionName)));
+ var entry = new DirectoryEntry(GetOrganizationPath(organizationId));
var distinguishedName = string.Format("\"{0}\"", ActiveDirectoryUtils.GetADObjectProperty(entry, "DistinguishedName"));
Command cmd = new Command("New-GPO");
@@ -1294,6 +1362,32 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
#endregion
+ #region Shadow Session
+
+ public void ShadowSession(string sessionId, bool control)
+ {
+ Runspace runspace = null;
+
+ try
+ {
+ runspace = OpenRunspace();
+
+ var scripts = new List
+ {
+ string.Format("mstsc /Shadow:{0}{1}", sessionId, control ? " /Control" : "")
+ };
+
+ object[] errors = null;
+ ExecuteShellCommand(runspace, scripts, out errors);
+ }
+ finally
+ {
+ CloseRunspace(runspace);
+ }
+ }
+
+ #endregion
+
#region RDS Help Desk
private string GetHelpDeskGroupPath(string groupName)
diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs
index fbb586a2..924cfa7d 100644
--- a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs
@@ -104,6 +104,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
private System.Threading.SendOrPostCallback ApplyGPOOperationCompleted;
+ private System.Threading.SendOrPostCallback ShadowSessionOperationCompleted;
+
///
public RemoteDesktopServices() {
this.Url = "http://localhost:9003/RemoteDesktopServices.asmx";
@@ -220,6 +222,9 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
///
public event ApplyGPOCompletedEventHandler ApplyGPOCompleted;
+ ///
+ public event ShadowSessionCompletedEventHandler ShadowSessionCompleted;
+
///
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@@ -1791,15 +1796,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
///
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/ApplyGPO", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
- public void ApplyGPO(string collectionName, RdsServerSettings serverSettings) {
+ public void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings) {
this.Invoke("ApplyGPO", new object[] {
+ organizationId,
collectionName,
serverSettings});
}
///
- public System.IAsyncResult BeginApplyGPO(string collectionName, RdsServerSettings serverSettings, System.AsyncCallback callback, object asyncState) {
+ public System.IAsyncResult BeginApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("ApplyGPO", new object[] {
+ organizationId,
collectionName,
serverSettings}, callback, asyncState);
}
@@ -1810,16 +1817,17 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
///
- public void ApplyGPOAsync(string collectionName, RdsServerSettings serverSettings) {
- this.ApplyGPOAsync(collectionName, serverSettings, null);
+ public void ApplyGPOAsync(string organizationId, string collectionName, RdsServerSettings serverSettings) {
+ this.ApplyGPOAsync(organizationId, collectionName, serverSettings, null);
}
///
- public void ApplyGPOAsync(string collectionName, RdsServerSettings serverSettings, object userState) {
+ public void ApplyGPOAsync(string organizationId, string collectionName, RdsServerSettings serverSettings, object userState) {
if ((this.ApplyGPOOperationCompleted == null)) {
this.ApplyGPOOperationCompleted = new System.Threading.SendOrPostCallback(this.OnApplyGPOOperationCompleted);
}
this.InvokeAsync("ApplyGPO", new object[] {
+ organizationId,
collectionName,
serverSettings}, this.ApplyGPOOperationCompleted, userState);
}
@@ -1831,6 +1839,49 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
}
}
+ ///
+ [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
+ [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/ShadowSession", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+ public void ShadowSession(string sessionId, bool control) {
+ this.Invoke("ShadowSession", new object[] {
+ sessionId,
+ control});
+ }
+
+ ///
+ public System.IAsyncResult BeginShadowSession(string sessionId, bool control, System.AsyncCallback callback, object asyncState) {
+ return this.BeginInvoke("ShadowSession", new object[] {
+ sessionId,
+ control}, callback, asyncState);
+ }
+
+ ///
+ public void EndShadowSession(System.IAsyncResult asyncResult) {
+ this.EndInvoke(asyncResult);
+ }
+
+ ///
+ public void ShadowSessionAsync(string sessionId, bool control) {
+ this.ShadowSessionAsync(sessionId, control, null);
+ }
+
+ ///
+ public void ShadowSessionAsync(string sessionId, bool control, object userState) {
+ if ((this.ShadowSessionOperationCompleted == null)) {
+ this.ShadowSessionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnShadowSessionOperationCompleted);
+ }
+ this.InvokeAsync("ShadowSession", new object[] {
+ sessionId,
+ control}, this.ShadowSessionOperationCompleted, userState);
+ }
+
+ private void OnShadowSessionOperationCompleted(object arg) {
+ if ((this.ShadowSessionCompleted != null)) {
+ System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+ this.ShadowSessionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+ }
+ }
+
///
public new void CancelAsync(object userState) {
base.CancelAsync(userState);
@@ -2468,4 +2519,8 @@ namespace WebsitePanel.Providers.RemoteDesktopServices {
///
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void ApplyGPOCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
+
+ ///
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
+ public delegate void ShadowSessionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
}
diff --git a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs
index ff949699..c246e544 100644
--- a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs
+++ b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs
@@ -665,12 +665,12 @@ namespace WebsitePanel.Server
}
[WebMethod, SoapHeader("settings")]
- public void ApplyGPO(string collectionName, RdsServerSettings serverSettings)
+ public void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings)
{
try
{
Log.WriteStart("'{0}' ApplyGPO", ProviderSettings.ProviderName);
- RDSProvider.ApplyGPO(collectionName, serverSettings);
+ RDSProvider.ApplyGPO(organizationId, collectionName, serverSettings);
Log.WriteEnd("'{0}' ApplyGPO", ProviderSettings.ProviderName);
}
catch (Exception ex)
@@ -679,5 +679,21 @@ namespace WebsitePanel.Server
throw;
}
}
+
+ [WebMethod, SoapHeader("settings")]
+ public void ShadowSession(string sessionId, bool control)
+ {
+ try
+ {
+ Log.WriteStart("'{0}' ShadowSession", ProviderSettings.ProviderName);
+ RDSProvider.ShadowSession(sessionId, control);
+ Log.WriteEnd("'{0}' ShadowSession", ProviderSettings.ProviderName);
+ }
+ catch (Exception ex)
+ {
+ Log.WriteError(String.Format("'{0}' ShadowSession", ProviderSettings.ProviderName), ex);
+ throw;
+ }
+ }
}
}
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 cbff0b24..937e6e43 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx
@@ -5702,6 +5702,12 @@
RDS User logging off error
+
+ View session error
+
+
+ Control session error
+
Getting RDS User sessions error
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
index 6f342a55..837eae3e 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx
@@ -123,6 +123,12 @@
Users
+
+ Changing Desktop Disabled
+
+
+ Control RDS Session without Users's Permission
+
Drive Space Threshold
@@ -147,7 +153,7 @@
Lock Screen Timeout (sec.)
-
- Changing Desktop Disabled
+
+ View RDS Session without Users's Permission
\ No newline at end of file
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
index 91b50033..a6355f92 100644
--- 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
@@ -123,6 +123,12 @@
Users
+
+ Changing Desktop Disabled
+
+
+ Control RDS Session without Users's Permission
+
Drive Space Threshold
@@ -147,7 +153,7 @@
Lock Screen Timeout
-
- Changing Desktop Disabled
+
+ View RDS Session without Users's Permission
\ No newline at end of file
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 e8f7f85d..54e311d7 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
@@ -150,4 +150,16 @@
Refresh
+
+ Control
+
+
+ Control Session
+
+
+ View
+
+
+ View Session
+
\ 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
index ff6065a3..44b5384b 100644
--- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx
+++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSEditUserExperience.ascx
@@ -162,6 +162,34 @@
+
+
+
+
+
+
+
+
+
+