Import-Module RemoteDesktop
$ConnBroker = (Get-RDConnectionBrokerHighAvailability -ConnectionBroker "dm3us050.dm3.wizmoworks.net").ActiveManagementServer
Set-RDSessionHost -SessionHost $server -ConnectionBroker $ConnBroke -NewConnectionAllowed $action
And the following c# code: public static void RunPowershellCommand(string scriptPath, string[,] variables = null)
{
RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration);
runspace.Open();
RunspaceInvoke scriptInvoker = new RunspaceInvoke(runspace);
//scriptInvoker.Invoke("Set-ExecutionPolicy Unrestricted");
Pipeline pipeline = runspace.CreatePipeline();
Command myCommand = new Command(scriptPath, false);
if (variables[0, 0] != null)
{
for (int i = 0; i < variables.GetLength(0); i++) //Add all the powershell variables we might need in the partner specific.
{
runspace.SessionStateProxy.SetVariable(variables[i, 0], variables[i, 1]);
}
}
pipeline.Commands.Add(myCommand);
Collection<PSObject> psObjects;
psObjects = pipeline.Invoke();
runspace.Close();
}
{"The term 'Get-RDConnectionBrokerHighAvailabil ity' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."}
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE