I'm trying to dynamically go through all project folders to find those with users that have assigned access then remove that access. Below is the latest attempt and from everything I can find it looks mostly correct.
#Get all the Project Folders for a Disciplin foreach ($ProjectFolder in $ProjectFolders) { Write-Host $ProjectFolder.ProjectID $PWProject = $ProjectFolder.ProjectID # get the security settings for the project forlders $PWAccessControls = Get-PWFolderSecurity -InputFolder $PWProject | Where-Object Type -eq 'User' # Get the detail information about Access Control Filter foreach ($PWAccessControl in $PWAccessControls) { # Create new datarow. $dr = $dt.NewRow() # Populate datarow. $dr.ProjectID = $ProjectFolder.ProjectID $dr.ProjectName = $PWAccessControl.ProjectName $dr.SecurityType = $PWAccessControl.SecurityType $dr.Type = $PWAccessControl.Type $dr.Name = $PWAccessControl.Name $dr.Access_Control_Settings = $PWAccessControl.Access_Control_Settings $dr.DSName = $TxDOTDataSource $dr.District = $DistrictFolder $dr.Discipline = $Discipline # Add datarow to datatable. $dt.Rows.Add($dr) Write-Host $dr.ProjectName Write-Host $ProjectFolder.ProjectID Write-Host $dr.Name Write-Host $dr.TypeRemove-PWFolderSecurity -InputFolder $ProjectFolder.ProjectID -MemberName $PWAccessControl.Name -MemberType user -FolderSecurity -ErrorAction Stop } # Getting details on AccessList List Data } #End Get all project folders for a discipline
I'm using the write-host to tell me what is processing and everything appears to work except the Remove-PWFolderSecurity line. What am I missing?