‘Connect-MsolService’ is not recognized as the name of a cmdlet

If you are facing this issue, you are not alone. In my case, I had run the install-Msolservice command before and it completed with no errors but nothing seemed to be installed, therefore it didn’t connect or recognize the modules in the machine. Here are the steps to get it fixed.

Open PowerShell as Admin –> Run the following commands in sequence (ensure your machine is connected to internet)

Firstly, uninstall the Azure-AD module

uninstall-module AzureAD

The re-install it

Install-module AzureAD
Install-module AzureADPreview

Try to run this. It will complete without any errors if you have the module existed but somehow corrupted (It could fail too but just run it anyways to verify)

Uninstall-module MSOnline

Now re-install the MSOnline Module

Install-module MSOnline

And now you can connect to O365. It should prompt you for credentials to login


Once completed, the following command can be used to verify the installation.

Get-Module -ListAvailable -Name MSOnline*



Permanently deleting an Office 365 Group object in retention enabled environment

There is a stage where an Office 365 group can reach its end. As O365 group acts a major role for may Office 365/Azure related workloads, there could be plenty of situations you come across that you have to get rid of some of your Office 365 Groups.

For instance, a situation where you have removed your Team and Its associated SharePoint site but Group object could be still hanging in the recycle bin until it reaches the retention period based on the retention policy you have set. Or, perhaps, you have decided to delete a SharePoint site or Microsoft Team, you will find you cannot create another team or site in its place. You will receive an error saying this group already exists.  This is because the group was deleted as a ‘soft delete’. Meaning it’s sitting in a recycle bin for a number of days until it’s permanently deleted (retention plays again). Just follow these steps and you will immediately get rid of that unnecessary group object.

First and foremost, ensure that you have Azure AD PowerShell module is installed in your PC.

Run the following commands in sequence.

This first line will connect you to your Office 365 Tenant’s Azure AD. you will be prompted for the credentials to log in.




Now let’s run this one to get the group GUID from the deleted list



Copy that GUID of the desired group and run the following by targeting that ID.

Remove-AzureADMSDeletedDirectoryObject -Id <ReplaceWithGroupID>

It should result as follows if it was success


To ensure the deletion is successful, run the same command again and see if it doesn’t return the group name you deleted. It shouldn’t !


Fixed: In Exchange Online, messages sent from a shared mailbox aren’t saved to the Sent Items folder of the shared mailbox

In Microsoft Exchange, shared mailboxes doesn’t require a product license and cannot be added to Outlook as an independent account/mailbox. Basically, You can’t sign in to a shared mailbox. What you normally do it, you sign in to your own account/mailbox, and open the shared mailbox from there.

As the title suggest when you send or reply to a new message from the shared mailbox, Outlook automatically sends or replies from your account (sender’s). Therefore, messages are stored in the Sent Items folder of your (sender’s) mailbox. In this case, a shared mailbox won’t store the outgoing mails in the common shared mailbox which can cause visibility issue specially in a collaboration environment. Nevertheless, we still have an option to manage this hassle.

The following steps will help you to enable the Save a copy feature in Exchange Online Environment.

To do this for a one specific shared mailbox (or very few), you can simply enable it from the Admin UI. Login to Office 365 tenant –> and direct to Admin Center –> Exchange Admin Center –> Groups –> Shared Mailboxes –> Select the Mailbox –> Use tap the option below


Edit the ‘Copied to Mailbox’ options


Enable first option here, or peraps both depends on your needs.


To do it as a bulk for all shared mailboxes, Launch Exchange Online PowerShell Module and Connect to the tenant by signing in as shown below




Once authenticated, you should see an outcome like this


Now let’s get the the current state of the Shared Mailboxes by running this command. It will return the list of Shared Mailboxes that are enabled for sent item copies currently. This means you can revert back this change if required but only to these ones, not for all.

Get-Mailbox -RecipientTypeDetails shared | Where-Object{$_.messagecopyforsentasenabled -eq ""}


Let’s also get the Mailboxes that are already enabled this feature. In case if we revert this back to its original state, we will have to leave these mailboxes as they were so this would be useful In such situation.


And, we can now run the following all existing Shared Mailboxes to enable it.

Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'SharedMailbox')} | set-mailbox -MessageCopyForSentAsEnabled $True | Where-Object{$_.messagecopyforsentasenabled -eq ""}


Finally , we need to verify if it went well. This command results all sharedmailboxes that are enabled this feature. If it lists down all – you have done it right ! In my case, I only have 4 altogether so it has run perfectly there.

Get-Mailbox -RecipientTypeDetails shared | Where-Object{$_.messagecopyforsentasenabled -eq "True"}


Reversing this change: In case if you’re in a situation to reverse this change. You can do so in two ways.

To reverse it to original state for a specific one shared mailbox. use this command or Admin UI as explain in the beginning of this article.

set-mailbox testshare2bymanoj -MessageCopyForSentAsEnabled $False


To reverse it to original state for all shared mailboxes. use this command

Get-Mailbox -ResultSize unlimited -Filter {(RecipientTypeDetails -eq 'SharedMailbox')} | set-mailbox -MessageCopyForSentAsEnabled $False | Where-Object{$_.messagecopyforsentasenabled -eq "True"}


Make sure you disconnect the remote PowerShell session when finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you’ll need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command.

Remove-PSSession $Session