【问题标题】:Powershell Auditing effective windows share permissions and outputting to CSVPowershell审核有效的windows共享权限并输出到CSV
【发布时间】: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


    【解决方案1】:

    收集数据后,您可以将其添加到二维数组,按照您喜欢的方式格式化,然后将其输出到 csv,而不是直接输出到 csv。

    【讨论】:

      猜你喜欢
      • 2020-07-15
      • 1970-01-01
      • 2023-03-16
      • 2018-02-15
      • 1970-01-01
      • 1970-01-01
      • 2015-06-06
      • 2016-02-10
      • 1970-01-01
      相关资源
      最近更新 更多