none
add users to existing O365 Inplace Hold policy RRS feed

  • Question

  • Dear Team,

    We have a requirement to add more than 100 users mailbox to existing Inplace Hold policy without remove existing users, wrote a script but don't work as expected with error:

    This operation requires unique source objects, but multiple objects have been found for one of the SourceMailboxes. Please use either the LegacyExchangeDN or the Guid since they should be
    unique. Second Object: Soft Deleted Objects\Helen Ceballos Vinas.
        + CategoryInfo          : NotSpecified: (:) [Set-MailboxSearch], ManagementObjectAmbiguousException
        + FullyQualifiedErrorId : [Server=MWHPR06MB3424,RequestId=8174b0d5-5a9f-430e-8161-80cd1adef8a0,TimeStamp=8/23/2017 1:30:21 PM] [FailureCategory=Cmdlet-ManagementObjectAmbiguousException]
        22616C4E,Microsoft.Exchange.Management.Tasks.SetMailboxSearch
        + PSComputerName        : outlook.office365.com

    script:

    $UserCredential = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
    Import-PSSession $Session
    $userslist=Get-Content "our text file"
    $InPlaceHoldMailboxes = (Get-MailboxSearch "name of policy").sourceMailboxes
    $InPlaceHoldMailboxes += $userslist
    Set-MailboxSearch "msj mailboxes" -SourceMailboxes $InPlaceHoldMailboxes -InPlaceHoldEnabled $true

    can you help us?

    • Moved by Bill_Stewart Monday, October 2, 2017 9:48 PM This is not "scripts on demand"
    Wednesday, August 23, 2017 1:32 PM

All replies

  • It appears you have duplicate mailboxes in your list.


    \_(ツ)_/

    Wednesday, August 23, 2017 1:40 PM
  • we test the script with only one email and receive same error
    Wednesday, August 23, 2017 1:45 PM
  • Then the boxes are already on hold and the error is telling you that your request is a duplicate.


    \_(ツ)_/

    Wednesday, August 23, 2017 2:04 PM
  • We verify the inplacehold in O365 GUI and the user is not in the source list, How to make the script continue if it finds that a user already exists in the sources?

    thanx


    Wednesday, August 23, 2017 2:21 PM
  • Have you tried this:

    $InPlaceHoldMailboxes |
    	ForEach-Object{
    		Set-MailboxSearch "msj mailboxes" -SourceMailboxes $_  -InPlaceHoldEnabled $true -ErrorAction Continue
    	}
    


    \_(ツ)_/

    Wednesday, August 23, 2017 2:24 PM
  • I have little experience with powershell, where should I make the change in the script?
    Wednesday, August 23, 2017 4:47 PM
  • yes, thanx
    Thursday, August 24, 2017 11:38 AM