Microsoft Exchange Server 2007 – Public Folders

Some powershell stuff on managing Public Folders in Exchange 2007

Create Public Folder

   New-PublicFolder -name "Name"

Remove a Public Folder

   Remove-PublicFolder -Identity "My Public Folder"

Get information on Public Folders

   Get-PublicFolder or Get-PublicFolder -Identity ""

Get information on all public folders

   Get-PublicFolder -Recurse | Format-List Name

get info on all system folders (not otherwise visible)

   Get-PublicFolder -Identity NON_IPM_SUBTREE -Recurse | Format-List Name 

What I need to find out:

– I could not find how to create a Contacts och Calendar Folder
– I could not find out how to change permissions on the root of the Public Folder tree
– I could not change the permission on the public folders


Microsoft Exchange Server 2007 – Connectors

I recently installed my first Exchange 2007 Server and I had problems with recieving mail and found it to be related to the recieve connector.

Exchange 2007 have two kinds of connector. Send connector and recieve connector.

The send connector is located on the Organisation Level and you need to create one for the servers to be able to send mail to internet.

The recieve connector is located in the server level. The Default Recieve Connector is automatically created.

Note: By default it is set up to only recieve mail from authenticated servers. This is a problem if the server is connected directly to the internet. To fix this open properties for the Default Connector and go to “Permission Groups” and click “Anonymous Users” or use Powershell:

   set-ReceiveConnector -identity “Name of Default Connector” -PermissionGroups AnonymousUsers


Scripting Exchange 2007

As you know Exchange 2007 can be totally administered by using Powerscript. Here I have tried to collect some scripts for Exchange 2007 administration:

Empty a mailbox database

List mailbox servers in an organisation


List maildatabases on current server


List mailboxes in maildatabase

   get-mailbox -database "Mailbox Database"

Disable a mailbox

   disable-mailbox [mailboxid]

Bulk enable mailboxes for AD users:

selects all users from AD

   get-user | where-object{$_.RecipientType –eq “User”}

Selects all users from the OU people

   get-user –organizationalUnit people | where-object{$_.RecipientType –eq “User”}
   get-user -organizationalUnit domain/OU/SUBOU | where-object{$_.RecipientType -eq "User"}

   Note: This will get you only users NOT users with mailboxes

Mailenable users from CSV file

   Import-CSV import.csv | foreach {enable-mailbox -Identity $_.Fullname -database EXCHSERVERMailbox Database"}

Where the importfile looks like this:

Firstname Lastname, Change Booking Policy for resources
Set-MailboxCalendarSettings -Identity "Resource Name" -BookingWindowInDays 520


Related Links

Microsoft Exchange Server 2007 Installation Issues

– Domain not in Windows 2000 native mode or Higher

   Solution: Raised Domain functional Level

– Domain Controller Pre Windows 2003

   Solution: Specified DC on install

   setup /mode:install / /roles:ht,ca,mb,mt /enablelegacyoutlook /Organizationname:Company

– Missing Patches for Powershell and .NET Framework


– You do not have permissions to read the security descriptor on CN=Deleted Objects,CN=Configuration,…

   Started installation from console instead of RDP Session


Common Mistakes When Upgrading Exchange 2000/2003 To a Exchange 2007
Google Groups
Jim McBee’s Mostly Exchange Web Log
HELO Windows Blog
Microsoft Technet Forum

Creating home directories

Here is a short script for adding home directories for a user. You can use it in two different ways:

1. Interactive

homedir.bat username

2. Batch

homedir.bat -file userfile.txt

Format for import file (userfile.txt):


======================= START SCRIPT ===========================
if “%1″==”-file” GOTO FILE

if “%2″==”” GOTO NOFILE
Echo Reading from users from %2…
for /f “tokens=*” %%a in (%2) do call :ADDHOMEDIR %%a

goto :EXIT



IF NOT EXIST d:users%1 md d:users%1

cacls d:users%1 /E /T /C /G “DOMAIN%1”:F “DOMAINDomain Admins”:F
chown -r -v -d DOMAIN %1 d:users%1*


echo Folder already exists…


echo Filename missing…

======================= END SCRIPT ===========================

How to perform a silent installation of the Backup Exec Desktop and Laptop Option (DLO) agent

For a silent DLO installation on a Backup Exec media server, modify the following file:
c:Program FilesVERITASBackup ExecNTAgentsDLOsetup.ini
Note: The path will vary if Backup Exec is not installed to the default location on the media server.
1. Open the file setup.ini.
2. Change the following line from:

3. Save the file.

Command Description
/qn Silent install switch
DEFAULTMEDIASERVER=”SERVERNAME” The name of your Media server (replacing SERVERNAME with the name / IP address of your Media server
“%TEMP%DLOAgentInstall.log” Location in which the installation log file will be saved
LAUNCHCLIENT=”0″ Choose whether to bring up the program interface during the installation

After making this change, setup.exe can be run from the DLOAgent Share folder from the media server while on the client PC, or a script can be used to do this.
Additional information:
It has been observed that setup does not pick up the information in setup.ini with some third party applications that may be used to deploy this package using a script.   In such cases, setup.ini can be forced to be used by adding the following command to the batch file:
“setup.exe /settings setup.ini”.
It is advisable to create a customized setup.ini file, instead of modifying the original setup.ini so that too many changes are not made to the original file.

Uninstalling software from the command-line

Sometimes you have the need for removing software from the command-line… for instance from a batch file or locin script.

The easiest way is using msiexec.exe.

Example (removing McAfee Virusscan 7.1):

      msiexec.exe /x C:Program FilesNetwork AssociatesVirusScanRepairCachevse710.msi /q

This uses the msi packet to delete the software

      msiexec.exe /x {59224777-298D-4E9C-9AEB-4A91BDA01B27} /q

and this uses the guid.

The GUID can be found using regedit at:


Scripting Cisco VPN connection

The other day I had a computer that needed to automatically connect a VPN tunner on startup. Apparenty the Cisco VPN Client 4.6 and later has a Command-Line Interface so this can be done using this line in a batch-file.

         start /wait vpnclient.exe connect VPN-Profile user username pwd password

It has a couple of other CLI-Switches:

         Cisco Systems VPN Client Version
         Copyright (C) 1998-2005 Cisco Systems, Inc. All Rights Reserved.
         Client Type(s): Windows, WinNT
         Running on: 5.1.2600 Service Pack 2
         Config file directory: C:Program FilesCisco SystemsVPN Client

          vpnclient connect <profile> [user <username>] [eraseuserpwd | pwd <password>]
                                      [nocertpwd] [cliauth] [stdin] [sd]
          vpnclient disconnect
          vpnclient stat [reset] [traffic] [tunnel] [route] [firewall] [repeat]
          vpnclient notify
          vpnclient verify [autoinitconfig]
          vpnclient suspendfw
          vpnclient resumefw