Forum Discussion

PraveenGururaj's avatar
Nov 16, 2020

Grant or Revoke Permissions on Shared Mailbox using SCORCH

Hello Guys,

 

I am trying to create a runbook wherein, we need to grant / revoke permissions in a shared mailbox using update mailbox.

 

When I grant access using (Grant Send On Behalf To) it's working as expected for a single user or set of users.

 

But, when I try to revoke access using (Grant Send On Behalf To) parameter, we get below errors based on the input.

 

When I leave the field empty, it revokes all the send on behalf of permission assigned on the shared mailbox.

 

When I use @{remove=username@domainname.extension} or @{remove="username@domainname.extension"} it throws below error.

 

Input string was not in a correct format.

Exception: FormatException
Target site: StringBuilder.AppendFormatHelper

Stack trace:
at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at SystemCenter.IntegrationPack.ExchangeAdmin.Domain.Core.ActivityLogger.Format(String message, Object[] arguments)
at SystemCenter.IntegrationPack.ExchangeAdmin.Domain.Core.ActivityLogger.LogError(String message, Object[] arguments)
at SystemCenter.IntegrationPack.ExchangeAdmin.Gateway.Core.ExchangeGatewayBase.CheckErrors(String commandText, ICollection`1 errors)
at SystemCenter.IntegrationPack.ExchangeAdmin.Gateway.Core.ExchangeGatewayBase.Execute(ExchangeRequest request)
at SystemCenter.IntegrationPack.ExchangeAdmin.Domain.Core.CommandHandlerBase.ExecuteRequest(ExchangeRequest request)
at SystemCenter.IntegrationPack.ExchangeAdmin.Domain.Core.UpdateMailboxHandler.ExecuteCommand(ActivityCommand command)
at SystemCenter.IntegrationPack.ExchangeAdmin.Domain.ExecuteContext.Execute(ActivityCommand command)
at SystemCenter.IntegrationPack.ExchangeAdmin.Activity.UpdateMailboxActivity.Execute(IActivityRequest request, ExecuteContext context)
at SystemCenter.IntegrationPack.ExchangeAdmin.Activity.ExchangeActivity.Execute(IActivityRequest request, IActivityResponse response)

 

When I use remove="username@domainname.extension" I get the below error.

 

Error(s) executing PowerShell command: System.Management.Automation.RemoteException: Couldn't find object "remove="username@domainname.extension"". Please make sure that it was spelled correctly or specify a different object.. Inner exception: . Command info: Command name: Set-Mailbox. Parameters: [Confirm:False],[Identity:iAutomate2@noc.intertecsys.com],[GrantSendOnBehalfTo:System.String[]]..


Exception: ExchangeGatewayException
Target site: ExchangeGatewayBase.CheckErrors

Stack trace:
at SystemCenter.IntegrationPack.ExchangeAdmin.Gateway.Core.ExchangeGatewayBase.CheckErrors(String commandText, ICollection`1 errors)
at SystemCenter.IntegrationPack.ExchangeAdmin.Gateway.Core.ExchangeGatewayBase.Execute(ExchangeRequest request)
at SystemCenter.IntegrationPack.ExchangeAdmin.Domain.Core.CommandHandlerBase.ExecuteRequest(ExchangeRequest request)
at SystemCenter.IntegrationPack.ExchangeAdmin.Domain.Core.UpdateMailboxHandler.ExecuteCommand(ActivityCommand command)
at SystemCenter.IntegrationPack.ExchangeAdmin.Domain.ExecuteContext.Execute(ActivityCommand command)
at SystemCenter.IntegrationPack.ExchangeAdmin.Activity.UpdateMailboxActivity.Execute(IActivityRequest request, ExecuteContext context)
at SystemCenter.IntegrationPack.ExchangeAdmin.Activity.ExchangeActivity.Execute(IActivityRequest request, IActivityResponse response)

 

Please do let me know if someone has executed such runbook requirements.

 

/Praveen

1 Reply

  • Klaus_Bilger's avatar
    Klaus_Bilger
    Copper Contributor

    PraveenGururaj

    Hello,

    without the code it is hard to see what you are doing.

     

    a) You are sure that the parameter is formatted as a string rather than an array or a string array

     

    b) for debug

    Add a looping function and then try to do the step yourself.

     

    Otherwise, use the script (part of the script) or protocol here.

     

Resources