Solved

Update Notes in Active Directory account with powershell

Posted on 2014-11-19
4
697 Views
Last Modified: 2016-09-15
I want to add some information to the Notes section in the Telephone tab. I can do it with the code below but that replaces what is already there .. I don't want to replace it .. I need this information to be the first or last line of what ever information is already there ..

What are the other options ? -Add does not work and I tried other options and none work and cant figure out the help on set-aduser

help ??

This is what I was testing with..

GC C:\PS\Users.txt | % {
$info = "My Notes Here"
Set-ADUser $_ -replace @{info=$info}
}
0
Comment
Question by:MilesLogan
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 40452772
You can try this and see if it works as expected..
GC C:\PS\Users.txt | % {
$note = (Get-ADUser $_ -Properties info).info
$info = "My Notes Here"
If ($note -ne $null){
 Set-ADUser $_ -replace @{info="$note`r`n$info"}
 }Else{
 Set-ADUser $_ -replace @{info=$info}
 }
}

Open in new window

0
 
LVL 2

Author Closing Comment

by:MilesLogan
ID: 40452972
SubSun .. thank you so much again !
0
 
LVL 40

Expert Comment

by:Subsun
ID: 40452992
You are welcome!!
0
 

Expert Comment

by:B Y
ID: 41800765
Is there anyway to append to the top instead of the bottom?
0

Join & Write a Comment

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
OfficeMate Freezes on login or does not load after login credentials are input.
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now