public static ResultObject RemoveRemoteApplicationFromCollection(int itemId, RdsCollection collection, RemoteApplication application) { return RemoveRemoteApplicationFromCollectionInternal(itemId, collection, application); }
public bool RemoveRemoteApplication(string collectionName, RemoteApplication remoteApp) { object[] results = this.Invoke("RemoveRemoteApplication", new object[] { collectionName, remoteApp}); return ((bool)(results[0])); }
/// <remarks/> public void RemoveRemoteApplicationAsync(string collectionName, RemoteApplication remoteApp) { this.RemoveRemoteApplicationAsync(collectionName, remoteApp, null); }
public bool AddRemoteApplications(string collectionName, RemoteApplication[] remoteApps) { object[] results = this.Invoke("AddRemoteApplications", new object[] { collectionName, remoteApps}); return ((bool)(results[0])); }
/// <remarks/> public void AddRemoteApplicationsAsync(string collectionName, RemoteApplication[] remoteApps) { this.AddRemoteApplicationsAsync(collectionName, remoteApps, null); }
public bool SetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users) { object[] results = this.Invoke("SetApplicationUsers", new object[] { collectionName, remoteApp, users}); return ((bool)(results[0])); }
/// <remarks/> public void SetApplicationUsersAsync(string collectionName, RemoteApplication remoteApp, string[] users) { this.SetApplicationUsersAsync(collectionName, remoteApp, users, null); }
public bool AddRemoteApplication(string collectionName, RemoteApplication remoteApp) { var result = false; Runspace runSpace = null; try { runSpace = OpenRunspace(); Command cmd = new Command("New-RDRemoteApp"); cmd.Parameters.Add("CollectionName", collectionName); cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); cmd.Parameters.Add("Alias", remoteApp.Alias); cmd.Parameters.Add("DisplayName", remoteApp.DisplayName); cmd.Parameters.Add("FilePath", remoteApp.FilePath); cmd.Parameters.Add("ShowInWebAccess", remoteApp.ShowInWebAccess); cmd.Parameters.Add("CommandLineSetting", remoteApp.CommandLineSettings.ToString()); if (remoteApp.CommandLineSettings == CommandLineSettings.Require) { cmd.Parameters.Add("RequiredCommandLine", remoteApp.RequiredCommandLine); } ExecuteShellCommand(runSpace, cmd, false); result = true; } finally { CloseRunspace(runSpace); } return result; }
public bool RemoveRemoteApplication(string collectionName, RemoteApplication remoteApp) { var result = false; Runspace runSpace = null; try { runSpace = OpenRunspace(); Command cmd = new Command("Remove-RDRemoteApp"); cmd.Parameters.Add("CollectionName", collectionName); cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); cmd.Parameters.Add("Alias", remoteApp.Alias); cmd.Parameters.Add("Force", true); ExecuteShellCommand(runSpace, cmd, false); } finally { CloseRunspace(runSpace); } return result; }
private RemoteApplication CreateRemoteApplicationFromPsObject(PSObject psObject) { var remoteApp = new RemoteApplication { DisplayName = Convert.ToString(GetPSObjectProperty(psObject, "DisplayName")), FilePath = Convert.ToString(GetPSObjectProperty(psObject, "FilePath")), Alias = Convert.ToString(GetPSObjectProperty(psObject, "Alias")), ShowInWebAccess = Convert.ToBoolean(GetPSObjectProperty(psObject, "ShowInWebAccess")), Users = null }; var requiredCommandLine = GetPSObjectProperty(psObject, "RequiredCommandLine"); remoteApp.RequiredCommandLine = requiredCommandLine == null ? null : requiredCommandLine.ToString(); var commandLineSettings = GetPSObjectProperty(psObject, "CommandLineSetting"); if (commandLineSettings != null) { remoteApp.CommandLineSettings = (CommandLineSettings)Enum.Parse(typeof(CommandLineSettings), commandLineSettings.ToString()); } var users = (string[])(GetPSObjectProperty(psObject, "UserGroups")); if (users != null && users.Any()) { remoteApp.Users = users; } else { remoteApp.Users = null; } return remoteApp; }
public bool SetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users) { Runspace runspace = null; bool result = true; try { Log.WriteWarning(string.Format("App alias: {0}\r\nCollection Name:{2}\r\nUsers: {1}", remoteApp.Alias, string.Join("; ", users), collectionName)); runspace = OpenRunspace(); Command cmd = new Command("Set-RDRemoteApp"); cmd.Parameters.Add("CollectionName", collectionName); cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); cmd.Parameters.Add("DisplayName", remoteApp.DisplayName); cmd.Parameters.Add("UserGroups", users); cmd.Parameters.Add("Alias", remoteApp.Alias); cmd.Parameters.Add("CommandLineSetting", remoteApp.CommandLineSettings.ToString()); if (remoteApp.CommandLineSettings == CommandLineSettings.Require) { cmd.Parameters.Add("RequiredCommandLine", remoteApp.RequiredCommandLine); } object[] errors; ExecuteShellCommand(runspace, cmd, false, out errors).FirstOrDefault(); if (errors.Any()) { Log.WriteWarning(string.Format("{0} adding users errors: {1}", remoteApp.DisplayName, string.Join("\r\n", errors.Select(e => e.ToString()).ToArray()))); } else { Log.WriteWarning(string.Format("{0} users added successfully", remoteApp.DisplayName)); } } catch(Exception) { result = false; } finally { CloseRunspace(runspace); } return result; }
public bool RemoveRemoteApplication(string collectionName, RemoteApplication remoteApp) { var result = false; Runspace runSpace = null; try { runSpace = RdsRunspaceExtensions.OpenRunspace(); Command cmd = new Command("Remove-RDRemoteApp"); cmd.Parameters.Add("CollectionName", collectionName); cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); cmd.Parameters.Add("Alias", remoteApp.Alias); cmd.Parameters.Add("Force", true); runSpace.ExecuteShellCommand(cmd, false, PrimaryDomainController); } finally { runSpace.CloseRunspace(); } return result; }
public static ResultObject SetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp, List<string> users) { return SetApplicationUsersInternal(itemId, collectionId, remoteApp, users); }
public static List<string> GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp) { return GetApplicationUsersInternal(itemId, collectionId, remoteApp); }
public bool RemoveRemoteApplication(string collectionName, RemoteApplication remoteApp) { try { Log.WriteStart("'{0}' RemoveRemoteApplication", ProviderSettings.ProviderName); var result = RDSProvider.RemoveRemoteApplication(collectionName, remoteApp); Log.WriteEnd("'{0}' RemoveRemoteApplication", ProviderSettings.ProviderName); return result; } catch (Exception ex) { Log.WriteError(String.Format("'{0}' RemoveRemoteApplication", ProviderSettings.ProviderName), ex); throw; } }
protected void BindApps(RemoteApplication[] newApps, bool preserveExisting) { // get binded addresses List<RemoteApplication> apps = new List<RemoteApplication>(); if(preserveExisting) apps.AddRange(GetGridViewApps(SelectedState.All)); // add new servers if (newApps != null) { foreach (RemoteApplication newApp in newApps) { // check if exists bool exists = false; foreach (RemoteApplication app in apps) { if (app.DisplayName == newApp.DisplayName) { exists = true; break; } } if (exists) continue; apps.Add(newApp); } } gvApps.DataSource = apps; gvApps.DataBind(); }
public bool SetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users) { try { Log.WriteStart("'{0}' SetApplicationUsers", ProviderSettings.ProviderName); var result = RDSProvider.SetApplicationUsers(collectionName, remoteApp, users); Log.WriteEnd("'{0}' SetApplicationUsers", ProviderSettings.ProviderName); return result; } catch (Exception ex) { Log.WriteError(String.Format("'{0}' SetApplicationUsers", ProviderSettings.ProviderName), ex); throw; } }
protected List<RemoteApplication> GetGridViewApps(SelectedState state) { List<RemoteApplication> apps = new List<RemoteApplication>(); for (int i = 0; i < gvApps.Rows.Count; i++) { GridViewRow row = gvApps.Rows[i]; CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect"); if (chkSelect == null) continue; RemoteApplication app = new RemoteApplication(); app.Alias = (string)gvApps.DataKeys[i][0]; app.DisplayName = ((LinkButton)row.FindControl("lnkDisplayName")).Text; app.FilePath = ((HiddenField)row.FindControl("hfFilePath")).Value; app.RequiredCommandLine = ((HiddenField)row.FindControl("hfRequiredCommandLine")).Value; var users = ((HiddenField)row.FindControl("hfUsers")).Value; if (!string.IsNullOrEmpty(users)) { app.Users = new string[]{"New"}; } if (state == SelectedState.All || (state == SelectedState.Selected && chkSelect.Checked) || (state == SelectedState.Unselected && !chkSelect.Checked)) apps.Add(app); } return apps; }
/// <remarks/> public System.IAsyncResult BeginSetApplicationUsers(string collectionName, RemoteApplication remoteApp, string[] users, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("SetApplicationUsers", new object[] { collectionName, remoteApp, users}, callback, asyncState); }
public void SetApps(RemoteApplication[] apps) { BindApps(apps, false); }
/// <remarks/> public void SetApplicationUsersAsync(string collectionName, RemoteApplication remoteApp, string[] users, object userState) { if ((this.SetApplicationUsersOperationCompleted == null)) { this.SetApplicationUsersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetApplicationUsersOperationCompleted); } this.InvokeAsync("SetApplicationUsers", new object[] { collectionName, remoteApp, users}, this.SetApplicationUsersOperationCompleted, userState); }
public void SetApps(RemoteApplication[] apps, WebPortal.PageModule module) { Module = module; BindApps(apps, false); }
/// <remarks/> public System.IAsyncResult BeginAddRemoteApplications(string collectionName, RemoteApplication[] remoteApps, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("AddRemoteApplications", new object[] { collectionName, remoteApps}, callback, asyncState); }
public ResultObject RemoveRemoteApplicationFromCollection(int itemId, RdsCollection collection, RemoteApplication application) { return RemoteDesktopServicesController.RemoveRemoteApplicationFromCollection(itemId, collection, application); }
/// <remarks/> public void AddRemoteApplicationsAsync(string collectionName, RemoteApplication[] remoteApps, object userState) { if ((this.AddRemoteApplicationsOperationCompleted == null)) { this.AddRemoteApplicationsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddRemoteApplicationsOperationCompleted); } this.InvokeAsync("AddRemoteApplications", new object[] { collectionName, remoteApps}, this.AddRemoteApplicationsOperationCompleted, userState); }
public List<string> GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp) { return RemoteDesktopServicesController.GetApplicationUsers(itemId, collectionId, remoteApp); }
/// <remarks/> public System.IAsyncResult BeginRemoveRemoteApplication(string collectionName, RemoteApplication remoteApp, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("RemoveRemoteApplication", new object[] { collectionName, remoteApp}, callback, asyncState); }
public ResultObject SetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp, List<string> users) { return RemoteDesktopServicesController.SetApplicationUsers(itemId, collectionId, remoteApp, users); }
/// <remarks/> public void RemoveRemoteApplicationAsync(string collectionName, RemoteApplication remoteApp, object userState) { if ((this.RemoveRemoteApplicationOperationCompleted == null)) { this.RemoveRemoteApplicationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemoveRemoteApplicationOperationCompleted); } this.InvokeAsync("RemoveRemoteApplication", new object[] { collectionName, remoteApp}, this.RemoveRemoteApplicationOperationCompleted, userState); }
public static ResultObject AddRemoteApplicationToCollection(int itemId, RdsCollection collection, RemoteApplication application) { return AddRemoteApplicationToCollectionInternal(itemId, collection, application); }