locked
WARNING: The cmdlet extension agent with the index 5 has thrown an exception in OnComplete() RRS feed

  • Question

  • Setup:
    DC = Server 2012
    Exchange Roles Installed on DC: HT, CAS & MB
    $PSVersiontabel - 4.0
    Setup is for learning PowerShell


    Get-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 | Add-PSSnapin

    And if i run New-MailboxDatabase or New-Mailbox or Enable-Mailbox
    I get this warning on powershell console & even on powershell ise but not on exchange shell

    WARNING: The cmdlet extension agent with the index 5 has thrown an exception in OnComplete(). The exception is: System.TypeInitializationException: The type initializer for 'Microsoft.Exchange.Data.Storage.NativeStorePropertyDefinitionDictionary' threw an ex
    ception. ---> System.NotSupportedException: Not supported field(MailEnabled) type(Microsoft.Exchange.Data.Storage.PropertyTagPropertyDefinition).
       at Microsoft.Exchange.Data.Storage.NativeStorePropertyDefinitionDictionary.PropertyDefinitionSets.BuildWellKnownSets()
       at Microsoft.Exchange.Data.Storage.NativeStorePropertyDefinitionDictionary..cctor()
       --- End of inner exception stack trace ---
       at Microsoft.Exchange.Data.Storage.PropertyTagPropertyDefinition.TryFindEquivalentDefinition(PropTagKey key, Boolean isCustom, PropType type, TypeCheckingFlag typeCheckingFlag, PropertyTagPropertyDefinition& definition, Boolean& createNewDefinition)
       at Microsoft.Exchange.Data.Storage.PropertyTagPropertyDefinition.InternalCreate(String displayName, PropTag propertyTag, PropertyFlags flags, TypeCheckingFlag typeCheckingFlag, Boolean isCustom, PropertyDefinitionConstraint[] constraints)
       at Microsoft.Exchange.Data.Storage.PropertyTagCache.InternalPropertyDefinitionsFromPropTags(TypeCheckingFlag propertyTypeCheckingFlag, MapiProp mapiProp, StoreSession storeSession, PropTag[] propTags, Int32& resolvedPropertyCount)
       at Microsoft.Exchange.Data.Storage.RecipientTable.GetRecipientPropertyDefinitionsFromMapiTable(Boolean& originalColumnsChanged)
       at Microsoft.Exchange.Data.Storage.RecipientTable.BuildRecipientCollection(Action`2 recipientCollectionBuilder)
       at Microsoft.Exchange.Data.Storage.CoreRecipientCollection..ctor(ICoreItem coreItem)
       at Microsoft.Exchange.Data.Storage.CoreItem.Microsoft.Exchange.Data.Storage.ICoreItem.GetRecipientCollection(Boolean forceOpen)
       at Microsoft.Exchange.Data.Storage.CoreItem.GetRecipientCharsetDetectionData(StringBuilder stringBuilder, Boolean isComplete)
       at Microsoft.Exchange.Data.Storage.CoreItem.GetCharsetDetectionData(StringBuilder stringBuilder, CharsetDetectionDataFlags flags)
       at Microsoft.Exchange.Data.Storage.ItemCharsetDetector.BuildCodePageDetector(MemoryStream& cachedHtmlBody)
       at Microsoft.Exchange.Data.Storage.ItemCharsetDetector.DetectCpidWithOptions(Charset userCharset, MemoryStream& cachedHtmlBody)
       at Microsoft.Exchange.Data.Storage.ItemCharsetDetector.SetCachedBodyDataAndDetectCharset(Char[] cachedBodyData, Charset userCharset, BodyCharsetFlags charsetFlags)
       at Microsoft.Exchange.Data.Storage.BodyCharsetDetectionStream.CalculateCharset()
       at Microsoft.Exchange.Data.Storage.BodyCharsetDetectionStream.OnBufferFull()
       at Microsoft.Exchange.Data.Storage.BodyCharsetDetectionStream.CloseDetectorConversionStream()
       at Microsoft.Exchange.Data.Storage.BodyCharsetDetectionStream.Flush()
       at Microsoft.Exchange.Data.TextConverters.ConverterEncodingOutput.Flush()
       at Microsoft.Exchange.Data.TextConverters.Internal.Text.TextCodePageConverter.Run()
       at Microsoft.Exchange.Data.TextConverters.Internal.Text.TextCodePageConverter.Flush()
       at Microsoft.Exchange.Data.TextConverters.ConverterWriter.Flush()
       at Microsoft.Exchange.Data.TextConverters.ConverterWriter.Dispose(Boolean disposing)
       at System.IO.TextWriter.Close()
       at Microsoft.Exchange.Data.Storage.BodyTextWriter.<CloseWriter>b__11()
       at Microsoft.Exchange.Data.Storage.ConvertUtils.CallCts(Trace tracer, String methodName, LocalizedString exceptionString, CtsCall ctsCall)
       at Microsoft.Exchange.Data.Storage.BodyTextWriter.CloseWriter()
       at Microsoft.Exchange.Data.Storage.BodyTextWriter.Dispose(Boolean disposing)
       at System.IO.TextWriter.Dispose()
       at Microsoft.Exchange.ProvisioningAgent.MailboxLoggerFactory.XsoMailer.Log(AdminLogMessageData data, LogMessageDelegate logMessage)
       at Microsoft.Exchange.ProvisioningAgent.AdminLogProvisioningHandler.OnComplete(Boolean succeeded, Exception e)
       at Microsoft.Exchange.Provisioning.ProvisioningLayer.OnComplete(Task task, Boolean succeeded, Exception exception)WARNING: The cmdlet extension agent with the index 5 has thrown an exception in OnComplete(). The exception is: System.TypeInitializationException: The type initializer for 'Microsoft.Exchange.Data.Storage.NativeStorePropertyDefinitionDictionary' threw an ex
    ception. ---> System.NotSupportedException: Not supported field(MailEnabled) type(Microsoft.Exchange.Data.Storage.PropertyTagPropertyDefinition).
       at Microsoft.Exchange.Data.Storage.NativeStorePropertyDefinitionDictionary.PropertyDefinitionSets.BuildWellKnownSets()
       at Microsoft.Exchange.Data.Storage.NativeStorePropertyDefinitionDictionary..cctor()
       --- End of inner exception stack trace ---
       at Microsoft.Exchange.Data.Storage.PropertyTagPropertyDefinition.TryFindEquivalentDefinition(PropTagKey key, Boolean isCustom, PropType type, TypeCheckingFlag typeCheckingFlag, PropertyTagPropertyDefinition& definition, Boolean& createNewDefinition)
       at Microsoft.Exchange.Data.Storage.PropertyTagPropertyDefinition.InternalCreate(String displayName, PropTag propertyTag, PropertyFlags flags, TypeCheckingFlag typeCheckingFlag, Boolean isCustom, PropertyDefinitionConstraint[] constraints)
       at Microsoft.Exchange.Data.Storage.PropertyTagCache.InternalPropertyDefinitionsFromPropTags(TypeCheckingFlag propertyTypeCheckingFlag, MapiProp mapiProp, StoreSession storeSession, PropTag[] propTags, Int32& resolvedPropertyCount)
       at Microsoft.Exchange.Data.Storage.RecipientTable.GetRecipientPropertyDefinitionsFromMapiTable(Boolean& originalColumnsChanged)
       at Microsoft.Exchange.Data.Storage.RecipientTable.BuildRecipientCollection(Action`2 recipientCollectionBuilder)
       at Microsoft.Exchange.Data.Storage.CoreRecipientCollection..ctor(ICoreItem coreItem)
       at Microsoft.Exchange.Data.Storage.CoreItem.Microsoft.Exchange.Data.Storage.ICoreItem.GetRecipientCollection(Boolean forceOpen)
       at Microsoft.Exchange.Data.Storage.CoreItem.GetRecipientCharsetDetectionData(StringBuilder stringBuilder, Boolean isComplete)
       at Microsoft.Exchange.Data.Storage.CoreItem.GetCharsetDetectionData(StringBuilder stringBuilder, CharsetDetectionDataFlags flags)
       at Microsoft.Exchange.Data.Storage.ItemCharsetDetector.BuildCodePageDetector(MemoryStream& cachedHtmlBody)
       at Microsoft.Exchange.Data.Storage.ItemCharsetDetector.DetectCpidWithOptions(Charset userCharset, MemoryStream& cachedHtmlBody)
       at Microsoft.Exchange.Data.Storage.ItemCharsetDetector.SetCachedBodyDataAndDetectCharset(Char[] cachedBodyData, Charset userCharset, BodyCharsetFlags charsetFlags)
       at Microsoft.Exchange.Data.Storage.BodyCharsetDetectionStream.CalculateCharset()
       at Microsoft.Exchange.Data.Storage.BodyCharsetDetectionStream.OnBufferFull()
       at Microsoft.Exchange.Data.Storage.BodyCharsetDetectionStream.CloseDetectorConversionStream()
       at Microsoft.Exchange.Data.Storage.BodyCharsetDetectionStream.Flush()
       at Microsoft.Exchange.Data.TextConverters.ConverterEncodingOutput.Flush()
       at Microsoft.Exchange.Data.TextConverters.Internal.Text.TextCodePageConverter.Run()
       at Microsoft.Exchange.Data.TextConverters.Internal.Text.TextCodePageConverter.Flush()
       at Microsoft.Exchange.Data.TextConverters.ConverterWriter.Flush()
       at Microsoft.Exchange.Data.TextConverters.ConverterWriter.Dispose(Boolean disposing)
       at System.IO.TextWriter.Close()
       at Microsoft.Exchange.Data.Storage.BodyTextWriter.<CloseWriter>b__11()
       at Microsoft.Exchange.Data.Storage.ConvertUtils.CallCts(Trace tracer, String methodName, LocalizedString exceptionString, CtsCall ctsCall)
       at Microsoft.Exchange.Data.Storage.BodyTextWriter.CloseWriter()
       at Microsoft.Exchange.Data.Storage.BodyTextWriter.Dispose(Boolean disposing)
       at System.IO.TextWriter.Dispose()
       at Microsoft.Exchange.ProvisioningAgent.MailboxLoggerFactory.XsoMailer.Log(AdminLogMessageData data, LogMessageDelegate logMessage)
       at Microsoft.Exchange.ProvisioningAgent.AdminLogProvisioningHandler.OnComplete(Boolean succeeded, Exception e)
       at Microsoft.Exchange.Provisioning.ProvisioningLayer.OnComplete(Task task, Boolean succeeded, Exception exception)
    Sunday, November 13, 2016 1:50 PM

