# Is\_package\_installed?

**URL:** <https://discourse.chef.io/t/is-package-installed/12851>\
**Category:** Chef Infra (archive)\
**Created:** [April 1, 2018, 5:54am UTC](https://discourse.chef.io/t/is-package-installed/12851 "2018-04-01T05:54:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elikatz](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@elikatz](https://discourse.chef.io/u/elikatz)\
**Post date:** [April 1, 2018, 5:54am UTC](https://discourse.chef.io/t/is-package-installed/12851/1 "2018-04-01T05:54:59Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![elikatz](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@elikatz](https://discourse.chef.io/u/elikatz)\
**Post date:** [April 2, 2018, 1:24pm UTC](https://discourse.chef.io/t/is-package-installed/12851/2 "2018-04-02T13:24:25Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![oirizarry](https://avatars.discourse-cdn.com/v4/letter/o/ea666f/32.png) [@oirizarry](https://discourse.chef.io/u/oirizarry)\
**Post date:** [April 3, 2018, 5:14pm UTC](https://discourse.chef.io/t/is-package-installed/12851/4 "2018-04-03T17:14:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![elikatz](https://avatars.discourse-cdn.com/v4/letter/e/e5b9ba/32.png) [@elikatz](https://discourse.chef.io/u/elikatz)\
**Post date:** [April 3, 2018, 6:21pm UTC](https://discourse.chef.io/t/is-package-installed/12851/5 "2018-04-03T18:21:43Z")

</div>

PERFECT! Thank you!
