Exchange Server 2013 Remote Powershell Error: There were errors in loading the format data file:


Error Message:

Import-Module : There were errors in loading the format data file:Microsoft.PowerShell, , C:\Users\Administrator\AppData\Local\Temp\2\tmp_ec05e87c-8774-40e6-9674-7f15e4ed7dcd_ovvfebwx.3y\tmp_ec05e87c-8774-40e6-9674-7f15e4ed7dcd_ovvfebwx.x3y.format.ps1xml : File skipped because of the following validaton exception: File C:\Users\Administrator\AppData\Local\Temp\2\tmp_ec05e87c-8774-40e6-9674-7f15e4ed7dcd_ovvfebwx.x3y\tp_ec05e87c-8774-40e6-9674-7f15e4ed7dcd_ovvfebwx.x3y.format.ps1xml cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details..Microsoft.PowerShell, , :\Users\Administrator\AppData\Local\Temp\2\tmp_bef0d7f7-76c8-4e57-899b-53b3579ecc33_ofufklmr.h4\tmp_bef0d7f7-76c8-4e57-899b-53b3579ecc33_ofufklmr.qh4.format.ps1xml : File skipped because of the following validaton exception: File C:\Users\Administrator\AppData\Local\Temp\2\tmp_bef0d7f7-76c8-4e57-899b-53b3579ecc33_ofufklmr.qh4\tp_bef0d7f7-76c8-4e57-899b-53b3579ecc33_ofufklmr.qh4.format.ps1xml cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details..

At line:3 char:30

+                 Import-Module <<<< -Name $name -Alias * -Function * -Prefix $prefix -DisableNameChecking:$disableNa

eChecking -PassThru -ArgumentList @($session)

+ CategoryInfo         : InvalidOperation: (:) [Import-Module], RuntimeException

+ FullyQualifiedErrorId : FormatXmlUpateException,Microsoft.PowerShell.Commands.ImportModuleCommand

Set-ExecutionPolicy 1

Solution:

Set the execution policy as unrestricted as follow

PS C:\Users\Administrator> Get-ExecutionPolicy

Restricted

PS C:\Users\Administrator> Set-ExecutionPolicy Unrestricted

Execution Policy Change

The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution policy?

[Y] Yes [N] No [S] Suspend [?] Help (default is “Y”): Y

Set-ExecutionPolicy 2

PS C:\Users\Administrator> $Credentials = Get-Credential

cmdlet Get-Credential at command pipeline position 1

Supply values for the following parameters:

Credential

PS C:\Users\Administrator> $ExSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri `http://ex2013.lab.com/powershell/?SerializationLevel=Full’ -Credential $Credentials -Authentication Kerberos

Set-ExecutionPolicy 3

PS C:\Users\Administrator> Import-PSSession $ExSession

WARNING: Proxy creation has been skipped for the following command: ‘TabExpansion’, because it would shadow an existing local command. Use the AllowClobber parameter if you want to shadow existing local commands.

WARNING: Some imported command names include unapproved verbs which might make them less discoverable. Use the Verbose parameter for more detail or type Get-Verb to see the list of approved verbs.

ModuleType Name                     ExportedCommands

———- —-                     —————-

Script     tmp_cb1641b8-30dd-4ebe… {Get-IRMConfiguration, New-MailUser,

Get-PublicFolderMigrationRequestSta…

To check and remove the session

 PS C:\Users\Administrator> Remove-PSSession $ExSession

Set-ExecutionPolicy 4

I also found the error when you try to connect the powershell on which your system is not part of the domain. Make sure you system is part of the domain

New-PSSession : [ex2013.lab.com] Connecting to remote server ex2013.lab.com failed with the following error message : WinRM cannot process the

request. The following error with errorcode 0x80090311 occurred while using Kerberos authentication: There are currently no logon servers

available to service the logon request.

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. For more information, see the

about_Remote_Troubleshooting Help topic.

At line:1 char:14

+ $ExSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri …

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo         : OpenError: (System.Manageme….RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException

+ FullyQualifiedErrorId : AuthenticationFailed,PSSessionOpenFailed

 

Advertisements

About Raji Subramanian

Nothing great to say about me...Just want to share my knowledge for others that will be useful at any moment of time when they stuck in critical issue....
This entry was posted in Exchange Server 2013, Powershell Command and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s