Set Exchange Online mailbox to shared

Guys. 

I have a VA when set to true should trigger a workflow and convert the Exchange Online mail to a shared mailbox. The standard MS command is set-mailbox but not 100% sure i can use this within the Quest product. Not sure what the Quest equivalent  is. 

function onPostModify($Request)
{
set-mailbox $Request.GUID -type shared

}

Cheers

Craig 

Parents
  • You could use this code in a Change Workflow but you need to include a "O365 script execution configuration" Activity in that workflow to establish the session with Exchange Online.

    Rather than a Change Workflow though, I would recommend a scheduled Automation Workflow and process these requests in "batches" from a "queue" Managed Unit similar to the way you are queuing objects for deprovisioning.

  • PS You will still need the "O365 script execution configuration" activity to setup your PoSh session with the M365 tenant.

  • Thanks mate. I have added the O365 script execution configuration to the workflow. I have it configured as you said based on managed unit.  Will give this a go and see it works now, 

  • Below is the Powershell script being run

    function onPostModify($Request)
    {
    set-mailbox -Identity $Request.GUID -type shared

    }

    When I look at the debug on the script I see the below. The Exchange mailbox is never converted to shared. 

    If i connect to Exchange online with the same account the ARS Azure configuration is running under and issue the standard then the mailbox is converted. 

    set-mailbox -Identity firstname.lastname@domain.com -type shared

    WARNING: The names of some imported commands from the module 'ActiveRolesManagementShell' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
    <-------------------------------------------------------------->
    <---- New Debug Session 7/23/2021 9:56:30 AM ---->
    <-------------------------------------------------------------->
    <------------------- $Request XML ------------------------>
    <ModifyRequest xmlns:xsd="">www.w3.org/.../XMLSchema" xmlns:xsi="">www.w3.org/.../XMLSchema-instance" dn="CN=Test02\, Deprov,OU=Leavers(De-Provision),OU=Starters-Leavers,OU=_Administration,OU=Hybrid,DC=test,DC=net" xmlns="urn:schemas-quest-com:ActiveRolesServer">
    <Attributes>
    <Attribute name="Azure-Exchange-Shared-Mailbox" operation="Replace" type="Boolean">
    <Values>
    <Value>true</Value>
    </Values>
    </Attribute>
    <Attribute name="Stage1-Azure-Deprovision" operation="Replace" type="Boolean">
    <Values>
    <Value>true</Value>
    </Values>
    </Attribute>
    </Attributes>
    <Controls>
    <Control id="13">
    <Values>
    <Value>TESTDC.TEST.net</Value>
    </Values>
    </Control>
    <Control id="AllowApproval">
    <Values>
    <Value>Check</Value>
    </Values>
    </Control>
    </Controls>
    </ModifyRequest>
    <------------------- $Request XML ------------------------>
    Call: Set-PSDebug -trace 2
    DEBUG: 1+ >>>> s53bc1e8d-9f82-4691-b39d-8bdad4f9027f 'onPostModify' $Request
    DEBUG: ! CALL function '<ScriptBlock>'
    DEBUG: 8+ >>>> &$args[0] $args[1]

    DEBUG: ! CALL function '<ScriptBlock>'
    DEBUG: 2+ >>>> {

    DEBUG: ! CALL function 'onPostModify'
    DEBUG: 3+ >>>> set-mailbox $Request.GUID -type shared

    <------------------- $Request XML ------------------------>
    <ModifyRequest xmlns:xsd="">www.w3.org/.../XMLSchema" xmlns:xsi="">www.w3.org/.../XMLSchema-instance" dn="CN=Test02\, Deprov,OU=Leavers(De-Provision),OU=Starters-Leavers,OU=_Administration,OU=Hybrid,DC=TEST,DC=net" xmlns="urn:schemas-quest-com:ActiveRolesServer">
    <Attributes>
    <Attribute name="Azure-Exchange-Shared-Mailbox" operation="Replace" type="Boolean">
    <Values>
    <Value>true</Value>
    </Values>
    </Attribute>
    <Attribute name="Stage1-Azure-Deprovision" operation="Replace" type="Boolean">
    <Values>
    <Value>true</Value>
    </Values>
    </Attribute>
    </Attributes>
    <Controls>
    <Control id="13">
    <Values>
    <Value>TESTDC.TEST.net</Value>
    </Values>
    </Control>
    <Control id="AllowApproval">
    <Values>
    <Value>Check</Value>
    </Values>
    </Control>
    </Controls>
    </ModifyRequest>
    <------------------- $Request XML ------------------------>

Reply
  • Below is the Powershell script being run

    function onPostModify($Request)
    {
    set-mailbox -Identity $Request.GUID -type shared

    }

    When I look at the debug on the script I see the below. The Exchange mailbox is never converted to shared. 

    If i connect to Exchange online with the same account the ARS Azure configuration is running under and issue the standard then the mailbox is converted. 

    set-mailbox -Identity firstname.lastname@domain.com -type shared

    WARNING: The names of some imported commands from the module 'ActiveRolesManagementShell' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
    <-------------------------------------------------------------->
    <---- New Debug Session 7/23/2021 9:56:30 AM ---->
    <-------------------------------------------------------------->
    <------------------- $Request XML ------------------------>
    <ModifyRequest xmlns:xsd="">www.w3.org/.../XMLSchema" xmlns:xsi="">www.w3.org/.../XMLSchema-instance" dn="CN=Test02\, Deprov,OU=Leavers(De-Provision),OU=Starters-Leavers,OU=_Administration,OU=Hybrid,DC=test,DC=net" xmlns="urn:schemas-quest-com:ActiveRolesServer">
    <Attributes>
    <Attribute name="Azure-Exchange-Shared-Mailbox" operation="Replace" type="Boolean">
    <Values>
    <Value>true</Value>
    </Values>
    </Attribute>
    <Attribute name="Stage1-Azure-Deprovision" operation="Replace" type="Boolean">
    <Values>
    <Value>true</Value>
    </Values>
    </Attribute>
    </Attributes>
    <Controls>
    <Control id="13">
    <Values>
    <Value>TESTDC.TEST.net</Value>
    </Values>
    </Control>
    <Control id="AllowApproval">
    <Values>
    <Value>Check</Value>
    </Values>
    </Control>
    </Controls>
    </ModifyRequest>
    <------------------- $Request XML ------------------------>
    Call: Set-PSDebug -trace 2
    DEBUG: 1+ >>>> s53bc1e8d-9f82-4691-b39d-8bdad4f9027f 'onPostModify' $Request
    DEBUG: ! CALL function '<ScriptBlock>'
    DEBUG: 8+ >>>> &$args[0] $args[1]

    DEBUG: ! CALL function '<ScriptBlock>'
    DEBUG: 2+ >>>> {

    DEBUG: ! CALL function 'onPostModify'
    DEBUG: 3+ >>>> set-mailbox $Request.GUID -type shared

    <------------------- $Request XML ------------------------>
    <ModifyRequest xmlns:xsd="">www.w3.org/.../XMLSchema" xmlns:xsi="">www.w3.org/.../XMLSchema-instance" dn="CN=Test02\, Deprov,OU=Leavers(De-Provision),OU=Starters-Leavers,OU=_Administration,OU=Hybrid,DC=TEST,DC=net" xmlns="urn:schemas-quest-com:ActiveRolesServer">
    <Attributes>
    <Attribute name="Azure-Exchange-Shared-Mailbox" operation="Replace" type="Boolean">
    <Values>
    <Value>true</Value>
    </Values>
    </Attribute>
    <Attribute name="Stage1-Azure-Deprovision" operation="Replace" type="Boolean">
    <Values>
    <Value>true</Value>
    </Values>
    </Attribute>
    </Attributes>
    <Controls>
    <Control id="13">
    <Values>
    <Value>TESTDC.TEST.net</Value>
    </Values>
    </Control>
    <Control id="AllowApproval">
    <Values>
    <Value>Check</Value>
    </Values>
    </Control>
    </Controls>
    </ModifyRequest>
    <------------------- $Request XML ------------------------>

Children