This is my first attempt at Powershell so bear with me if I have overlooked something simple. I've spent several days digging around online and have yet to come up with a good answer as to how to go about adding data to the Description field under the General tab in ADUC. I seem to be able to get everything else added just fine. I've referenced the Attribute Editor and it shows it as being called "description" but obviously that's not the case (or so it seems). I also noticed "Notes" was called "Info" in there, so I guess I can't use the Attribute Editor as a definitive source.

Anyway, I've found a few good references online to help me with this script, basically just wanting to be able to add a new user in AD via Exchange Management Shell, so some of this may look familiar to those that frequent Powershell forums.

#Define Environment Variables
$mailboxdatabase="Mailbox Database"

#Prompt for Username and Password
$firstname = read-host -prompt "Enter First Name"
$lastname = read-host -prompt "Enter Last Name"
$username = read-host -prompt "Enter User Name"
$department = read-host -prompt "Enter Department"
$title = read-host -prompt "Enter Job Title"
$manager = read-host -prompt "Enter Manager Username"
$phone = read-host -prompt "Enter Telephone Number"
$Name=$Lastname+", "+$Firstname
$accountpassword = read-host -assecurestring -prompt "Enter Password"
$upn = $username+ "@Company.com"
$description = read-host -prompt "Enter Description"
$office = read-host -prompt "Enter Office Location"
$notes = read-host -prompt "Enter the Organizational Chart Number"

#Create user and enable mailbox
New-Mailbox  -name $name -userprincipalname $upn -Alias $username -OrganizationalUnit $userou -SamAccountName $username -FirstName $FirstName -Initials '' -LastName $LastName -Password $accountpassword -ResetPasswordOnNextLogon $false -Database $mailboxdatabase

#Pause for 20 seconds for AD 
write-host -foregroundcolor Green "Pausing for 20 seconds for AD Changes"
Start-Sleep -s 20 

#Set user properties
Get-Mailbox $username | Set-User -Company $companyname -Department $department -title $title -Manager $manager -phone $phone -office $office -notes $notes -description $description


When I rem out the -description line, it works fine, if I leave it in there it gives me an error "Set-User : A parameter cannot be found that matches parameter name 'description '." I've seen references to using ADSI instead but It would be nice if this would work as every other field I've populated works just fine. Anyone have any suggestions as to what it might be called, or a valid reason why it simply won't work? I'm also posting a question with regards to giving rights to a folder via PS, but putting that in a separate question.


You are getting the error because you cannot set the description field using Set-User. This is an exchange CMDLET which does not allow for modification of that attribute. To modify the description attribute, you will need to use Set-ADUser. This is available in the Active Directory module. You can Import the Active Directory module using Import-module activedirectory. Something like this should help:

Import-Module ActiveDirectory
Set-ADUser -Company $companyname -Department $department -title $title -Manager $manager -officephone $phone -office $office -description $description

You will still need to set the "notes" attribute using Set-User.

  • Thanks for the help! When I run it, I get the "Import-Module: The specifided module 'ActiveDirectory' was not loaded because no valid module file was found in any module directory" error. A quick search online I see others refrencing that module and PS2. I'm running this from Exchange 2007 on Windows 2008 (not R2) with PS1. Possibly the cause of the problem? I have Windows 2008 R2 on several other servers, just happens to be that two of our first to get 2008 were DC and Exchange. :/ I also have Windows 7 on my PC, could I remotely execute this script to get around the problem? Thanks! – Don Nov 16 '11 at 15:56
  • Yes, you could remote execute the code from a Windows 7 machine that has the AD Module for Powershell (part of RSAT), and the exchange tools/ shell installed. – HostBits Nov 16 '11 at 15:59
  • Sorry for the slow response, had issue with my account. I have Win7x64 on my laptop,RSAT tools installed, I go into powershell and execute the script Import-Module ActiveDirectory, it tries for a bit and then returns "Warning: Error initializing default Drive: 'Unable to find a default server with Active Directory Web Services Running.'." – Don Nov 22 '11 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.