开发者

powershell convert objectsid to sid

Hallo. If I run this code

$server = "."
$adsi = [ADSI]"WinNT://$server" 
$adsi.psbase.children | where {$_.schemaClassName -match "user"} | select name, objectsid |Format-Table -auto

I get object sid in this form

1 5 0 0 0 0 0 5 21 0 0 0 138 93 63 151 163 49 215 2 60 164 164 50 236 3 0 0

I'd like to know if it's possible to convert 开发者_开发问答it to get the same result that you have from win32_useraccount class. Thanks in advance


$adsi.psbase.children | where {$_.schemaClassName -match "user"} | foreach-object{    
  $account = New-Object Security.Principal.NTAccount $_.name
  $account.Translate( [Security.Principal.Securityidentifier] ).Value
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