Singular expression refers to nonexistent object

(imported topic written by SystemAdmin)

Greetings.

We’re writing an analysis that determines if the Google Desktop Search Engine is installed, and if so, is it currently indexing user email. Here’s what we’re using:

if (exists key “HKLM\Software\Google\Desktop” of registry) then (if (exists file (value “data_dir” of key “HKEY_CURRENT_USER\Software\Google\Google Desktop” of registry as string & “\outlook_data”)) then (“Google Desktop installed. Outlook Index = YES”) else (“Google Desktop installed. Outlook Index = NO”)) else (“No Google Desktop”)

On machines where the index file exists, the result is - Singular expression refers to nonexistent object. We can manually verify that the file is, in fact, there. When we run this relevance through QnA, local to the machine that has the index file, it works just fine. It only appears to fail when we deploy it through BigFix as an analysis.

Everything else seems to work fine - It will report if the GDSE does not exist, and will report where it does exist but the index is not present.

Any help is greatly appreciated.

(imported comment written by SystemAdmin)

Hey Mike,

It seems like you are checking two different registry keys, the first and second key paths don’t match:

  1. exists key “HKLM\Software\Google\Desktop” of registry

  2. value “data_dir” of key “HKEY_CURRENT_USER\Software\Google\Google Desktop” of registry

I would do the existence check like this:

exists key “HKEY_CURRENT_USER\Software\Google\Google Desktop” whose (exists value “data_dir” of it) of registry

(imported comment written by SystemAdmin)

I considered that, but I thought that since the second “if” was nested, it wouldn’t matter. It’s an easy enough change to make, and test. Right now, I’m more inclined to think that this has something to do with the fact that I’m looking at HKCU. The “sticky” at the top of the Fixlet Authoring forum discusses this, and it sounds like it could be an issue.

(imported comment written by SystemAdmin)

Oh yeah, I missed that! See the sticky for how to inspect the HKCU branch

(imported comment written by SystemAdmin)

Ok. I tried that. (or think I did.)

if (exists key “HKLM\Software\Google\Desktop” of registry) then (if (exists file (value “data_dir” of keys “HKEY_CURRENT_USER\Software\Google\Google Desktop” of current user keys (logged on users) of registry as string & “\outlook_data”)) then (“Google Desktop installed. Outlook Index = YES”) else (“Google Desktop installed. Outlook Index = NO”)) else (“No Google Desktop”)

Now it errors on both the YES and NO machines.

(imported comment written by BenKus)

Hey Mike,

What error are you getting?

Ben

(imported comment written by SystemAdmin)

While I have not looked at each and every one, it still appears to be Singular expression refers to nonexistent object.

(imported comment written by jessewk)

plurality is your friend… also you are still querying HKCU directly which won’t work because the client runs in system context.

Try this:

if (exists key “HKLM\Software\Google\Desktop” of registry) then (if (exists files (values “data_dir” of keys “Software\Google\Google Desktop\outlook_data” of current user keys (logged on users) of registry)) then (“Google Desktop installed. Outlook Index = YES”) else (“Google Desktop installed. Outlook Index = NO”)) else (“No Google Desktop”)

(imported comment written by SystemAdmin)

I don’t think that will work. “outlook_data” is the name of a file. Because the location of this file will be different for every user, with Google creating a randomly named folder, I’m pulling the location from the registry key. So the key in your relevance doesn’t exist.