Const HKLM = &h80000002 Const profiles = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" Set sh = CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") Set wmi = GetObject("winmgmts://./root/cimv2") Set reg = GetObject("winmgmts://./root/default:StdRegProv") reg.EnumKey HKLM, profiles, subkeys For Each sid In subkeys reg.GetStringValue HKLM, profiles & "\" & sid, "ProfileImagePath", path path = sh.ExpandEnvironmentStrings(path) If fso.FolderExists(path) Then Set acct = wmi.Get("Win32_SID.SID='" & sid & "'") WScript.Echo acct.ReferencedDomainName & "\" & acct.AccountName End If Next
ReferencedDomainName & "\" & Accountname
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)