hi,
we were having the script configured on one of the server and there exchange 2007 management tools were installed . The script is all about to delete the message which are older then 30 days from in INBOX folder only. The script was running fine when we were with exchange 2007 but since last month we migrated to exchange 2010 and things are not working as getting the error. please help .
-------------------------------
Export-Mailbox : MapiExceptionCallFailed: Unable to open message store. (hr=0x80040fff, ec=-2147217409)
Diagnostic context:
Lid: 18969 EcDoRpcExt2 called [length=179]
Lid: 27161 EcDoRpcExt2 returned [ec=0x0][length=44][latency=0]
Lid: 23226 --- ROP Parse Start ---
Lid: 27962 ROP: ropLogon [254]
Lid: 17082 ROP Error: 0x80040FFF
Lid: 26937
Lid: 21921 StoreEc: 0x80040FFF
Lid: 31418 --- ROP Parse Done ---
Lid: 22753
Lid: 21817 ROP Failure: 0x80040FFF
Lid: 26297
Lid: 16585 StoreEc: 0x80040FFF
Lid: 32441
Lid: 1706 StoreEc: 0x80040FFF
Lid: 24761
Lid: 20665 StoreEc: 0x80040FFF
Lid: 25785
Lid: 29881 StoreEc: 0x80040FFF
At E:\PowerShellScripts\Exchange\ERMS\ERMSMailboxManagement.ps1:14 char:22
+ $mbx | export-mailbox <<<< -includefolders '\Inbox' -enddate $endDate -delet
econtent:$true -confirm:$false
+ CategoryInfo : InvalidArgument: (0:Int32) [Export-Mailbox], MapiExceptionCallFailed
+ FullyQualifiedErrorId : F6EC03A5,Microsoft.Exchange.Management.Recipient
Tasks.ExportMailbox
Identity : abc.corp.local/System Management/Service Accounts/Non-Expiring Service Accounts/ERMS Bac kup
DistinguishedName : CN=ERMS Backup,OU=Non-Expiring Service Accou
nts,OU=Service Accounts,OU=System Management
,DC=abc,DC=corp,DC=local
DisplayName : ERMS Backup
Alias : ERMSbackupmail
LegacyExchangeDN : /o=abc Software Group, Inc./ou=Exchange Admi
nistrative Group (FYDIBOHF23SPDLT)/cn=Recipi
ents/cn=ERMSbackupmail
PrimarySmtpAddress : abcSupportSvcsBckDoNotReply@abc.com
SourceServer : MBX01.abc.corp.local
SourceDatabase : DB01
SourceGlobalCatalog : DC01
SourceDomainController :
TargetGlobalCatalog : DC01
TargetDomainController :
TargetMailbox :
TargetServer :
TargetDatabase :
MailboxSize : 0B
IsResourceMailbox :
SIDUsedInMatch :
SMTPProxies :
SourceManager :
SourceDirectReports :
SourcePublicDelegates :
SourcePublicDelegatesBL :
SourceAltRecipient :
SourceAltRecipientBL :
SourceDeliverAndRedirect :
MatchedTargetNTAccountDN :
IsMatchedNTAccountMailboxEnabled :
MatchedContactsDNList :
TargetNTAccountDNToCreate :
TargetManager :
TargetDirectReports :
TargetPublicDelegates :
TargetPublicDelegatesBL :
TargetAltRecipient :
TargetAltRecipientBL :
TargetDeliverAndRedirect :
Options : DeleteSourceContent
SourceForestCredential :
TargetForestCredential :
TargetFolder :
PSTFilePath :
RsgMailboxGuid :
RsgMailboxLegacyExchangeDN :
RsgMailboxDisplayName :
RsgDatabaseGuid :
StandardMessagesDeleted : 0
AssociatedMessagesDeleted : 0
DumpsterMessagesDeleted : 0
MoveType : DeleteOnly
MoveStage : Initialization
StartTime : 1/1/0001 12:00:00 AM
EndTime : 1/1/0001 12:00:00 AM
StatusCode : -2147467259
StatusMessage : MapiExceptionCallFailed: Unable to open mess
age store. (hr=0x80040fff, ec=-2147217409)
Diagnostic context:
Lid: 18969 EcDoRpcExt2 called [length=
179]
Lid: 27161 EcDoRpcExt2 returned [ec=0x
0][length=44][latency=0]
Lid: 23226 --- ROP Parse Start ---
Lid: 27962 ROP: ropLogon [254]
Lid: 17082 ROP Error: 0x80040FFF
Lid: 26937
Lid: 21921 StoreEc: 0x80040FFF
Lid: 31418 --- ROP Parse Done ---
Lid: 22753
Lid: 21817 ROP Failure: 0x80040FFF
Lid: 26297
Lid: 16585 StoreEc: 0x80040FFF
Lid: 32441
Lid: 1706 StoreEc: 0x80040FFF
Lid: 24761
Lid: 20665 StoreEc: 0x80040FFF
Lid: 25785
Lid: 29881 StoreEc: 0x80040FFF
ReportFile : C:\Program Files\Microsoft\Exchange Server\L
ogging\MigrationLogs\export-Mailbox20130315-
041752-4475622.xml
[PS] E:\PowerShellScripts\Exchange\ERMS>
---------------
------------------------------------------
below is Script
------------------------------------------
cls
$endDate = $todayDate.AddDays(-30)
$logdir = 'C:\Program Files\Microsoft\Exchange Server\Logging\MigrationLogs'
$mbx = get-mailbox 'abc\ERMSbackupmail'
#Get preprocessing mailbox size
$mbxpre = get-mailboxstatistics $mbx
$mbxps = [string]$mbxpre.TotalItemSize.Value
$mbxpi = [string]$mbxpre.ItemCount
$presize = $mbxpi + " items taking up " + $mbxps
#Mailbox processing
$mbx | export-mailbox -includefolders '\Inbox' -enddate $endDate -deletecontent:$true -confirm:$false
#Get postprocessing mailbox size
$mbxpost = get-mailboxstatistics $mbx
$mbxos = [string]$mbxpost.TotalItemSize.Value
$mbxoi = [string]$mbxpost.ItemCount
$postsize = $mbxoi + " items taking up " + $mbxos
# get a set of DateTime values from the pipeline
# filter out $nulls and produce the latest of them
# (c) Dmitry Sotnikov
function Measure-Latest {
BEGIN { $latest = $null }
PROCESS {
if (($_ -ne $null) -and (($latest -eq $null) -or ($_ -gt $latest))) {
$latest = $_
}
}
END { $latest }
}
#Find latest log file
$last = dir $logdir| foreach {$_.LastWriteTime} | Measure-Latest
$lastlog = (get-childitem $logdir *.log | where {$_.LastWriteTime -eq $last}).FullName
#Set SMTP Server and From email address
$SMTPserver = "cashub.abc.com"
$from = 'jugal@abc.com'
#Send logfile report via email
$to = 'one@abc.com'
$subject = "ERMS Backup Mailbox Management complete"
$body = "Do not reply to this message, as it was sent from an unmonitored mailbox." + “`n” + "Please see the attached log file for information about the action taken on this mailbox" + “`n” + “`n” + "Preprocessing Mailbox Stats: " + $presize + “`n” + "Postprocessing Mailbox Stats: " + $postsize
$mailer = new-object Net.Mail.SMTPclient($SMTPserver)
$msg = new-object Net.Mail.MailMessage($from, $to, $subject, $body)
$msg.attachments.add($lastlog)
$mailer.send($msg)
$msg.dispose()
#cleanup Log File Folder
$dellog = get-childitem $logdir | where {$_.LastWriteTime -lt $endDate}
if ($dellog -eq $null){break}
else {foreach ($log in $dellog){remove-item $log.FullName}}