How would I incorporate the first relevance that identifies from the registry the profile path of the currently logged on user with the second analysis property for whether Teams is installed for the logged on user and if they are running it? The Teams property works for the most part but if the username has been changed since they first logged onto the system (maiden name changed to married name for example) it fails.
value "ProfileImagePath" of keys whose (name of it = (component string of sid of logged on user whose (active of it = True) as string)) of key "HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList" of native registry as string
if (exists folders "Teams" whose (exists folders "current" whose (exists files whose (name of it = "Teams.exe") of it) of it) of folders "AppData\Local\Microsoft" of folders (name of logged on user whose (active of it = True)) of folders "c:\users") then ( if ( exists process "teams.exe" ) then ( "Running" ) else ( "Not Running" ) ) else ("Not Installed")
I wonder if using the csidl folders might be of use
Q: exists csidl folder 28 whose (not exists file "teams.exe" of folder "\Microsoft\Teams\current" of it)
A: False
T: 1.719 ms
I: singular boolean
Folder 28 is CSIDL_LOCAL_APPDATA so should redirect to the logged in user. You may need to add logic to cater from no logged in user or multiple logged in users
exists folders "Teams" whose ( exists folders "current" of it ) of folders "AppData\Local\Microsoft" of folders ( value "ProfileImagePath" of keys whose ( name of it = ( component string of sid of logged on user whose ( active of it = True ) as string ) ) of key "HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList" of native registry as string )
This does not work
exists folders "Teams" whose ( exists folders "current" whose ( exists files whose ( name of it = "Teams.exe" ) of it ) of it ) of folders "AppData\Local\Microsoft" of folders ( value "ProfileImagePath" of keys whose ( name of it = ( component string of sid of logged on user whose ( active of it = True ) as string ) ) of key "HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList" of native registry as string )
I do like using the ācsidl folderā inspectors to retrieve many of the well-known folder paths on Windows (like āpublicappdataā ), but the ones that depend on a user context may not give the result you want. The value ācsidl folder 28ā gives is for the AppData folder of the LocalSystem user account, not the AppData folder of the logged-on user.
Retrieving the ProfileImagePath is reliable, but I think home directory folder of <user> may be simpler. What makes it slightly confusing is that āuserā and ālogged on userā are actually distinct types, so to get the home directory folder reference one must use home directory folders of users of logged on users
q: (name of it, home directory folders of it) of users of logged on users
A: jwalk, C:\Users\jwalk
We can also shorten this particular query a bit by listing the whole āknown portionā of the folder/file path in one string. I donāt have Teams.exe in that path on my machine, but hereās an example using another file I do have
q: exists files "AppData\Local\Microsoft\WindowsApps\msteams.exe" of home directory folders of users of logged on users
A: True
q: pathnames of files "AppData\Local\Microsoft\WindowsApps\msteams.exe" of home directory folders of users of logged on users
A: C:\Users\jwalk\AppData\Local\Microsoft\WindowsApps\msteams.exe
edit: note there are two very similar inspectors, home directory of <user> gives a string describing the path, while home directory folder of <user> gives an actual folder object.
I apologize for the late reply. Yes I was using the Local Client to evaluate. I will try it on another computer to see if it behaves differently. Iām on the 10.3 client on Windows 11 so maybe that is the issue?
Maybe? I could check later whether that was a problem with that specific versionā¦but this inspector was introduced in 9.5.0ā¦Iāve been using the 10.0.9 client & Debugger on Win10 and Win11 to check this
Hm Windows 11 support was officially introduced on the 10.0.4 client so that could well be it. Iād try upgrading at least one client and see whether that resolves it.
Weird. Wonder if which part is failing can be narrowed down with the following
Q: number of logged on users
A: 2
T: 0.017 ms
Q: exists logged on users
A: True
T: 0.017 ms
Q: exists users of logged on users
A: True
T: 0.016 ms
Q: exists home directory folders of users of logged on users
A: True
T: 0.019 ms
Q: number of logged on users
A: 1
T: 0.019 ms
Q: exists logged on users
A: True
T: 0.018 ms
Q: exists users of logged on users
A: False
T: 0.021 ms
Q: exists home directory folders of users of logged on users
A: False
T: 0.030 ms