Solved

Backup users mails into Pst's. exchange 2007.

Posted on 2010-08-29
14
377 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
 
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Do email signature updates give you a headache?

Do you feel like all of your time is spent managing email signatures? Too busy to visit every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video discusses moving either the default database or any database to a new volume.

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now