none
Need help with Set-ADUser command RRS feed

  • Question

  • I need a little help with the following command. Im new to PS and I have found this command but it is only one user at a time. I need to be able to update ALL users in AD.

    My goal is this. Someone before me set all Users Home numbers to 1234567899 and I need to remove that and leave it blank. The command below allows me to do that but only one user at a time by entering their SAMID.

    Is there a way to do this for everyone in AD ?

    Set-AdUser –Identity SAMID –HomePhone $NULL

    Friday, October 10, 2014 2:35 PM

Answers

  • Yeah sure - 

    Get-Aduser -filter * -properties SamaccountName | Select SamAccountName | % {Set-Aduser -identity $_.SamaccountName -HomePhone $null}


    • Edited by Braham20 Friday, October 10, 2014 2:41 PM
    • Marked as answer by Dean_Smith Friday, October 10, 2014 2:46 PM
    Friday, October 10, 2014 2:41 PM

All replies

  • Yeah sure - 

    Get-Aduser -filter * -properties SamaccountName | Select SamAccountName | % {Set-Aduser -identity $_.SamaccountName -HomePhone $null}


    • Edited by Braham20 Friday, October 10, 2014 2:41 PM
    • Marked as answer by Dean_Smith Friday, October 10, 2014 2:46 PM
    Friday, October 10, 2014 2:41 PM
  • worked perfect thank you for this
    Friday, October 10, 2014 2:50 PM