Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to create a some folders in every single mailbox in our exchange organisation.

Is there a quick way to achieve this with a powershell script?

(note this is not public folders, these folders must exist inside the users mailbox)

share|improve this question
Pretty sure this is a duplicate, but I am not finding the question that I remember seeing a while back. – Zoredache Dec 1 '11 at 23:53
@Zoredache - same, and my search skills aren't too bad these days. Unfortunately everything I found was prefixed with the word "public" as in public folders. – Mark Henderson Dec 1 '11 at 23:54
I haven't played with it since I don't have 2010 yet, but ExFolders may be able to do something. – Zoredache Dec 2 '11 at 0:08
up vote 4 down vote accepted

You can do this with the Exchange Web Services (EWS) API. This script should create a folder in a mailbox (I don't have an E2K10 machine w/ EWS 1.1 installed handy right now so I'm cobbling this together from code samples and memory and hoping it'll actually work-- it looks right). This should work as the basis for a script to iterate through mailboxes creating folders (but since I'm such a PowerShell dunce I'm leaving that up to you):

$MailboxName = ""

$dllpath = "C:\Program Files\Microsoft\Exchange\Web Services\1.0\Microsoft.Exchange.WebServices.dll"
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2007_SP1)

$windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$sidbind = "LDAP://<SID=" + $windowsIdentity.user.Value.ToString() + ">"
$aceuser = [ADSI]$sidbind


$folderid = new-object  Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Root, $MailboxName)
$RootFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service, $folderid)

$NewFolder = new-object Microsoft.Exchange.WebServices.Data.Folder($service)
$NewFolder.DisplayName = "Folder_to_Create"

This script assumes you've got EWS 1.1 installed and are logged-on with a credential that has permission to access the subject mailbox.

share|improve this answer
EWS is certainly installed on some of the servers, because it's being used integration with an external system. I'll give it a go, thanks. – Mark Henderson Dec 2 '11 at 0:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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