?
Solved

Backup users mails into Pst's. exchange 2007.

Posted on 2010-08-29
14
Medium Priority
?
387 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Ransomware Attacks Keeping You Up at Night?

Will your organization be ransomware's next victim?  The good news is that these attacks are predicable and therefore preventable. Learn more about how you can  stop a ransomware attacks before encryption takes place with our Ransomware Prevention Kit!

 
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 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Suggested Courses

752 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