user13095689
user13095689

Reputation:

Need help creating a PowerShell scirpt to clear Active Directory attributes

I am brand new to PowerShell and looking to create a script that clears the following attributes/fields by user not OU from the general, address, telephones, and organization tabs.

  1. General Tab - Description, Office, Telephone number
  2. Address tab - Street, P.O. Box, City, State/province, Zip/Postal Code
  3. Telephones Tab - Home, Pager, Mobile, Fax, IP phone
  4. Organization Tab - Job Title, Department, Company, Manager

I am currently performing this process via the GUI (AD Users and Computers) and thought it would improve efficiency.

This is as far as I got:

$user = Read-Host "Enter user name"
Set-ADUser $user 

Thank you,

Upvotes: 0

Views: 1370

Answers (1)

wasif
wasif

Reputation: 15528

You can try this:

$user = Read-Host "Enter User name"
Get-ADUser $user | Set-ADUser -Clear Attributes single quoted separated by comma IE 'Description','Office' etc

Upvotes: 0

Related Questions