After this update our support tool does not work any more. We run a exchange 2016 server, and the tool does a simple:
public void SearchExchangeMailBox()
{
PSCredential cred = new PSCredential(ADtoolUserName, ADtoolUserPassword);
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(new Uri("http://exch01/powershell?serializationLevel=Full"), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", cred);
connectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos;
using (Runspace runspace = RunspaceFactory.CreateRunspace(connectionInfo))
{
using (PowerShell powershell = PowerShell.Create())
{
powershell.AddScript("Get-Mailbox " + SelectedUsername + "*");
runspace.Open();
powershell.Runspace = runspace;
Collection<PSObject> results = powershell.Invoke();
foreach (ErrorRecord err in powershell.Streams.Error)
{
MessageBox.Show("Error");
MessageBox.Show(err.ToString());
}
But that now throws a error now. Nothing has change on our part.
System.Management.Automation.RemoteException: The syntax is not supported by this runspace. This can occur if the runspace is in no-language mode.
ved System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
ved System.Management.Automation.PowerShell.CoreInvokeRemoteHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
ved System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
ved System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
ved ADTool.MainForm.SearchExchangeMailBox()
ved ADTool.MainForm.searchBtn_Click(Object sender, EventArgs e)
ved System.Windows.Forms.Control.OnClick(EventArgs e)
ved System.Windows.Forms.Button.OnClick(EventArgs e)
ved System.Windows.Forms.Button.PerformClick()
ved ADTool.MainForm.searchBox_KeyUp(Object sender, KeyEventArgs e)
ved System.Windows.Forms.Control.OnKeyUp(KeyEventArgs e)
ved System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
ved System.Windows.Forms.Control.WmKeyChar(Message& m)
ved System.Windows.Forms.Control.WndProc(Message& m)
ved System.Windows.Forms.TextBox.WndProc(Message& m)
ved System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)