开发者

powershell convert objectsid to sid

开发者 https://www.devze.com 2023-01-16 15:21 出处:网络
Hallo. If I run this code $server = \".\" $adsi = [ADSI]\"WinNT://$server\" $adsi.psbase.children | where {$_.schemaClassName -match \"user\"} | select name, objectsid |Format-Table -auto

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

精彩评论

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