To show the last logged in USER name (restrict character)

We have created a custom property to capture the User name for the Windows 7 asset. But we need to restrict the user letters to 7 character for display. Could someone help us on this.

The custom property we have created is the below.

user windows

(following text of last “|” of concatenation “|” of ( tuple string items 1 of ( ( ( concatenation “,” of substrings separated by “,” of ( it as string ) ) of ( unique values of ( ( ( ( year of it as string & month of it as two digits & day_of_month of it as two digits ) of dates ( local time zone ) of modification time of it,name of parent folder of it ) of files “NTUSER.DAT” of folders whose ( name of it as lowercase is not contained by ( “networkservice|localservice|default|public|mssql$sqlexpr2012|srv0458|srv0572|srv0383|srv0510|adm5574|db2admin” ) ) of folder “c:\users” ) as string ) ) ) ) ) ) | ( concatenation of ( tuple string items 1 of ( ( ( concatenation “,” of substrings separated by “,” of ( it as string ) ) of ( unique values of ( ( ( ( year of it as string & month of it as two digits & day_of_month of it as two digits ) of dates ( local time zone ) of modification time of it,name of parent folder of it ) of files “NTUSER.DAT” of folders whose ( name of it as lowercase is not contained by ( “networkservice|localservice|default|public|mssql$sqlexpr2012|srv0458|srv0572|srv0383|srv0510|adm5574|db2admin” ) ) of folder “c:\users” ) as string ) ) ) ) ) ) | ( following text of last “|” of concatenation “|” of ( tuple string items 1 of ( ( ( concatenation “,” of substrings separated by “,” of ( it as string ) ) of ( unique values of ( ( ( ( year of it as string & month of it as two digits & day_of_month of it as two digits ) of dates ( local time zone ) of modification time of it,name of parent folder of it ) of files “NTUSER.DAT” of folders whose ( name of it as lowercase is not contained by ( “networkservice|localservice|default|public|srv0191|mssql$sqlexpr2012|srv0458|srv0572|srv0383|srv0510|adm5574|db2admin” ) ) of folder “c:\Documents and Settings” ) as string ) ) ) ) ) ) | ( concatenation of ( tuple string items 1 of ( ( ( concatenation “,” of substrings separated by “,” of ( it as string ) ) of ( unique values of ( ( ( ( year of it as string & month of it as two digits & day_of_month of it as two digits ) of dates ( local time zone ) of modification time of it,name of parent folder of it ) of files “NTUSER.DAT” of folders whose ( name of it as lowercase is not contained by ( “networkservice|localservice|default|public|srmssql$sqlexpr2012|srv0458|srv0572|srv0383|srv0510|adm5574|db2admin” ) ) of folder “c:\Documents and Settings” ) as string ) ) ) ) ) ) | (“None”)

Yikes, I’m not going to break into that relevance, but I’ll point toward

first 7 of <string>

Thanks for the string.

fyi - in case it’s useful, there’s a ‘User Management’ dashboard in BigFix labs.

Do you mean the Local user management Dashboard available in the Bigfix lab

I found this some time back … More for AD joined machines but it works for our application.

if (name of operating system as lowercase contains “win”) then (if ((name of operating system as lowercase contains “xp”) or (name of operating system as lowercase contains “win2003”)) then (if not exist keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName” of (if x64 of operating system then (x64 registry;x32 registry) else registry) then values “DefaultUserName” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon” of (if x64 of operating system then (x64 registry;x32 registry) else registry) as string else “No User Logged”) else (if NOT exist keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\LastLoggedOnUser” of (if x64 of operating system then (x64 registry;x32 registry) else registry) then values “LastLoggedOnUser” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI” of (if x64 of operating system then (x64 registry;x32 registry) else registry) as string else “No User Logged”)) else (“Not Win”)

Is there a way to fetch the login time for the last logged in users.