简体   繁体   中英

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, PO 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,

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM