Registry_key resource dislikes spaces?

I am trying to use the registry_key resource on windows in order to identify what type of Symantec is installed on a machine in order to pull down the proper package to upgrade. The registry path includes “Symantec Endpoint Protection”, which results in a registry key does not exist error from chef (the registry entry in question has been confirmed to exist via regedit).

Since I tested out the same code with a registry path that had no spaces and it worked, I’m wondering if the spaces in the path are causing the problem and if so, why is that because the documentation uses examples with spaces. Is this a case in which chef is only looking for a single space and when it hits two, it breaks?

To clarify: I am getting a registry key does not exist error from the registry_get_values line in the following portion of my script:
KEY_PATH = 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Symantec\Symantec Endpoint Protection\SMC\SYLINK\Sylink\CurrentGroup’
ARCHITECTURE = ':x86_64’
reg_value = registry_get_values(KEY_PATH, ARCHITECTURE)

Are you referring to the registry functions in the recipe DSL or the registry_key resource? If the latter, what action are you using?

I clarified it in my edit, but it is the registry_get_values() function. Picking a value from the path up to ‘Symantec’ works. Once ‘Symantec Endpoint Protection’ is added, chef just throws “key does not exist” errors.

Out of curiosity I ran chef-apply against a file containing:

KEY_PATH = 'HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Advanced INF Setup\IE CompList'
ARCHITECTURE = ':x86_64'
reg_value = registry_get_values(KEY_PATH, ARCHITECTURE)
puts reg_value

And it seemed to work fine. Not sure why your script is having issues. I’m assuming based on your other info that running:

Test-Path 'HKLM:\SOFTWARE\Wow6432Node\Symantec\Symantec Endpoint Protection\SMC\SYLINK\Sylink\CurrentGroup'

in basic powershell returns True?

The path in powershell returns false; I am looking into what may be causing that since the path is easily found via regedit, so this is likely being caused by a permissions issue.

Okay, so the solution that I ended up using was to entirely remove all built-in chef registry_key functions and just use powershell to find the key, pipe it to file, then read it into a variable in chef (note: the “Wow6432Node” part is removed for Server OS, present on desktop OS):

powershell_script ‘FindRegKey’ do
code <<-EOH
$key = ‘HKLM:\SOFTWARE\Symantec\Symantec Endpoint Protection\SMC\SYLINK\SyLink’
(Get-ItemProperty -Path $key).PreferredGroup | Out-File C:\#{foldername}\#{outfile} -Encoding "UTF8"
EOH
end
regKey = ::File.read(“C:\#{foldername}\#{outfile}”)