AD: Adding Mobile and Telephone number to Notes


Is it possible to copy the values from mobile and telephone number to Notes under the tab Telephones on a AD-user?

I have tried to do it like this: set-aduser ADUSER -Replace ${info} but I’m not sure how to add the correct variables to this command


Something like this should help.
Get-ADUser -filter “your filter” -Properties telephoneNumber, OfficePhone | Foreach-Object {
Set-ADUser $.samaccountname -replace @{info="$($.telephoneNumber)`n$($_.OfficePhone)"}

Yes. That’s definiteley possible

You will have to get the information first before you can set it for other attributes. So you have to combine a

Get-ADUser -Identity "sAMAccountName" -Properties OfficePhone,MobilePhone

with a

Set-ADUser -Replace @{info="$_.OfficePhone $_.MobilePhone"}

If you don’t know what a cmdlet is looking for, the first place to look is Get-Help:

Get-Help Set-ADUser -Full

You would see…

    -Replace [hashtable];
        Required?                    false
        Position?                    Named
        Accept pipeline input?       false
        Parameter set name           Identity
        Aliases                      None
        Dynamic?                     true

On the question of is it possible, yes it is. You need to use Get-ADUser to get the attributes, format them (e.g. comma separated, semi-colon, separate lines), and then use Set-ADUser to set the info attribute:

$user = Get-ADUser -Identity Rob
$user | Set-ADUser -Replace @{'info', $user.Sid}

[quote quote=122775]Something like this should help.

4 lines
<textarea class="ace_text-input" style="opacity: 0; height: 18px; width: 7px; left: 44px; top: 0px;" spellcheck="false" wrap="off"></textarea>
Get-ADUser -filter "your filter" -Properties telephoneNumber, OfficePhone | Foreach-Object {
Set-ADUser $_.samaccountname -replace @{info="$($_.telephoneNumber)`n$($_.OfficePhone)"}
[/quote] Thank you very much - it works!