Import New-PublicFolder -Name in bulk



  • Long story short, the previous guy left no documentation. I did find his template file however. Now I just the EMC shell syntax.
    We have public folder data to add.
    For example I have 95 lines of this just for this one year in a CSV.
    New-PublicFolder -Name 910002 -Path \Projects\1991
    New-PublicFolder -Name 910007 -Path \Projects\1991
    New-PublicFolder -Name 910008 -Path \Projects\1991
    New-PublicFolder -Name 910009 -Path \Projects\1991
    New-PublicFolder -Name 910010 -Path \Projects\1991
    New-PublicFolder -Name 910011 -Path \Projects\1991
    New-PublicFolder -Name 910012 -Path \Projects\1991
    New-PublicFolder -Name 910013 -Path \Projects\1991
    New-PublicFolder -Name 910014 -Path \Projects\1991

    Looking at this, it doesn't show how I could use a CSV instead of manually typing it in.
    https://technet.microsoft.com/en-us/library/bb691104(v=exchg.150).aspx

    I have 8 years to add like this. So I know he did it, I just have no idea what syntax he used to have Exchange shell grab from the CSV.



  • @texkonc said in Import New-PublicFolder -Name in bulk:

    Long story short, the previous guy left no documentation. I did find his template file however. Now I just the EMC shell syntax.
    We have public folder data to add.
    For example I have 95 lines of this just for this one year in a CSV.
    New-PublicFolder -Name 910002 -Path \Projects\1991
    New-PublicFolder -Name 910007 -Path \Projects\1991
    New-PublicFolder -Name 910008 -Path \Projects\1991
    New-PublicFolder -Name 910009 -Path \Projects\1991
    New-PublicFolder -Name 910010 -Path \Projects\1991
    New-PublicFolder -Name 910011 -Path \Projects\1991
    New-PublicFolder -Name 910012 -Path \Projects\1991
    New-PublicFolder -Name 910013 -Path \Projects\1991
    New-PublicFolder -Name 910014 -Path \Projects\1991

    Looking at this, it doesn't show how I could use a CSV instead of manually typing it in.
    https://technet.microsoft.com/en-us/library/bb691104(v=exchg.150).aspx

    I have 8 years to add like this. So I know he did it, I just have no idea what syntax he used to have Exchange shell grab from the CSV.

    $myData=import-csv -Path "C:\Path\to\my\file.csv"
    
    foreach ($line in $myData) {
     New-PublicFolder -Name $line.NewFolderName -Path "\Projects\$($line.projectYear)"
    }
    

    In the above examplethe CSV file would have a column named "NewFolderName" and another column named Project Year

    (It can have other info, it only gets used if you need it)


Log in to reply
 

Looks like your connection to MangoLassi was lost, please wait while we try to reconnect.