Updating the Description attribute of an AD Contact object with Powershell

Powershell lets you update many attributes of objects in AD and Exchange.  Exchange 2007 offers a range of cmdlets that let you update various of attributes of Contact objects e.g Set-Contact, Set-Mailcontact,  but for some reason the Description attribute is not exposed and updateable by any Powershell command that is on an Exchange 2007 server by default.  The Set-ADUser or Set-ADObject will do it for you but these are AD cmdlets that come with the Active Directory module which is only available on Windows Server 2008 R2 via the import-module cmdlet.

If you are running Exchange 2007 on Windows Server 2008 then you don’t have access to these AD cmdlets on the Exchange servers even if you are running WS 2008 R2 Domain Controllers.

But thanks to Richard Mueller there is a very simple piece of Powershell code you can use that uses ADSI/LDAP and works from an Exchange 2007 server with Powershell V2 installed  …

$Contact = [ADSI]”LDAP://cn=Jim Smith,ou=West,dc=MyDomain,dc=com”

$Contact.description = “Test Contact Object”

$Contact.SetInfo()

See this article for some more discussion:

http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/6956f31b-f418-490a-acbd-16241d481622/

 

 

 

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s