(imported topic written by SystemAdmin)
The current “User Name” Property returns “” if a user is not logged onto a system. In our environment ~10% of the systems were showing which can be a problem if you’re trying to track down a user or you want reports to show user names for all the systems. I created a Fixlet that caches the last logged on user in the registry. Then I created a new property “Username” that retrieves the User name from the registry if a user is not currently logged in; it also appends ‘-’ to the end of the user name if it was retrieve from the registry so you know that user was not logged in.
FIXLET
The Fixlet runs continuously on all the workstations and is automatically reapplied an unlimited number of times.
Relevance:
(operating system as string as lowercase starts with “win”) AND (length of name of current user > 1) AND ((not exists key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\User” of registry) OR (not ((value of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\User” of registry as string as lowercase) = (name of current user as lowercase))))
Action: regset "
HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\User
" “value”="{name of current user}"
USERNAME PROPERTY
IF ((exists current user) AND (length of name of current user > 1)) THEN (name of current user) ELSE IF (exists key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\User” of registry) THEN (value of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix\EnterpriseClient\Settings\Client\User” of registry as string & “-”) ELSE “”