Problem with Exchange 2010 scripts after installing PowerShell 4.0

Hi

After installing new updates for MS Exchange 2010 and PowerShell 4.0 I've got problems with PS scripts using buil-in

exchange commands.

I wrote interactive script for searching e-mails. Here is a pice of code where I get error after installing PS v4.

....

$SearchContent=Read-Host "Write sentence to find"

Get-Mailbox | Search-Mailbox -SearchQuery "$SearchContent" -TargetMailbox "Discovery Search Mailbox" -TargetFolder "Inner box" -LogOnly -Loglevel Full | Out-Null

....

After installing PowerShell 4.0 I get that bug and report in TargetMailbox is not genereated.

The property keyword isn't supported.

At C:\Administration\Scripts\T-SearchMail.ps1:122 char:1
+ Get-Mailbox | Search-Mailbox -SearchQuery "$SearchContent" -TargetMailbox "Disco ...
+ ~~~~~~~~~~~~~~~~~   

+ CategoryInfo          : InvalidArgument: (:) [], ParserException
    + FullyQualifiedErrorId : 35E6C841

Using PowerShell 2.0 everything was ok.

How to solve this problem?

Tomasz

March 17th, 2014 3:14pm

Hi

Could you confirm that you have Exchange 2010 SP3 UR 5 installed?

Steve


ETA: Also make sure that you aren't searching for "RE:" or "FWD:"
Free Windows Admin Tool Kit Click here and download it now
March 17th, 2014 3:33pm

Hi Steve

Yes. I confirm: MS EXchange 2010 SP3 with RU5. Vesrion from "Progams and Features": 14.3.123.4.

1. YES, I use RE: as a part of search text. Why Can we use "RE:" or "FWD:"? Is It a bug?

2. I got also an error during running Exchange Manangement Shell after installing PS4:

Microsoft.PowerShell.Commands.ExportPSSessionCommand, Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 : Unable to find type [Microsoft.PowerShell.Commands.ExportPSSessionCommand, Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture
=neutral, PublicKeyToken=31bf3856ad364e35]: make sure that the assembly containing this type is loaded.
At C:\Users\Administrator\AppData\Roaming\Microsoft\Exchange\RemotePowerShell\ex1.corp.domain.com.psm1:16 char:217
+ $script:__psImplicitRemoting_versionOfScriptGenerator = [Microsoft.PowerShell.Commands.ExportPSSessionCommand, Microsoft.PowerShell.Commands.Utility, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35] <<<< ::VersionOfScriptGenerator
    + CategoryInfo          : InvalidOperation: (Microsoft.Power...1bf3856ad364e35:String) [], ParentContainsErrorRecordException

I use default (english) vesion of Exchange. I deleted this file "...ex1.corp.domain.com.psm1" and runed "Exchange Manangement Shell" again. It doesn't help.

I get a Warring and Error:

WARNING: Can't generate Export-Module for the current session using Import-PSSession.

Tomasz

March 18th, 2014 7:00am

Hi Yukio,

Sorry for the lack of knowledge on PowerShell. I suggest also creating a new thread on the PowerShell Forum so that we can get more professional suggestions.

For your convenience:

http://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverpowershell

 

However I also fond some information for your reference:

According to the error message you pasted, I found "make sure that the assembly containing this type is loaded". It seems that the PowerShell want to find "this type", however it is not loaded.

Found a similar thread for your reference:

"make sure that the assembly containing this type is loaded" disagnostic

http://social.technet.microsoft.com/Forums/windowsserver/en-US/6a1d421d-4cc0-4945-b372-c2abc4fe2e1a/make-sure-that-the-assembly-containing-this-type-is-loaded-disagnostic?forum=winserverpowershell

 

Hope it is helpful

 

Thanks

Mavis

Free Windows Admin Tool Kit Click here and download it now
April 2nd, 2014 10:28am

PS 4.0 is not supported.  See here: 

May 10th, 2014 3:04pm

But http://blogs.msdn.com/b/powershell/archive/2013/10/25/windows-management-framework-4-0-is-now-available.aspx is dated October 2013, while the current Windows Management Framework 4.0 System Requirements section states:
      Servers that are running the following applications can now run WMF 4.0. The versions listed are the minimum releases required to run WMF 4.0.
      • Microsoft Exchange Server 2013 Service Pack 1
      • Microsoft Exchange Server 2010 SP3 with Update Rollup 5
Since Update Rollup 5 For Exchange 2010 SP3 (KB2917508) was published Febrary 2014, shouldn't Exchange 2010 now be compatible with PowerShell 4.0?
Free Windows Admin Tool Kit Click here and download it now
February 12th, 2015 8:09pm

Yes, it is supported now.  As you can see, my previous post was from nearly a year ago.

Note, that while WMF 4 is supported on Windows 2008 R2, launching the Exchange Management Console will still run Powershell 2.0.  (you can try from your laptop to see what i mean: powershell.ex

March 27th, 2015 5:04pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics