Solved

Update Notes in Active Directory account with powershell

Posted on 2014-11-19
4
972 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
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…

739 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