Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7656153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:41:44+00:00 2026-05-31T12:41:44+00:00

I am attempting to run the following PowerShell command against my Exchange 2010 SP1

  • 0

I am attempting to run the following PowerShell command against my Exchange 2010 SP1 server:

$colItems = Get-Mailbox -Filter {office -eq "ExportPST"}
ForEach($objItem in $colItems)
{
New-MailboxExportRequest -Mailbox $objItem -FilePath \\server\share$\"$objItem".pst
}

When I do this I receive the error:

Couldn’t locate a database suitable for storing this request.
+ CategoryInfo : InvalidArgument: (domain.com….d/John Doe:MailboxOrMailUserIdParameter) [New-M ailboxExportRequest],
MailboxDatabase…manentException
+ FullyQualifiedErrorId : 9322CB6D,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest

What I am attempting to do is search across my AD users, locate users that have the string ExportPST in the Office field, and then export the command New-MailboxExportRequest to export the entire contents of the user’s mailbox to a PST for each user returned.

When I add a Write-Host to the above, the outputed values are correct:

New-MailboxExportRequest -Mailbox jdoe -FilePath ” \\server\share$\John Doe.pst”

The output also includes an extra space between the -FilePath ” and \, which I imagine will cause an issue once the above issue has been resolved, is there a way to contactenate strings without it adding this extra space?

Thanks,

Matt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:41:45+00:00Added an answer on May 31, 2026 at 12:41 pm

    I think your quoting is a bit off. Double-quoted string expansion works when you completely surround the string, not just the variable part.

    $colItems = Get-Mailbox -Filter {office -eq "ExportPST"}
    ForEach($objItem in $colItems)
    {
      New-MailboxExportRequest -Mailbox $objItem -FilePath "\\server\share$\$objItem.pst"
    }
    

    Here’s an alternative syntax which uses .NET string formatting / replacement:

    $colItems = Get-Mailbox -Filter {office -eq "ExportPST"}
    ForEach($objItem in $colItems)
    {
      New-MailboxExportRequest -Mailbox $objItem -FilePath ('\\server\share$\{0}.pst' -f $objItem)
    }
    

    To make troubleshooting / debugging easier, you could assign the file path to a variable, and then pass the variable into the -FilePath parameter. That way you can see exactly which value is getting passed in.

    $colItems = Get-Mailbox -Filter {office -eq "ExportPST"}
    ForEach($objItem in $colItems)
    {
      $FilePath = '\\server\share$\{0}.pst' -f $objItem;
      Write-Host -Object ('$FilePath value is: {0}' -f $FilePath);
      New-MailboxExportRequest -Mailbox $objItem -FilePath $FilePath;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to run the following command in KornShell (ksh): set -A INDEXES
I'm attempting to run the following command in PHP (on Ubuntu): <?php if (exec(/home/johnboy/ffmpeg/ffmpeg
I'm attempting to run mongrel_rails, but I get the following: the program can't start
I get an error (1064) when attempting to run the following... (MySql 5.5.9) query:
When attempting to run the following assembly program: .globl start start: pushq $0x0 movq
I am attempting to run a parameterized query against a DB2 database from .NET
I am getting the following error message when compiling or attempting to run my
I'm using gvim and rails.vim and getting the following error when attempting to run
I'm finally attempting to run proguard for my android app but I get the
I am attempting to run VLCJ test jar from command line. VLCJ requires two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.