#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

How To: Force Inheritance to Parent Folder

I recently had a request for a script to reset folder access control such that all sub-folders inherit from the Project or Parent folder. The following is what I came up with.

 

# Parent folder to force all subfolder to inherit from.
$ParentFolder = 'test\Parent_123456'
<# The following will return the ProjectWise folder objects
 for the parent folder and all sub-folders. #>
$PWFolders = Get-PWFolders -FolderPath $ParentFolder -Slow -Verbose

<# The following will remove the parent folder from the array.
Want to ensure the Parent folder's access control is not reset. #>
$PWFolders = $PWFolders | Where-Object { $_.FullPath -ne $ParentFolder }

# The following will reset the access control for the remaining ProjectWise folder objects.
Reset-PWFolderSecurity -InputFolder $PWFolders -AllSecurity -IncludeWorkflows -Verbose

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s