Solved

Backup users mails into Pst's. exchange 2007.

Posted on 2010-08-29
14
382 Views
Last Modified: 2012-05-10
Hi,

Backup users mails into Pst's. exchange 2007.
Each users Pst into a separate newly created folder with the user name.
Record the success or failures into a txt file. That's a log.
Has to run on disabled user accounts only. I need to mention an Ou where i have these users and all has to be done one after the other.

regards
sharath
0
Comment
Question by:bsharath
  • 6
  • 4
  • 4
14 Comments
 
LVL 32

Expert Comment

by:endital1097
ID: 33553713
Get-Mailbox -OrganizationalUnit contoso.com/OU/Disabled | Export-Mailbox -PstFolderPath c:\PSTfiles >c:\PSTfiles\export.log
0
 
LVL 11

Author Comment

by:bsharath
ID: 33555564
I get this

You are running on a 64-bit computer. To export to or import from a .pst file,
you must be running a 32-bit computer that has Outlook 2003 SP2 or later instal
led.
At line:1 char:1

I tried on a 32 bit machines where i have exchange pack and powershell 2.0 but it did not run
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33557487
you must have the exchange management tools and outlook installed on the machine where you will run this
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 11

Author Comment

by:bsharath
ID: 33557624
I get this

Export-Mailbox : A parameter cannot be found that matches parameter name 'PstFolderPath'.
At line:1 char:128
+ Get-Mailbox -OrganizationalUnit "th.local/Offices/nai/Users/
Fgues" | Export-Mailbox -PstFolderPath <<<<  c:\PSTfiles >c:\PSTfiles\export.log
    + CategoryInfo          : InvalidArgument: (:) [Export-Mailbox], Parameter
   BindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Exchange.Manage
   ment.RecipientTasks.ExportMailbox
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33560883
try manually typing the command and using <tab> so type
export-mail<TAB> -pst<TAB>

it should autocomplete the correct values

the syntax looks good in your example
0
 
LVL 11

Author Comment

by:bsharath
ID: 33564159
I dont get any as when click tab
export-mail
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33566025
are you using the exchange management shell
0
 
LVL 12

Expert Comment

by:GusGallows
ID: 33576412
The problem is, you are specifying a file where it should just be the path. Try it this way:

$List = @(Get-Mailbox -OrganizationalUnit "th.local/Offices/nai/Users/Fgues")
foreach ($item in $list)
{
   
$mb = $item
   $output = "c:\PSTfiles"
   $logfile = "c:\PSTfiles\export.log"
   export-Mailbox -Identity $mb -PSTFolderPath $output -GlobalCatalog 'YourGC.com' -BadItemLimit 100 -confirm:$false|Out-File $logFile -Append
}
0
 
LVL 12

Accepted Solution

by:
GusGallows earned 500 total points
ID: 33576467
Whoops, hit enter too soon. Forgot to create the new folders. Here is the completed code. Make sure you are using a Mail-Enabled account to run this and that it has rights to veiw all mailboxes.

$List = @(Get-Mailbox -OrganizationalUnit "th.local/Offices/nai/Users/Fgues")
foreach ($item in $list)
{
   
      $mb = $item
      $mbx = Get-mailbox $item
      $dn = $mbx.Displayname
      $Output = "c:\PSTfiles\" + $dn
      New-Item $dn -type directory
      $logfile = "c:\PSTfiles\export.log"
      export-Mailbox -Identity $mb -PSTFolderPath $output -GlobalCatalog 'YourGC.com' -BadItemLimit 100 -confirm:$false|Out-File $logFile -Append
}
0
 
LVL 12

Expert Comment

by:GusGallows
ID: 33576511
one correction, It should read:

New-Item $Output -type directory

not  New-Item $dn -type directory
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33577312
you should be able to do this with a one liner
Get-Mailbox -OrganizationalUnit "th.local/Offices/nai/Users/Fgues" | foreach-object { export-mailbox $_.name -pstfolderpath C:\PSTfiles | Out-File C:\PSTfiles\export.log -Append -NoClobber
0
 
LVL 12

Expert Comment

by:GusGallows
ID: 33577424
I don't use one-liners if I can help it. Just easier (for me) to read if it is laid out in a more traditional scripting style.  Plus the one liner does not address his need for writing the PSTs to new folders named after the users.
0
 
LVL 32

Expert Comment

by:endital1097
ID: 33608314
good catch on the indiividual folders... i didn't see that part
0
 
LVL 11

Author Comment

by:bsharath
ID: 33876673
Hi
I get this error when run

Export-Mailbox : A parameter cannot be found that matches parameter name 'PSTFolderPath'.
At C:\Export.ps1:11 char:50
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Find out what you should include to make the best professional email signature for your organization.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question