PowerShell Script

I want to create a script to change the permissions on multiple Public Folders based on a CSV file. I have a CSV file
PF-Chg.csv
LVL 23
Stelian StanNetwork AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
Here is a powershell script that i created to add/modify permissions see below...

Note: the csv file you create needs to have the following column headings
- Name (Public Folder Name\location)
- User (User you want to grant access to)
- Access (Access level you want to give to the user)

Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin
$PFPerm = Import-Csv "c:\yourCSVhere.csv"
foreach ($PF in $PFPerm) {
$PF.Name
$PF.User
$PF.Access
Get-PublicFolder -Identity $PF.Name -Recurse | Add-PublicFolderClientPermission -User $PF.User -AccessRights $PF.Access
}

Open in new window

Another thing you can use is PFDAVadmin which is also a great tool to modify permissions for Public Folders.

Download - http://www.microsoft.com/en-ca/download/details.aspx?id=22427
Manual - http://technet.microsoft.com/en-us/library/bb508858(v=exchg.65).aspx

Thanks

Will.
0
Stelian StanNetwork AdministratorAuthor Commented:
On each PF I only need to change OldFC with NewFC and keep the same permissions.
0
Stelian StanNetwork AdministratorAuthor Commented:
Thank you Will for your quick response. I was thinking to use something like this:

$PFPerm = Import-Csv "C:\PF_Chg.csv"
foreach ($PF in $PFPerm) {ReplaceUserWithUserOnPFRecursive.ps1 -TopPublicFolder "'$PF.Name'" -UserOld $PF.OldFC -UserNew $PF.NewFC}

Open in new window


but I'm getting this error:
get-publicfolder : There is no existing PublicFolder that matches the following Identity: '@{Name=\Max Store Reports\store059; OldFC=MikeC; NewFC=BrianC}.Name'. Please make
sure that you specified the correct PublicFolder Identity and that you have the necessary permissions to view PublicFolder.

I need a way to read "\Max Store Reports\store059" for '$PF.Name
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Will SzymkowskiSenior Solution ArchitectCommented:
The below error message is referring to exactly what it says. It cannot find the Public Folder you have listed.

The -Identity parameter needs to have the GUID or Public Folder name that represents the public folder. Using the full path might help...

This is an example from the help in Powershell...
Get-PublicFolder -Identity "\Legal\Documents\Pending Litigation"
0
Will SzymkowskiSenior Solution ArchitectCommented:
The Variable should not need "" around it. Try removing those. Also for the syntax it might only be looking for ""\Max Store Reports" as the toplevel PF.

Also take a look at the link below for more examples/syntax.
http://www.msexchange.org/articles-tutorials/exchange-server-2007/tools/using-exchange-sever-2007-built-in-scripts-part1.html
0
Stelian StanNetwork AdministratorAuthor Commented:
Made those changes on each Public Folder using:

ReplaceUserWithUserOnPFRecursive.ps1 -TopPublicFolder "'\Max Store Reports\PF_Name'" -UserOld OldFC -UserNew NewFC

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Stelian StanNetwork AdministratorAuthor Commented:
Worked for me.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Exchange

From novice to tech pro — start learning today.