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
LVL 23
Stelian StanNetwork AdministratorAsked:
Who is Participating?
Stelian StanConnect With a Mentor Network 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

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


Stelian StanNetwork AdministratorAuthor Commented:
On each PF I only need to change OldFC with NewFC and keep the same permissions.
Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

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
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"
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.
Stelian StanNetwork AdministratorAuthor Commented:
Worked for me.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.