Forum Discussion

stamang's avatar
stamang
Copper Contributor
Jan 17, 2022

How to clear AD Users Mobile and Home phone number under the Telephone tab using PowerShell

Hello,

We have multiple users in AD who has a mobile number assigned under the Telephone tab; now, we want to clear the Mobile number for all user.

Is there a PowerShell script that I can use?

  1. Get all users list from AD.

  2. Remove listed users Mobile number

Your help would be much appreciated.

  • Ant2022's avatar
    Ant2022
    Copper Contributor

    stamang 

    Why such difficulties?
    simple command:
    get-aduser -filter * | set-aduser -mobile $null
    or only enabled user:
    get-aduser -filter {Enabled -eq "True"} | set-aduser -mobile $null

    • Usmaanamin's avatar
      Usmaanamin
      Copper Contributor

      i have tried both commands on shell. it executes successfully but no impact. phone numbers are not deleted..

      any other way?

  • $users=get-aduser -filter * -Resultsize 100000
    foreach ($user in $users) {
    set-aduser $user -clear mobile
    }

Resources