$files = Get-ChildItem -Recurse -Filter "*.java" "D:\his\healthlink-his-server" $allPerms = @() foreach ($f in $files) { $content = [System.IO.File]::ReadAllText($f.FullName, [System.Text.Encoding]::UTF8) if ($content -match 'PreAuthorize') { $lines = $content -split "`n" foreach ($line in $lines) { if ($line -match 'PreAuthorize') { if ($line -match "'([^']+)'") { $allPerms += $matches[1] } } } } } $allPerms | Sort-Object -Unique