I cant test this right now, but you should be able to do this.
$oUserDN = [ADSI]"LDAP://$cn=testuser, CN=users, DC=company, DC=com"
$oUserDN.psbase.proxyaddresses += "NewAddress"
$oUserDN.SetInfo()
Brandon Shell
---------------
Blog:
http://www.bsonposh.com/
PSH Scripts Project:
www.codeplex.com/psobject
MH> Hello,
MH>
MH> I'm basically reading the "proxyaddresses" attribute from an Active
MH> Directory user object, making some changes and writing it back.
MH>
MH> The problem is, it writes back as a single string instead of an
MH> array. Basically as a test I tried just reading the array and then
MH> writing it STRAIGHT back. The problem occurs here to....
MH>
MH> $oUserDN = [ADSI]"LDAP://$cn=testuser, CN=users, DC=company, DC=com"
MH> $aUserProxyAddresses = $oUserDN.Get("proxyaddresses")
MH>
MH> $oUserDN.Put("proxyaddresses", "$aUserProxyAddresses")
MH> $oUserDN.SetInfo()
MH>
MH> Now when I look in Active Directory Computers & Users its in as a
MH> single line.
MH>
MH> Oh FYI - After you write in back and the RUS detects its in a
MH> invalid format it re-stamps it automatically - confused me for a
MH> while......
MH>
MH> How do I write it back as an array?
MH>
MH> Many Thanks
MH>
MH> Mark holland
MH>