Link to home
Start Free TrialLog in
Avatar of Radim88
Radim88

asked on

Powershell - create script for removing all ACLs and leaving only administrator and system

Hello, I am thinking about script, which will get users from csv file, and remove them ACLs and leave only system, and administrator.

$DomainName = "xxx"
 
Import-CSV "C:\test.csv" | %{
  # Get the folder
  $Folder = Get-Item $_.ColumnA

$ACL = Get-ACL $Folder

xxxxxxx

$ACL.AddAccessRule($AccessRule)

Set-ACL $NewFullName -AclObject $ACL

}



Any ideas?

Mant BR
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

the csv files contain list of folders (not users) from which you with to remove all ACL users except system and administrator, is that correct?
Avatar of Radim88
Radim88

ASKER

Yes the list of folders thats correct:

ColumnA
folder1
folder2
folder3
Avatar of Radim88

ASKER

yes and I want to remove ACLs except of system and administrator for all folders listed in csv.

ColumnA
\\xxx\folder1
\\xxx\folder2
\\xxx\folder3

something like this.
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial