How to use PowerShell for Active Directory tasks

How would I do the following in PowerShell?

1.  I want to edit the Telephone Number, Mobile and Fax properties in multiple users.
2.  I only want to edit those properties if any or all of them are populated with a dash ( - ).
3.  If those properties are populated with a dash ( - ), then I would like to remove it and leave the property empty.  

This is meant to be done to all users in a domain with 2 thousand users and has a structure of many OUs.

Who is Participating?
Jamie McKillopConnect With a Mentor IT ManagerCommented:

Try this:

$users = Get-User -ResultSize unlimited
foreach ($user in $users) {
	if ($user.telephoneNumber -eq "-") {
		$user.telephoneNumber = $null
	If ($ -eq "-") {
		$ = $null
	If ($user.facsimileTelephoneNumber -eq "-") {
		$user.facsimileTelephoneNumber = $null
	Set-User $user.distinguishedname

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.