none
Problems with Remote Powershell RRS feed

  • Question

  • Hello,

    I have Problem to get a Remote Powershell call to work. I need to add Accounts as Members to GrantSendOnBehaltTo

    If I use

    powerShell.AddCommand("Set-Mailbox");

          powerShell.AddParameter("Identity", "SHAREDMAILBOX_1");

          powerShell.AddParameter("GrantSendOnBehalfTo", "@{Add='JOHNDOE'}");

    I get the Error "Couldn't find object" at the Execution.

     If I use

    powerShell.AddScript("Set-Mailbox -Identity SHAREDMAILBOX_1 -GrantSendOnBehalfTo @{Add='JOHNDOE'}");

    It works as accepted.

    WHY ???

    Thanks Marco

    Friday, February 14, 2014 9:59 AM

All replies

  • when invoking the command, you need to pass typed objects.
    As said in help for GrantSendOnBehalfTo parameter a Microsoft.Exchange.Data.MultiValuedProperty.

    I think you need to pass an array of string or a Microsoft.Exchange.Data.MultiValuedProperty instance.

    powerShell.AddParameter("GrantSendOnBehalfTo", new string[] {"JOHNDOE"});

    Regards,


    Désiré GOVIN Refresh IT Solutions

    Friday, February 14, 2014 10:53 AM
  • It doesn't work.

    By Powershell syntax I need only to use the value as string

    This code for add

    powerShell.AddParameter("GrantSendOnBehalfTo","@{Add='JOHNDOE'}");

    and this code for remove

    powerShell.AddParameter("GrantSendOnBehalfTo","@{Remove='JOHNDOE'}");

    Regards.

    Tuesday, February 18, 2014 9:17 AM