Solved

Update Notes in Active Directory account with powershell

Posted on 2014-11-19
4
834 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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
what about DCpro 2 30
Event 4625 - Account Name: _ 3 29
Get processes with highest usage 2 21
Gotten a bit confused with my rather simple PowerShell script 3 21
Utilizing an array to gracefully append to a list of EmailAddresses
A brief introduction to what I consider to be the best editor for PowerShell.
This tutorial will give a short introduction and overview of Backup Exec 2012 and how to navigate and perform basic functions. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as conne…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…

821 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