【发布时间】:2017-11-16 01:16:44
【问题描述】:
Powershell 新手在这里。我正在尝试创建一个脚本,该脚本将获取用户列表、网络共享列表、枚举用户/共享的有效权限并输出到 CSV 以进行审计。
我已经成功使用GetPACEffectiveAccess from the PowerShellAccessControl Module on Technet gallery 进行枚举,但我完全不知道如何将这些数据输出到 CSV 我想要的方式。
我的代码很简单:
$users=gc C:\scripts\users.txt
$shares=gc C:\scripts\shares.txt
foreach ($user in $users) {
foreach ($share in $shares) {
Get-PACEffectiveAccess -Path $share -Principal $user | select-object principal, accessmask, path | Export-Csv C:\scripts\EffectivePermissions\Audit.csv -append -NoTypeInformation}}
由于我不知道如何在 StackOverflow 上制作表格(哇,我不擅长这个),我附上了我从简单脚本中获得的输出的屏幕截图,然后是我想要获得的输出。
任何帮助将不胜感激!
谢谢
【问题讨论】:
标签: windows powershell file-permissions auditing