我使用 PowerView 枚举活动目录,并且我SecurityIdentifiers
想使用 PowerView 函数将其转换为可读名称的集合Convert-SidToName
。我希望 Powershell 能够以某种方式将这些值传递给函数,但无法弄清楚如何:
PS C:\Users\Administrator\Desktop> Get-ObjectAcl -Identity "DnsAdmins" | ? {$_.ActiveDirectoryRights -eq "GenericAll" } | select SecurityIdentifier
SecurityIdentifier
------------------
S-1-5-21-976142013-3766213998-138799841-512
S-1-5-32-548
S-1-5-18
S-1-5-21-976142013-3766213998-138799841-519
就像是:
PS C:\Users\Administrator\Desktop> Get-ObjectAcl -Identity "DnsAdmins" | ? {$_.ActiveDirectoryRights -eq "GenericAll" } | select SecurityIdentifier | Convert-SidToName
只是给出语法错误:
ConvertFrom-SID : Cannot validate argument on parameter 'ObjectSid'. The argument
"@{SecurityIdentifier=S-1-5-21-976142013-3766213998-138799841-519}" does not match the "^S-1-.*" pattern. Supply an
argument that matches "^S-1-.*" and try the command again.