When I execute following PowerShell from C#
param(
[string] $identity,
[string] $domainController)
$perm = 'FullAccess'
Get-MailboxPermission -Identity $identity -User "NT AUTHORITY\SELF" | where { $_.AccessRights -notLike "*$perm*" } | Add-MailboxPermission -User "NT AUTHORITY\SELF" -AccessRights $perm -confirm:$False
Set-Mailbox -Identity:$identity -HiddenFromAddressListsEnabled:$true -DomainController:$domainController -confirm:$False
Set-Mailbox -Identity:$identity -AcceptMessagesOnlyFrom:$identity -DomainController:$domainController -confirm:$False
$mbxPermission = Get-MailboxPermission -Identity:$identity -user:'NT AUTHORITY\SELF'
if ($mbxPermission -ne $null)
{
Remove-MailboxPermission -Identity:$identity -user:'NT AUTHORITY\SELF' –AccessRights:'ReadPermission,FullAccess' -Confirm:$false -DomainController:$domainController
}
I get a strange exception:
MapiExceptionLowLevelInitializationFailure: Unable to load exrpc32.dll or one of its dependent DLLs (extrace.dll, exchmem.dll, msvcr80.dll, etc).
Even stranger is the fact that it seems to me that it was working fine few days ago (but I'm not sure maybe account configuration was different).
Technical enviroment is as follows: PowerShell is called from ASP.NET web service application which is deployed on Win2k3 32bit. Exchange server is a Win2k8 x64.
Andy ideas ? Is there something wrong with the PowerShell or it's rather server configuration ?
Thanks in advance for any help.
After I have restarted the application pool which is used for my web application everything works properly.
Before doing so I've isolated the problem. Any of the two PowerShell methods
and
were causing the exception.
I'm not sure how to track the root cause. It might be related to the situation described here, so that we have older version of Exchange server installed on this machine, but I'm not sure how to check that.
In Add/Remove Programs I see two positions: - Microsoft Exchange (17,65 MB) - Microsoft Exchange Server 2007 (545 MB)
I think the first one contains Exchange System Manager (v. 6.5.6944.0), the other contains Exchange Management Console (Exchange Server 2007 v. 08.01.0240.006)