Hi
I'd very much like to do exactly what the following script does, just from inside VB!
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
JUST go through the SID keys in ProfileList and pull out the
ReferencedDomainName & "\" & Accountname
I'm sure some of you guys will find it trivial but I cannot make it work :-/
With Kind regards and high hopes
Samoht