如题,在论坛找到,改了一下,功能是返回用户的SID
$UserName="administrator"
MsgBox(64,"",GetSID($UserName)
Func GetSID($user)
;~ $user = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName") ;取当前登录用户的名称
$objWMIService = ObjGet("winmgmts:\\" & "localhost" & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_UserAccount", "WQL")
For $objItem In $colItems
$username = StringSplit($objItem.Caption, "\", 1)
If $username[2] = $user Then
Return $objItem.SID
EndIf
next
EndFunc
posted on 2008-01-17 11:35
疾风随影 阅读(964)
评论(0) 编辑 收藏 引用 所属分类:
AutoIT column