Answers

  • Actually the supportability matrix suggests that Exchange 2010SP1 is supported on 2012R2.  Only SP3 is not supported but may work.

    See: https://technet.microsoft.com/library/ff728623(v=exchg.150).aspx

    Unfortunately PS3 would not work with this supported version of Exchange but it would work with PS2 feature enabled.

    To get more detailed information you will need to post in the Exchange forum.


    \_(ツ)_/


    • Edited by jrv Sunday, November 13, 2016 5:12 PM
    • Marked as answer by ex2010sp3 Wednesday, November 16, 2016 3:19 PM
    Sunday, November 13, 2016 5:11 PM

All replies

  • I googled this error

    Disable Scripting Agent but it is already disabled. I even re-installed everything from scratch but it still the same warning.

    PS C:\> Get-CmdletExtensionAgent "Scripting Agent" | ft Name,enabled -AutoSize

    Name            Enabled
    ----            -------
    Scripting Agent   False

    Sunday, November 13, 2016 1:53 PM
  • Hi,

    try adding

    start-sleep -s 30

    after the first Enable-Mailbox command

    good luck.

    Sunday, November 13, 2016 2:00 PM
  • Thanks for your reply

    I tried this

    Get-ADUser -Filter {name -like 'user*'} | foreach {
             Enable-Mailbox -Identity $_.name
             Start-Sleep -Seconds 30
    }

    Got the same warning for each user. Get-ADUser Cmdlet output was 10 Users

    Sunday, November 13, 2016 2:09 PM
  • what Update rollup are you on?

    try also run this cmdlet

    Set-AdminAuditLogConfig -AdminAuditLogEnabled $False

    Sunday, November 13, 2016 2:16 PM
  • Exchange 2010 SP3

    Run Command from Exchange Shell (Admin Mode)

    PS C:\> Set-AdminAuditLogConfig -AdminAuditLogEnabled $False
    WARNING: The command completed successfully but no settings of 'Admin Audit Log Settings' have been modified.

    PS C:\> Get-ExchangeServer | ft -AutoSize name,ed*,ad*,ser*
    
    Name    Edition                         AdminDisplayVersion              ServerRole
    ----        -------                          -------------------                   ----------
    DC         StandardEvaluation     Version 14.3 (Build 123.4)       Mailbox, ClientAccess, HubTransport

    Downloaded Trial Version yesterday from here

    https://www.microsoft.com/en-us/download/details.aspx?id=36768

    • Edited by ex2010sp3 Sunday, November 13, 2016 2:35 PM
    Sunday, November 13, 2016 2:26 PM
  • okay.

    just means its already set to false.

    try use this..

    <Feature Name="Mailboxes" Cmdlets="New-Mailbox,Enable-Mailbox">

    <ApiCall Name="OnComplete">
    if($succeeded) {
    if ($provisioningHandler.TaskName -eq "New-Mailbox") {

    $Name = $provisioningHandler.UserSpecifiedParameters["Name"]

    Set-Mailbox $Name -RetentionPolicy "Deleted Items 30 Days"

    Set-CASMailbox $Name -ActiveSyncMailboxPolicy "Default"

    Set-MailboxFolderPermission -Identity $Name':\calendar' -User "Default" -AccessRights "Reviewer"
    }
    elseif ($provisioningHandler.TaskName -eq "Enable-Mailbox") {

    start-sleep -s 30

    $Alias = $provisioningHandler.UserSpecifiedParameters["Alias"]

    Set-Mailbox $Alias -RetentionPolicy "Deleted Items 30 Days"

    Set-CASMailbox $Alias -ActiveSyncMailboxPolicy "Default"

    Set-MailboxFolderPermission -Identity $Alias':\calendar' -User "Default" -AccessRights "Reviewer"
    }
    }

    </ApiCall>

    </Feature>

    Sunday, November 13, 2016 2:44 PM
  • This won't run in powershell

    <Feature Name="Mailboxes" Cmdlets="New-Mailbox,Enable-Mailbox">
    <ApiCall Name="OnComplete">

    Whats is $succeeded & $provisioningHandler. Its not defined anywhere



    • Edited by ex2010sp3 Sunday, November 13, 2016 3:37 PM
    Sunday, November 13, 2016 2:59 PM
  • its XML you use via scripting agent.

    Sunday, November 13, 2016 3:48 PM
  • - Your Exchange box is called DC .. is sure hope it's not a domain controller.

    - OS is 2012, that comes with PSv3. You mention PSv4 - you installed that on top of the OS before or after installing Exchange 2010 SP3 RUx?

    - Exchange 2010 runs on PSv2 level. Instead of loading the snapin (unsupported anyway), try properly connecting to the Exchange box through shortcut or via New-PSSession/Import-PSSession, see https://technet.microsoft.com/en-us/library/dd335083(v=exchg.160).aspx



    Michel de Rooij
    Office Server and Services MVP
    B:http://eightwone.com | T:twitter.com/mderooij
    This posting is provided "AS-IS" without warranties
    PS: Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.


    Sunday, November 13, 2016 4:29 PM
  • To use PowerShell with Exchange 2010 it is necessary to have all updates installed on Exchange.

    Do not try to load the snap-in.  If Exchange is installed correctly with PowerShell support then ther eis a menu item for the "Exchange Shell"  Use this on the server or remotely use the Exchange connector.

    Follow these instructions: https://technet.microsoft.com/en-us/library/dd297932(v=exchg.141).aspx


    \_(ツ)_/

    • Proposed as answer by jrv Sunday, November 13, 2016 4:50 PM
    Sunday, November 13, 2016 4:50 PM
  • Exchange is installed on Domain Controller just for learning. I thought i could practice using one Server.

    Sorry OS is 2012 R2. Didn't upgrade PS

    Didn't know Adding snapin is unsupported. Got the warning error even when using PSSession.

    Thanks for the info.

    I will try a new a new setup.

    2012 R2 Domain Controller

    Exchange Server on a Member Server (2012 R2)

    Sunday, November 13, 2016 4:52 PM
  • Installing of DC is not an issue but it is not recommended fro security reasons.

    To access Exchange without patches you need to only use PS V2.  Read the release notes for V3.  With all current updates V3 will work.  Exchange will fail if V3 is installed and patches are not present even if you try to use V2.  V2 support is optional on 2012 and the feature must be enabled for Exchange 2010/PowerShell to work.

    Exchange 2010 is not supported on WS2012R2 but can be installed if you start with Ex2010Sp3 installer. If you install tyhe wrong version you may have to re-install WS2012R@ before trying to install ExSp3.

    See: https://blogs.technet.microsoft.com/rmilne/2013/09/17/exchange-support-for-windows-server-2012-r2/


    \_(ツ)_/

    Sunday, November 13, 2016 5:04 PM
  • Actually the supportability matrix suggests that Exchange 2010SP1 is supported on 2012R2.  Only SP3 is not supported but may work.

    See: https://technet.microsoft.com/library/ff728623(v=exchg.150).aspx

    Unfortunately PS3 would not work with this supported version of Exchange but it would work with PS2 feature enabled.

    To get more detailed information you will need to post in the Exchange forum.


    \_(ツ)_/


    • Edited by jrv Sunday, November 13, 2016 5:12 PM
    • Marked as answer by ex2010sp3 Wednesday, November 16, 2016 3:19 PM
    Sunday, November 13, 2016 5:11 PM