Delegate management module updated to v1.3.5

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. (7.6 KiB)

8 thoughts on “Delegate management module updated to v1.3.5

  1. Hi Scott,

    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.

  2. 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.

  3. @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.

  4. 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.”

  5. I haven’t signed the module, so you need to update your execution policy to be unrestricted: Set-ExecutionPolicy unrestricted

  6. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *