Solved

Backup users mails into Pst's. exchange 2007.

Posted on 2010-08-29
14
386 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
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
A couple of months ago we ran into an issue that necessitated re-creating our Edge Subscriptions. However, when we attempted to execute the command: New-EdgeSubscription -filename C:\NewEdgeSub_01.xml we received an error indicating that the LDAP se…
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

717 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