I'm still very new to Powershell, and have always had a ton of trouble with programming/scripting in the first place, so I apologize if this is a bit scattered sounding. I really haven't known what I've been doing throughout.
At work I'm trying to clean up our shared directories that have individual permissions on them. I've managed to scrounge up a script that gets a list of the directories, and then goes through and pulls permissions of the people who can access those directories & saves it to a csv file.
The CSV file has information looking like this:
PATH Identity
Folder1 AD\User1
Folder1 AD\Group1
Folder2 AD\User2
Folder2 AD\Group2
Folder3 AD\Group3
etc. It goes on similarly for about 1,800 entries. The problem is I need to filter any groups from this list and, if there are any folders that only have group access then remove those from the list as well.
I was trying to make a new script to pull that csv into powershell but no idea how to go about it.
I was trying this, but definitely don't think it's the right way to go about it:
$permissions = Import-csv C:\Users\MyUser\Desktop\Permissions.csv | select Path,Identity | ft
$permissions | ForEach($_.Identity) {
$users Get-ADObject -Identity $_.Identity
if($users.ObjectClass -eq "user"){
select Path,Identity
}
}
Export-Csv C:\Users\MyUser\Desktop\groupsRemoved.csv