Using Windows "Current User" environment variable in relevance

(imported topic written by macook91)

Hello,

I am having trouble trying to figure out how to use the “userprofile” inside a relevance expression. I want to write the expression:

number of logged on users > 0 AND not exists file (value of variable “userprofile” of environment & “\Start Menu\Some_Folder\Some_File.lnk”)

This works fine in the relevance debugger. The problem is, that the BigFix client is running as system, not as the current user. So when it goes to check “userprofile” it is checking the user profile for the system account not for the current user’s logon. This issue can easily be worked around when you’re typing in an action script, but not in a relevance expression.

Any ideas?

(imported comment written by macook91)

not exists file (profile folder of current user as string & “\Desktop\Resource25.RDP”)

not exists file (profile folder of logged on user as string & “\Desktop\Resource25.RDP”)

Neither of these work even though the Windows Inspector guide implies that they will do exactly what I want.

(imported comment written by macook91)

This major hack works, we’ve got to have something better than this. The profile folder information from the wininspector is flat out not working.

number of logged on users > 0 AND not exists file (value of variable “SystemDrive” of environment & ((following text of first “e%25” of it)of (preceding text of last “%00” of it) of (value “ProfileImagePath” of key (“HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList” & (component string of sid of domain user (name of current user))) of registry as string)) & “\Desktop\Resource25.RDP”)

(imported comment written by NoahSalzman)

The “profile folder” issue is bug 28536… it may work on Microsoft server OSes, but it is definitely broken on desktop OSes.

However, you can do something like this:

preceding text of last “” of (expand environment string of “%25USERPROFILE%25”) & “” & name of logged on user & “\Desktop\Resource25.RDP”

(imported comment written by macook91)

Thanks for the very quick response. I have implemented my self proclaimed “hack” code for now and it seems to be working. Will look forward to the fix for the bug.