quick csv import question

Author Message
faulkkev

  • Total Posts : 593
  • Scores: 13
  • Reward points : 0
  • Joined: 11/1/2005
  • Location: Kansas City, MO
  • Status: offline
quick csv import question Thursday, July 21, 2011 7:35 AM (permalink)
0
 how would this look?  username, username, pstfilename.
 
I am not clear on the csv format the rest of the script is ok i post all of it incase that helps.
 http://gallery.technet.microsoft.com/scriptcenter/e46edf5b-3d82-4f11-a3fa-665f32df6bd8?SRC=Home 
 
# Set up variables (CSV file format id, pst = userid and pst file name)[/style]
$data = Import-CSV d:\import.csv
# Set Database for user mailboxes
$exhdb= "Mailstore Users"
# Set Domaincontroller for user mailboxes
$dcname = "dc01.contoso.com"
#Import the data from PST
ForEach ($i in $data){
Enable-Mailbox -Identity $i.id -Database $exhdb -DomainController $dcname
# Set server name where file share for PST is
$pstpath = "\\ServerX.contoso.com\pst\" + $i.id + "\" + $i.pst
Write-Host "Press any key to continue ... wait for 60 sec"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host
Write-Host "1"
Write-Host "2"
Write-Host "Starting PST Import"
Start-Sleep -s 30
New-MailboxImportRequest -filepath $pstpath -Mailbox $i.id -BadItemLimit 40 -DomainController $dcname
Write-Host "Press any key to continue ... wait for another 60 sec"
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host
Write-Host "4"
Write-Host "5"
Write-Host "Resume PST Import"
Start-Sleep -s 10
$iden = $i.id + "\MailboxImport"
resume-MailboxImportRequest -identity $iden -DomainController $dcname
}
 
#1
    ebgreen

    • Total Posts : 8227
    • Scores: 98
    • Reward points : 0
    • Joined: 7/12/2005
    • Status: offline
    Re:quick csv import question Thursday, July 21, 2011 8:25 AM (permalink)
    0
    It would be:
     
    UserID, PSTFileName
    "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
    Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
    http://www.visualbasicscript.com/m_47117/tm.htm
     
    #2
      faulkkev

      • Total Posts : 593
      • Scores: 13
      • Reward points : 0
      • Joined: 11/1/2005
      • Location: Kansas City, MO
      • Status: offline
      Re:quick csv import question Thursday, July 21, 2011 8:47 AM (permalink)
      0
      am i the only one having a hard time diving into powershell.  I had a class and everything but still like vbscript.  I'm forcing myself now. 
       
      thanks
       
      #3
        ebgreen

        • Total Posts : 8227
        • Scores: 98
        • Reward points : 0
        • Joined: 7/12/2005
        • Status: offline
        Re:quick csv import question Thursday, July 21, 2011 9:14 AM (permalink)
        0
        Not me. Everything goes into PS now unless the script will be running in an environment without PS.
        "... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
        Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
        http://www.visualbasicscript.com/m_47117/tm.htm
         
        #4
          TomRiddle

          • Total Posts : 620
          • Scores: 12
          • Reward points : 0
          • Joined: 2/7/2008
          • Location: Australia
          • Status: offline
          Re:quick csv import question Sunday, July 24, 2011 3:12 PM (permalink)
          0
          I had a really hard time converting to PowerShell. I actually started, gave up for a year and then had to have a renewed effort to learn it. If your only programming background is VBScript, it's a totally foreign concept.
           
          I assure you though, once you are over the learning hump, I think it is worth it because:-
          • I don't have to refer to sample code in script repositories to do something simple like read from registry set an attribute in AD, read from WMI or a text file.
          • My scripts are much shorter and quicker to write and debug
          • There is more PowerShell samples and live help on-line than for VBScript, if not there will be.
          • I can do stuff in PowerShell I can't do with VBScript
          Also there are free eBooks
          There are people blogging about new PowerShell techniques every day.
          Microsoft are focused in developing PowerShell so expect updates and extra features soon.
          Comes with a built in editor.
          There is an online PowerShell scripting competition every year with fantastic prizes.
          Do an operation like create a new mailbox on exchange server and it gives you the code so you can script it the next time. How cool is that!!!
           
          The list goes on…. I am really chuffed with PowerShell if you hadn't noticed.
          Master objects and the Pipeline and you have harnessed the power of PowerShell.
           
          <message edited by TomRiddle on Sunday, July 24, 2011 3:17 PM>
          -join([int[]][char[]]'Ut|jwXmjqq%Wzqjx'|%{[char]($_-5)})
           
          #5

            Online Bookmarks Sharing: Share/Bookmark

            Jump to:

            Current active users

            There are 0 members and 1 guests.

            Icon Legend and Permission

            • New Messages
            • No New Messages
            • Hot Topic w/ New Messages
            • Hot Topic w/o New Messages
            • Locked w/ New Messages
            • Locked w/o New Messages
            • Read Message
            • Post New Thread
            • Reply to message
            • Post New Poll
            • Submit Vote
            • Post reward post
            • Delete my own posts
            • Delete my own threads
            • Rate post

            2000-2012 ASPPlayground.NET Forum Version 3.9