Yes, you could use the command above to enable the remote mailbox for your on-prem AD account
Enable-RemoteMailbox -Identity "testregularmailbox" -RemoteRoutingAddress "testregularmailbox@contoso.mail.onmicrosoft.com
For shared mailbox, we could use the command below to create it directly:
New-Remotemailbox -Shared -Alias test_shared -Name "Test Shared" -FirstName Test -LastName Shared -OnPremisesOrganizationalUnit "OU=MyOrg,DC=domain,DC=com" -SamAccountName test_shared -UserPrincipalName test.shared@domain.com
When you create a shared mailbox like this, there is no password and the account will be disabled, as it should be. It will also be visible in both the on-premises EAC and the online one. Shared mailboxes created correctly do not need any license, since the account is disabled and they cannot be access directly.
For more information about shared mailbox in Exchange hybrid and why we need to create them in such way: Users in a hybrid deployment can't access a shared mailbox that was created in Exchange Online
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.