Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Verifying audit settings of files listed within a text file

$
0
0

The script below was written to verify the audit settings of a specific group of files. The script performs the required task, however it only reports if a file matches the requirement or if I change the setting to -notmatch it only reports those that fail.

I would like to be able to report a pass or fail for each file in the list based on a -match statement only. 

$col=@()

foreach ($path in get-content ./WXP_x32.txt){

$col =get-acl $path -audit |select path,accesstostring, audittostring

$col |where-object {$_.AuditToString -match "Everyone Failure  ReadData, CreateFiles, AppendData, ExecuteFile, Delete, ChangePermissions, TakeOwnership"} 

I am using PS2 as I have to support a few XP systems. The accesstostring is not required for this particular task but to be used for a later step once I figure this part out.


Viewing all articles
Browse latest Browse all 8583

Trending Articles