Is_package_installed?


#1

Hi all,

Im trying to use the following in one of my receipes (using the windows cookbook):
::Chef::Recipe.send(:include, Windows::Helper)
TelnetClient_installed = is_package_installed?(‘Telnet-Client’)

For some reason it keep returing nil - am I using it right?

Thanks!


#2

Just realized this is showing installed programs (from the add/remove programs), not installed windows features…
Is there an easy way to check if a windows feature is installed?


#4

You could use powershell_out with a command similar to this (Get-WindowsFeature FeatureName).Installed

script = ‘(Get-WindowsFeature FeatureNameName).Installed’
result = powershell_out(script).stdout.chop

Result will be either the string True or False.


#5

PERFECT! Thank you!