We help IT Professionals succeed at work.

Validating and Initializing a Message Store using Shell scripting

boein
boein asked
on
Medium Priority
254 Views
Last Modified: 2012-05-06
Hi,
I'm using Powershell to create new mailboxes and import existing pst's in it.  The mailbox creates just fine but the import fails.  It gives this error: " Error occurred in the step: Approving object. An unknown error has occurred., error code: -2147221219".  I have enough rights because I run the script as exchange admin.  If I setup outlook and look in the mailbox it's empty.  Afterwards, when I do the import again, it works fine.
My guess is that, when creating the mailbox the first time, the mailbox is empty, no mails but also no default mailfolders.  When you open the mailbox with outlook the first time, these folders are created.  So I need a shell script to 'initialise' a mailbox the first so the right folder structure is created.  Anybody knows how to do that?
Comment
Watch Question

SurajSenior System Engineer
CERTIFIED EXPERT

Commented:
Check if any inactive Domain controller showing up in AD Sites & Services ...

-x

Author

Commented:
Hi,
no only 2 active severs showing up.  Both are Global Catalog, can that be the problem?
SurajSenior System Engineer
CERTIFIED EXPERT

Commented:
Try to import the PST using Outlook, in this case it was having a Password
Protection.Put the passowrd and try importing it.
The passwod Protected PST's will not get Imported using inmport-mailbox command.

SurajSenior System Engineer
CERTIFIED EXPERT

Commented:
The above error can also occur on the machine from which 'Export-mailbox' is executed
whn the 'Default Gateway' is not populated on the NIC's properties. do you have the default gateway Set??
Let me know the results..
-x

Author

Commented:
Hi,

Checked the network config, all seems to be OK with default gateway.  Also I'm always importing from the same computer, all pst's are on a network share.  The pst is not password protected, it's a test-pst with only a few mails in it.  I still believe it's because a new created mailbox misses the "standard" folders like "inbox","sent items","deleted items"...  Because I can import if I open the mailbox once.  
what do you think?
regards
Boein
SurajSenior System Engineer
CERTIFIED EXPERT

Commented:
You got a point there.. Give me some time.. i will research on this and get back to you...
thanks

Author

Commented:
Any news on the research?
Commented:
Running outlook with only 1 profile configured that has full-access to all the mailboxes seems to help.
So it looks like the outlook client has to be open while running the import-mailbox cmd, dunno why but it works.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.