Powershell: Export User Rights Assignment

后端 未结 2 787
夕颜
夕颜 2021-01-22 07:12

I\'m new to PowerShell (PS). Currently I\'m using windows server 2012 and I\'m interested to know whether there is any way to export User Rights Assignment into a t

2条回答
  •  清歌不尽
    2021-01-22 07:59

    Great script overall. Thank you for your efforts. One change I needed to make however to get it to output all principals assigned a right was to change the regex to '^(Se\S+) = (.+)' so that principals that were already resolved with a space in the name such as 'Domain users' were matched. Before that it would just report 'Domain.'

    To save the output to a file, add a >> filename after the closing bracket of the last foreach-object Ex: } } >> 'outFile.txt'

    or to output as delimited file (e.g., csv) use the following:

    } | convertto-csv -delimiter '~' -notypeinformation >> 'outFile.txt'

    Hope this helps.

提交回复
热议问题