Powershell Help - Exporting list of mailboxes to PST

Hi Everyone,

I'm trying to export around 30 old mailboxes to PST prior to removing them from the system completely. The script I've come up with seems ok, but I'm getting an error when executing:

The script:

Import-Csv c:\list.csv | %{New-MailboxExportRequest -Mailbox $_.UserName -FilePath "\\SERVER\Share\PST Backups\$_UserName.pst"}

The error:

The server or share name specified in the path may be invalid, or the file could be locked.
    + CategoryInfo          : NotSpecified: (:) [New-MailboxExportRequest], RemotePermanentException
    + FullyQualifiedErrorId : [Server=SERVER,RequestId=54f75210-2ab7-4a27-84ce-48cf1895709c,TimeStamp=26/05/2015 1:18
   :28 AM] [FailureCategory=Cmdlet-RemotePermanentException] 76CC515D,Microsoft.Exchange.Management.RecipientTasks.Ne
  wMailboxExportRequest
    + PSComputerName        : server.domain.local

Perhaps there's an issue with my command, or maybe there's just something I'm missing altogether... any feedback is greatly appreciated!

Cheers,
Anthony


May 25th, 2015 9:29pm

Hi Antony,

I guess, you have created a shared folder already and set the permissions so that the current user can write on the folder. Can you also go to the folder properties and see if the folder 'Security Permissions' are also set corr

Free Windows Admin Tool Kit Click here and download it now
May 25th, 2015 10:46pm

Hi there,

Here I was thinking to myself "of course I did" ... before I realized that the share was in fact hidden and I was missing the $ at the end of the share name.

Now the script is executing properly, however doesn't seem to be parsing the $_UserName to the $_UserName.pst because all I'm getting is a file name ".pst".

Any idea's?

Cheers,

May 25th, 2015 10:52pm

How about this:

Import-Csv c:\list.csv | %{New-MailboxExportRequest -Mailbox $_.UserName -FilePath "\\SERVER\Share\PST Backups\+$_UserName.pst"}

Free Windows Admin Tool Kit Click here and download it now
May 25th, 2015 11:03pm

I was able to get the script kind of working by inserting the missing . in $_.UserName.pst, however the name of the file ends up being @(Username=User Name).Username.pst instead of just their username. Adding the + just makes the file name +@(Username = User Name).Username.pst

So I am able to differentiate between the files however it's not quite naming them how I'd want.

Cheers,

Anthony

May 26th, 2015 12:04am

If the issue still persist, I would suggest you to give a try on this available automated solution (http://www.exchangemailboxtopst.org/) that I have used earlier with the same concern to export users mailboxes into PST. Hope, this helps you.
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 2:44am

Try this powershell command.

Import-Csv c:\list.csv |foreach {$UID=$_.UserName;$lpath="\\SERVER\Share\PST Backups\$UID.pst";New-MailboxExportRequest -Mailbox $UID -FilePath $lpath}

May 26th, 2015 3:15am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics