Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Update Notes in Active Directory account with powershell

Posted on 2014-11-19
4
Medium Priority
?
1,203 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 2000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

704 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