Enhanced User Name Property

(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 “”

(imported comment written by StacyLee)

I am wondering what load this puts on the comptuer when run continuosly?

Sounds great i know some people here would be interested in using this.

(imported comment written by SystemAdmin)

We had the same need, so I wrote this property that uses the registry to see who last logged on:

if 
   exists current user 
 then 
   name of current user 
 else 
   if 
 (
   name of operating system as lowercase starts with "win"
 )
   then 
 (
   if 
     exists key "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\" of registry 
    and 
     value "DefaultUserName" of key "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\" of registry as string != "" 
   then 
     (
       value "DefaultUserName" of key "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\" of registry as string
     )
   else 
     "<unknown>"
 )
   else 
 "<unknown>"

(imported comment written by SystemAdmin)

Using the DefaultUserName would be more efficient and cut out most of the overhead. I might switch over to your solution.