I needed to create about 30 public folders, and three subfolders within each of them. Rather than manually create them all with powershell commands or through the ECP, I decided to work on a script and csv-import. I figured I’d spend as much time getting that together and it would save me time if I have to create a bunch of public folders in the future.
After a ton of trial and error (and some screensharing with my resident programming expert). i ended up with the following script and csv. Well, now that i think about it, it is really a command, but I saved it as a script!
SCRIPT (saved on desktop as pfscript.ps1)
Import-CSV C:\users\username\desktop\pffolders.csv | Foreach-Object {
new-publicfolder $_.displayname -path $_.rootfolderpath
CSV (saved on desktop as pffolders.csv)
displayname,rootfolderpath
Folder1,\
Subfolder1,\Folder1\
Subfolder2,\Folder1\
Sub-subfolder1,\Folder1\Subfolder2
Sub-subfolder1,\Folder1\Subfolder2
Subfolder3,\Folder1\
Sub-subfolder1,\Folder1\Subfolder3
Folder2, \
Subfolder1, \Folder2
you get the drift…
Then connect up your powershell, change the directory to your desktop and run:
.\pfscript.ps1
Just a quick one today. Figured while I was thinking about it and posted the other stuff yesterday, I’d throw this up. Oh yeah, make sure you have your root permissions right first!