SQL DisplayName from one of two locations

(imported topic written by tigger0191)

I’m trying to pull the display name of SQL from the registry in an analysis. Here’s what I have so far. I get “This expression could not be parsed”. Can you show me what I’m doing wrong? Thanks.

if (exists value “DisplayName” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server 2005” of native registry) then (value “DisplayName” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server 2005” of registry as string) else if (exists value “DisplayName” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server 2000” of native registry) then (value “DisplayName” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server 2000” of registry as string) else “Not Installed”

(imported comment written by BenKus)

Not sure why you were getting that error…

Does this work?

if (exists value “DisplayName” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server 2005” of native registry) then (value “DisplayName” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server 2005” of registry as string) else if (exists value “DisplayName” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server 2000” of native registry) then (value “DisplayName” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft SQL Server 2000” of registry as string) else “Not Installed”

Ben

(imported comment written by tigger0191)

Yes. That works. Just the plural “keys” then. Thanks Ben. You guys are a real life saver. I’m hoping to get some training dollars in the coming year to take the advanced course for relevance. I need a better understanding of it from the ground up. I woke up thinking that it was likely that you guys have solved this problem before. Do you have a link to a post for general SQL product discovery?

(imported comment written by tigger0191)

I think I found what I need here Ben.

http://forum.bigfix.com/viewtopic.php?id=295

Thanks for your help.