Solved

Powershell Set extensiondata (String to Byte array) Active Directory

Posted on 2014-12-09
2
393 Views
Last Modified: 2014-12-10
Hi,

could anybody help me to write the attribut "extensiondata" to AD?

I'm getting the data as follow:

Get-ADuser -id 'tjones' -Properties extensiondata | select -ExpandProperty extensiondata  | ForEach-Object {[System.Text.Encoding]::ASCII.GetString($_)}

The result is:
ZHMAILBOX
WEBMAILBOX

I like to write the string ZHMAILBOX to ByteArray and set extensiondata with this bytearray.

Thanks in advance
0
Comment
Question by:Mandy_
2 Comments
 
LVL 39

Accepted Solution

by:
footech earned 500 total points
ID: 40489942
This is my understanding of how this would work.
$data = @()
$data += "ZHMAILBOX"
Get-ADuser -id 'tjones' | Set-ADUser -replace @{extensiondata=$data}

Open in new window

The extensionData attribute appears as an array of byte arrays, but when setting the property the value is a string array.
0
 
LVL 2

Author Closing Comment

by:Mandy_
ID: 40490674
Great! Thank you so much!
0

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

747 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