No, you mentioned that a mailbox should be moved if a user is enabled for Skype for Business and the mailbox is stored in a specific MailboxStore or if a user is enabled for Skype for Business and is member of a specific group. The $groupDN variable specifies the distinguished name of this group.
Perhaps a misunderstanding / I'm that misreading the statement. The mailboxes that needs to be moved are located on Exchange server Y and (members of the group XXXX or Skype enabled). My suggestion with group or SFB enabled was two different approaches to the same problem, clearly checking the SFB enablement directly is a cleaner way to go than to take the round trip through the group membership that can be wrong due to manual editing.
I'm guessing the last line of code can be changed to the below to only act on one store and lync enablement.
$Context.ConditionIsMet = $Context.TargetObject.IsLyncEnabled -and (($mailboxParams.StorageDatabase -eq $mailboxStore)
But I also now realize that we are talking about STORE, not Server - where Server would be more right since the user can be on any of four stores on one Exchange 2010 server.
Also, we would like to limit the number of moves for each pass of the scheduled task and run the scheduled task once every night. This so that we move users slowly to new exchange environment but that its still automated during the migration.
Remove-ADGroupMember "XXXX" -Members (Get-ADGroupMember "XXXX") -Confirm:$false
Foreach ($User in get-csuser -filter {Enabled -ne $Null})
{Add-ADGroupMember -Identity "SFB" -Members $User.SamAccountName}
To comment on my other post in this thread - I guess that its a nicer approach to check if the user is isLyncEnabled and ifso insert the user to the XXXX group. Question is how to remove users that no longer is SFB enabled for some reason or another and how the above code can be adapted and inserted into your script to both move the Exchange store and update the SFB members group.
/Kaj