Hello @Niranjan T Pattana Shetty
Yes, this is possible, at least with OUs in your organization, for example:
Get-Mailbox -OrganizationalUnit "Marketing" -ResultSize Unlimited | Set-Mailbox -RetentionPolicy "RetentionPolicy-Marketing"
For detailed syntax and parameter information, see
https://learn.microsoft.com/en-us/powershell/module/exchange/get-mailbox?view=exchange-ps
https://learn.microsoft.com/en-us/powershell/module/exchange/set-mailbox?view=exchange-ps
Hope this helps with your query,
--
--If the reply is helpful, please Upvote and Accept as answer--