xExchange - PowerShell Desired State Configuration Resource Kit

The xExchange module allows you to configure many different properties of Exchange 2013 servers, including individual server properties, databases and mount points, and Database Availability Groups.

5 Star
1,121 times
Add to favorites
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question

  • Remote PS Issue?
    7 Posts | Last post April 21, 2015
    • Setup a HTTPS pull server in a dev environment against 25 boxes with the module. Everything has been working except for one box. It finds the end point, mof and modules are able to be pulled no problem, however I am getting a SendConfigurationApply error with the following.
      ErrorMessage is PowerShell provider MSFT_xExchOutlookAnywhere  failed to execute Test-TargetResource functionality with error message: Failed to establish remote Powershell session to FQDN: servername.
      I have the same config deploy across all the boxes, all were checksummed to same directory and LCM configs for each node all started from the same directory. It is just this one node that is having an issue. Any thoughts?
    • Hi Julian,
      I have a couple things to try. First, if you open up the Exchange Management Shell on that server, does it connect fine, and also, does it connect to itself?
      Second, from any other server, can you create a Remote Powershell session to the problem server using New-PSSession? The syntax would be:
      $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://serverfqdn/PowerShell/ -Authentication Kerberos
      Import-PSSession $session
    • I have done both, EMS connects to itself on the local server and a remote server and I can create a Remote PSsession from other servers to connect to it. 
    • Interesting. Do other resources work against this server? Does it work any differently if you try in push mode versus pull mode?
      The function which establishes the remote powershell session is called GetRemoteExchangeSession, and lives in file Misc\xExchangeCommon.psm1. You may want to try copying that function (along with RemoveExistingRemoteSession) into a separate script, and manually call it. That may output some additional errors to the screen for you. If I was doing it myself, I would probably set a breakpoint at the top of the function, then step through one line at a time to see where it breaks.
      If none of that helps, the next thing to try is probably digging into the IIS and Powershell logs on that server, and see what sort of error codes are coming back.
      Lastly, are you using the latest version of xExchange (currently
    • Here's an easier way to debug this:
      -Edit xExchange\Misc\xExchangCommon.psm1 in Powershell ISE
      -Change directory to directory where xExchangeCommon.psm1 is located (if not done automatically)
      -Set a breakpoint (F9) on the first non-parameter line in the function: $Session = Get-PSSession...
      -Run the following commands
      	Import-Module xExchangeCommon.psm1
      	$creds = Get-Credential
      	GetRemoteExchangeSession -Credential $creds –CommandsToLoad "Get-OutlookAnywhere"
      -Once your breakpoint is hit, use F10 to step through one line at a time until you hit the error.
    • Hi Mike,
      I went through the troubleshooting above. I stepped through each line, and I did not get an error. 
      I was able to find these errors in the Powershell logs:
      Fully Qualified Error ID = Failed to establish remote Powershell session to FQDN: serverfqdn
              Severity = Warning
              Host Name = Default Host
              Host Version = 4.0
              Host ID = c714a5c8-9297-47fa-a4a0-ea6cba7fd485
              Engine Version = 4.0
              Runspace ID = 290855d6-f372-4120-91e8-6b297f7ec37b
              Pipeline ID = 5
              Command Name = 
              Command Type = 
              Script Name = C:\Program Files\WindowsPowerShell\Modules\xExchange\Misc\xExchangeCommon.psm1
              Command Path = 
              Sequence Number = 44
              User = Domain\SYSTEM
              Shell ID = Microsoft.PowerShell
      Am I correct in thinking that the Exchange credentials may not being decrypted/passed properly and it's defaulting to using the local system account credentials, which we know would not be able to connect to Exchange?
    • Credentials could very well be part of the problem, and you are correct in that Local System does not have permissions to create a Remote Powershell session to Exchange.
      I actually just encountered the exact same error message as you while trying to reproduce some other issue. It turned out that I had jumped straight from compiling the script to trying to push it via Start-DscConfiguration, and had forgotten to run Set-DscLocalConfigurationManager, which configures the certificate to use to decrypt credentials. Once I ran Set-DscLocalConfiguration manager, the error went away.