Scribblings of a TechnoBuff

Exchange IIS ASP.NET OCS Sharepoint Windows

Archive for the ‘Outlook’ Category

How to export Exchange 2007 mailbox to a PST file

Posted by Sujeeth on September 25, 2009

What is a PST file?

Taken from Wikipedia: a Personal Storage Table (.pst) is a file used to store local copies of messages, calendar events, and other items within Microsoft software such as Microsoft Exchange Client, Windows Messaging, and Microsoft Outlook.

If an employee leaves the company and you want to export the mailbox to a PST file and store it as a backup, it is very easy to do this in Exchange 2007.

Pre-requisites:

  • Remote computer that has Outlook 2007 installed. This is a must. Don’t install Outlook on the Exchange server itself
  • Exchange Management Shell installed from Exchange 2007 media
  • Windows Power Shell installed

Login to the remote computer with your domain credentials. Note that the domain credentials that you use to login must have FULLACCESS permission on the mailbox you are exporting. If not, this will fail.

If you want to give yourself FullAccess permission on a mailbox, you can run the following script from either PowerGUI or Exchange Management Shell. Change the script according to your requirements.

Add-MailboxPermission -Identity “John Crawford” -User “Contoso\Administrator” -AccessRights FullAccess

After the permission has been added, open up the Exchange Management Shell (EWS) on the remote computer and run this script.

Export-Mailbox -Identity john.crawford@sujeeth.net -PSTFolderPath C:\PSTBackup\John_Crawford.pst

You will get a confirmation prompt:

After pressing Y, the exporting starts

You can remove the FullAccess permission that you added earlier as follows:

Remove-MailboxPermission -Identity “John Crawford” -User “Contoso\Administrator” -AccessRights FullAccess

You can also set filters and actions to be performed while exporting. Some examples as follows:

Get-User john | Export-Mailbox -SenderKeywords info@sujeeth.net -DeleteContent

Get-User john | Export-Mailbox -TargetMailbox sujeeth -TargetFolder reports -SubjectKeywords “laser eye” -DeleteContent

Get-User john | Export-Mailbox -PSTFolderPath C:\PST_Backup\john_crawford.pst -SubjectKeywords “laser eye” -DeleteContent

Get-User john | Export-Mailbox -TargetMailbox sujeeth -TargetFolder MessageCleanup -SenderKeywords info@sujeeth.net -DeleteContent -MaxThreads 10

Posted in Exchange, Outlook, Power Shell | Tagged: , , , , | 2 Comments »

Set up Outlook signature with logo, hyperlink and Active Directory information

Posted by Sujeeth on August 21, 2009

I prefer to use Notepad++ for writing scripts like these as it has good syntax highlighting. Create a vbscript file as outlook_signature.vbs

Store this file in a network share accessible by everyone. Get the company logo in a jpg format and store it in the same network share. You could use NETLOGON folder for which all users will have read access.

The following script will work for Outlook 2003 and above. Please note that if you are using Outlook 2000, the script needs to be changed.

———————-
On
Error Resume Next

Set objSysInfo = CreateObject(“ADSystemInfo”)
strUser = objSysInfo.UserName

Set
objUser = GetObject(“LDAP://” & strUser)

strName = objUser.FullName
strTitle = objUser.Title

’strDepartment = objUser.Department

’strCompany = objUser.Company

’strPhone = objUser.telephoneNumber

Set objWord = CreateObject(“Word.Application”)
Set
objDoc = objWord.Documents.Add()
Set
objSelection = objWord.Selection
objSelection.Style =
“No Spacing”
Set
objEmailOptions = objWord.EmailOptions
Set
objSignatureObject = objEmailOptions.EmailSignature
Set
objSignatureEntries = objSignatureObject.EmailSignatureEntries

‘Name of Staff
objSelection.Font.Name =
“Calibri”
objSelection.Font.Bold =
True
objSelection.Font.Size =
“12″
objSelection.Font.Color = RGB(
15,36,62)

objSelection.TypeText strName

objSelection.TypeText(Chr(
11))

‘Role of Staff
objSelection.Font.Name =
“Calibri”
objSelection.Font.Bold =
False
objSelection.Font.Size =
“11″
objSelection.Font.Color =
0

objSelection.TypeText strTitle

objSelection.TypeText(Chr(
11))

‘Company Logo (stored in network share accessed by everyone)
objSelection.InlineShapes.AddPicture(
“\\servername\netlogon\signature.jpg”)

objSelection.TypeParagraph()

‘Company Contact details
objSelection.Font.Color = RGB(
38,38,38)
objSelection.TypeText
“Tel +44 (0) 744 525 5214″
objSelection.TypeText(Chr(
11))
objSelection.TypeText
“Fax +44 (0) 744 524 2244″
objSelection.TypeText(Chr(
11))
objSelection.Font.Color = RGB(
23,54,93)
objLink = objSelection.Hyperlinks.Add(objSelection.Range,
“http://www.sujeeth.net/”,,“Sujeeth Home Page”,“www.sujeeth.net”)

objSelection.TypeParagraph()

objSelection.TypeParagraph()

‘environment message
objSelection.Font.Name =
“Webdings”
objSelection.Font.Size =
“14″
objSelection.Font.Color = RGB(
115,155,63)
objSelection.TypeText
“P “
objSelection.Font.Name =
“Calibri”
objSelection.Font.Size =
“9″
objSelection.TypeText
“Please consider the environment before printing this e-mail.”

Set objSelection = objDoc.Range()

objSignatureEntries.Add “Standard Signature”, objSelection
objSignatureObject.NewMessageSignature =
“Standard Signature”
objSignatureObject.ReplyMessageSignature =
“Standard Signature”

objDoc.Saved = True
objWord.Quit

———————-

You can download the above script from pastebin

After you save the script in the network share, you can call this file from users’ Logon script or directly on the user machine using cscript

cscript \\servername\netlogon\outlook_signature.vbs

Once you run the script, check your Outlook if it has been properly setup. When you open a new email message, the signature should automatically append.

The signature files are usually stored in Application Data\Microsoft\Signatures folder

If you get problems with line spacing, use vbNewline instead of Chr(11)

You can check for Outlook 2000 version as following.

set outlook = createobject(“outlook.application”)

If outlook.version = “9.0.0.2711″ or outlook.version = “9.0.0.3011″ or outlook.version = “9.0.0.3821″ or outlook.version = “9.0.0.4105″ or outlook.version = “9.0.0.4201″
or outlook.version = “9.0.0.4527″ or outlook.version = “9.0.0.5414″ Then
Outlook2000 =
True
End
If

Posted in Active Directory, Office 2007, Outlook | Tagged: , | 4 Comments »