Articles in the "Mailbox Delegate Management" series
- Super duper delegate retrieval script
- PowerShell module for managing Exchange mailbox delegates
- Small update to delegate management module
- Delegate management module updated to v1.3.5 [This article]
- Delegate management module updated to support Exchange Online
- Delegate management module updated to v1.4.5
- Delegate management module updated to 1.4.6
- Delegate management module updated to v1.5.0
- Delegate management module updated
The module has been updated so that the function that retrieves Send As permission will work in the Exchange Management Shell. I use implicit remoting rather than EMS, so I didn’t realize that the filter for Send-As needs to be different (though I don’t know why, which is aggravating). I previously also changed the default access method to use FMA instead of impersonation. If you want to use impersonation, uncomment line 96. The inline code and the download have been updated.
DelegateManagement.zip (9.2 KiB)
I’m having problems running this module (as well as the delegate retrieval script) when attempting to just query for the list of delegates. A similar error message is received for both, except on new users with no delegates at all. I’m using EWS API 1.2.1, Exchange 2010. What do you think?
My initial thought is that the ‘specified object’ referred to in the error is an old SID with a since-deleted user account, but I don’t know how to modify the script to bypass this translation.
Exception calling “GetDelegates” with “3” argument(s): “The specified object was not found in the store.”
At C:\users\itadmin\Desktop\DelegateManagement.psm1:679 char:53
+ $currentDelegates = $exchangeService.GetDelegates <<<< ($EWSMailbox,$true)
+ CategoryInfo : NotSpecified: (:) , MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
John Smith has no delegates.
Thank you for the post. Could you please tell me how to use this script in Powershell?
Do you have instructions on how to install the DelegateManagement module.
Save the .psm1 anywhere and then in PowerShell run Import-Module
. If you want to be able to use just the name of the module, e.g., ipmo delegatemanagement, then you need to save the file in your PowerShell profile’s Modules directory, inside a directory with the same name as the file, e.g., C:\Users\ \Documents\WindowsPowerShell\Modules\DelegateManagement\DelegateManagement.psm1.
@Scott – This is excellent, thank you very much for putting it together. I really need to learn more about EWS.
v1.3.5 worked but it did generate the exception error mentioned above at lines 679 and 135. I ran the cmdlets on a host with Exchange tools and EWS Managed API 2.0 x64. I copied the module to the System’s module folder rather than dealing with a user folder. The error may be due to some difference between the accounts–permissions are the same: I granted myself explicit access to the test mailboxes.
When I try to import the module I run an “Import-Module c:\DelegateManagement.psm1” and I get a “…module cannot load, the file … is not digitally signed.”
I haven’t signed the module, so you need to update your execution policy to be unrestricted: Set-ExecutionPolicy unrestricted
I’m having trouble running this module from a scheduled task. It works fine when running it interactively using the same credentials.
Is there something I need to do to run this non-interactively? It isn’t an issue with the configuration of the task per se. I have several scheduled tasks running powershell scripts. just fine on the same Windows server 2008 R2 server.