Multiple Imports in ps1 file

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 5 months ago.

  • Author
    Posts
  • #6477

    by moxy at 2012-09-22 19:58:35

    Hi,

    Relatively new to PS so please bear with me.

    Here is the problem:
    I have a number of users who I need to import into Exchange 2007 via PST from Exchange 2003. Because the PSTs need to be smaller than 2GB, each user has a number of PST files.

    I have put all the import commands into one PS1 file but I'm looking for a way so that
    1. I can get it torun multiple threads
    2. I don't have to say YES to each import line

    Sample of ps1 file:
    import-mailbox -identity user1@email.com -pstfolderpath c:\psts\user1-1.pst
    import-mailbox -identity user1@email.com -pstfolderpath c:\psts\user1-2.pst
    import-mailbox -identity user2@email.com -pstfolderpath c:\psts\user2-1.pst
    import-mailbox -identity user2@email.com -pstfolderpath c:\psts\user2-2.pst
    import-mailbox -identity user2@email.com -pstfolderpath c:\psts\user2-3.pst
    import-mailbox -identity user3@email.com -pstfolderpath c:\psts\user3-1.pst
    import-mailbox -identity user4@email.com -pstfolderpath c:\psts\user4-1.pst
    import-mailbox -identity user4@email.com -pstfolderpath c:\psts\user4-2.pst

    Thanks in advance for your help!

    by DonJ at 2012-09-24 10:01:40

    The second question is easier. You can probably add -confirm] to each command. I'm assuming Import-Mailbox is using the shell's standard Yes/No confirmation prompt; if it isn't, then my suggestion may not work.

    The first question is almost as easy.


    Start-Job -ScriptBlock { import-mailbox -identity user1@email.com -pstfolderpath c:\psts\user1-1.pst }

    Will start the task in its own background thread. You can run Get-Job to monitor the status of each, and Receive-Job to receive a particular job's results.

You must be logged in to reply to this topic.