I have this function that takes the last user that started session on a PC.
Function GetLastLogon
Dim LastLogonUser
Dim Count
Dim Final
Dim VFInal
LastLogonUser =objRegistry.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser")
Count=InStr(LastLogonUser,"\")
Final = Count + 1
VFInal=Mid(LastLogonUser,Final)
GetLastLogon = VFinal
End Function
I was wondering if there is any way to make a list of all the users that have accessed a single machine, because the function only shows the last user.
What occurred to me is the following, access the users folder and look there.
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFile = objFS.GetFolder("C:\Users")
set subfolder = objFile.subFolders
For each Name in subfolder
Wscript.Echo(Name)
next
Then he asks me if there is any other way to do it that we can access the users folder? I've been looking all morning but found.