We help IT Professionals succeed at work.

Powershell Script  - replace information of Homephone with Pager field in AD.

1,853 Views
Last Modified: 2014-08-04
I wan to update AD > User> Properties > Telephone Information.

need to replace Home phone with Pager

Import-Module ActiveDirectory            
           
# Find all accounts with Pager
# Copy that value into Description            
Get-ADUser -LDAPFilter '(Pager=*)' -Properties homephone, pager |            
 Select-Object * -First 5 |            
 ForEach-Object {Set-ADObject -Identity $_.DistinguishedName
  -Replace @{homephone=$($_.pager)}}


----------------------------------------------------------

Getting this error

 
The term '-Replace' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:8 char:11
+   -Replace <<<<  @{homephone=$($_.pager)}}
    + CategoryInfo          : ObjectNotFound: (-Replace:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


Please advise
Comment
Watch Question

IT Infrastructure Architect
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
SAIMSKY ADMINSYS ADMIN

Author

Commented:
Thanks
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.