ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Import New-PublicFolder -Name in bulk

    IT Discussion
    2
    2
    442
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      Texkonc
      last edited by

      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.

      dafyreD 1 Reply Last reply Reply Quote 0
      • dafyreD
        dafyre @Texkonc
        last edited by

        @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)

        1 Reply Last reply Reply Quote 3
        • 1 / 1
        • First post
          Last post