GSX Blog

Troubleshooting unknown PowerShell error messages

Posted by Olivier Raynaut on Tue, Mar 19, 2013

PowerShellDealing with PowerShell remotely can cause many headaches when it comes to troubleshooting issues. Therefore, I have gathered the "best" PowerShell errors I have encountered so far in which the error messages returned are not always very meaningful...

1 - Memory issue

When initializing or executing cmdlets on a remote PowerShell session, you receive one of the following errors:

Exception of type 'System.OutOfMemoryException' was thrown.      
+ CategoryInfo : OpenError: (SERVENAME:String) [], RemoteException      
     + FullyQualifiedErrorId : PSSessionStateBroken

 

[SEVERNAME] Processing data from remote server SERVERNAME failed with the following error message: The WSMan provider host process did not return a proper response.  A provider in the host process may have behaved improperly. For more information, see the about_Remote_Troubleshooting Help topic. 
     + CategoryInfo          : OpenError: (SERVERNAME:String) [], PSRemotingTransportException
     + FullyQualifiedErrorId : 1726,PSSessionStateBroken

 

New-PSSession : [SEVERNAME] Remoting data is missing TargetObject property.
 +   $s = New-PSSession -computername $computername -Credential:$cred -Authenticati ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException   + FullyQualifiedErrorId : PSSessionOpenFailed

As the first error message specifies, an overflow of memory in the remote session has occurred. Open a PowerShell prompt on the remote server and display the configuration of winrs using:

winrm get winrm/config/winrs

Check the "MaxMemoryPerShellMB" value. It is set by default to 150 MB on Windows Server 2008 R2 and Windows 7. This is something that Microsoft changed in Windows Server 2012 and Windows 8 to 1024 MB. 

In order to resolve this issue, you need to increase the value to at least 512 MB with the following command: 

winrm set winrm/config/winrs `@`{MaxMemoryPerShellMB=`"512`"`}

 

2 - SPNs Issues

While enabling the remote PowerShell using "winrm quickconfig" or enabling CredSSP using "Enable-WSManCredSSP", you might encounter the following error:

WSManFault Message = WinRM cannot process the request. The following error occured while using Negotiate authentication: An unknown security error occurred. Possible causes are:
-The user name or password specified are invalid.
-Kerberos is used when no authentication method and no user name are specified.
-Kerberos accepts domain user names, but not local user names.
-The Service Principal Name (SPN) for the remote computer name and port does not exist.
-The client and remote computers are in different domains and there is no trust between the two domains. After checking for the above issues, try the following:
-Check the Event Viewer for events related to authentication.
-Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.

Note that computers in the TrustedHosts list might not be authenticated.
-For more information about WinRM configuration, run the following command: winrm help config.
Error number: -2144108387 0x8033809D An unknown security error occurred.

This can come from an existing SPN for HTTP. So check the following in a command prompt:

setspn.exe -L COMPUTERNAME

Eventually you might have to query it directly using:

setspn.exe -Q http/COMPUTERNAME

If it does exist, then you have to remove it:

setspn.exe -D http/COMPUTERNAME

Then, proceed to whatever you were configuring. And finally, re-enable your SPN:

setspn.exe -A http/COMPUTERNAME

  

3 - Network Interface in Public domains

[SEVERNAME] Processing data from remote server SERVERNAME failed with the following error message: The WSMan provider host process did not return a proper response.  A provider in the host process may have behaved improperly. For more information, see the about_Remote_Troubleshooting Help topic. 
     + CategoryInfo          : OpenError: (SERVERNAME:String) [], PSRemotingTransportException
     + FullyQualifiedErrorId : 1726,PSSessionStateBroken

This common PowerShell error can also occur when one of the network interfaces of the local computer is set to Public Domain, which is very frequent when configuring your local virtual machine (e.g. "VirtualBox Host-Only Network adapter"). In this case, you will have to disable the Network Adapter that is in the Public domain during the configuration.

I am sure that we will discover new, amazing messages to come from PowerShell, especially with remote use.

Here is a great resource if you would like more information on PowerShell: "White Paper PowerShell for Dummies: How to keep track of your Exchange?". Also, if you are interested in enhancing your PowerShell experience by automatically loading scripts, we think you will find this article very useful.

Did we not cover an issue you're having? Check out how we can make your wish for a solution come true

Do not hesitate to let us know your "favorite" error messages in the comments below and we will do our best to help you troubleshoot them.

CTA-bas--de-blog-1.png

Tags: Exchange 2010, Exchange reporting, cmdlets, Exchange monitoring, Powershell, Best practices