How to Fix Mobile phone = System.Collections.Hashtable issue

AJAY PRAJAPATI 20 Reputation points
2023-10-03T08:06:04.29+00:00

Hello All,

I have used the below command to remove the user phone number from Azure AD, using PowerShell,

set-MSOLUser -UserPrincipalName xxxxxxxx -MobilePhone @{ REMOVE = "xxxxxxxxxx" }

as the mobile number was still visible on Azure AD even after removing it at the AD level.

However, after this command now under the Mobile attribute I can see System.Collections.Hashtable instead of the Phone number and Null.

Can someone guide/assist in getting rid of this? Just want to set the mobile attribute to null.

Thank you

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
23,211 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 14,150 Reputation points MVP
    2023-10-03T08:38:07.22+00:00

    you can modify your command like the following

    Set-MsolUser -UserPrincipalName xxxxxxxx -MobilePhone $null
    
    
    

    The command you used tried to set the MobilePhone attribute to a hashtable instead of null or an empty string which is causing the issue


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.