I’m trying to get the combined/concatinated results of a relevance query back for ‘if some software is installed, and if so, what’s the version and running status’. Here’s the two queries separate that work, and then combined that returns “A singular expression is required.”. I’m used to working in Unix, so the Windows relevance is new to me.
Works: if (exists keys whose(exists (values “DisplayName” of it as string as lowercase, version of it) whose(it contains “chef client” as lowercase) ) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (if (x64 of operating system) then (x32 registry ; x64 registry) else (x32 registry))) then (values “DisplayVersion” of (keys whose(exists (values “DisplayName” of it as string as lowercase) whose(it contains “chef client” as lowercase) ) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (if (x64 of operating system) then (x32 registry ; x64 registry) else (x32 registry))) as string) as trimmed string else “Not Installed”
Works: if exists service “chef-client” then “Running” else “Not Running”
Returns the error: if (exists keys whose(exists (values “DisplayName” of it as string as lowercase) whose(it contains “chef client” as lowercase) ) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (if (x64 of operating system) then (x32 registry ; x64 registry) else (x32 registry))) then (values “DisplayVersion” of (keys whose(exists (values “DisplayName” of it as string as lowercase) whose(it contains “chef client” as lowercase) ) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (if (x64 of operating system) then (x32 registry ; x64 registry) else (x32 registry))) as string) & " | " & (if exists service “chef-client” then “Running” else “Not Running”) else “Not installed”