Solved

Powershell Set extensiondata (String to Byte array) Active Directory

Posted on 2014-12-09
2
471 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_
[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 Comments
 
LVL 40

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

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

This article explains the steps required to use the default Photos screensaver to display branding/corporate images
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 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…
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 to another domain controller. Log onto the new domain controller with a user account t…

734 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