# How to determine windows node OS info in a cookbook?

**URL:** <https://discourse.chef.io/t/how-to-determine-windows-node-os-info-in-a-cookbook/3584>\
**Category:** Chef Infra (archive)\
**Created:** [February 8, 2013, 3:41am UTC](https://discourse.chef.io/t/how-to-determine-windows-node-os-info-in-a-cookbook/3584 "2013-02-08T03:41:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Loron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/peter_loron/32/338_2.png) [@Peter\_Loron](https://discourse.chef.io/u/Peter_Loron)\
**Post date:** [February 8, 2013, 3:41am UTC](https://discourse.chef.io/t/how-to-determine-windows-node-os-info-in-a-cookbook/3584/1 "2013-02-08T03:41:55Z")

</div>

I’m working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?

Thanks.

-Pete

---

<div class="post-metadata">

**Author:** ![Paul\_Morton\_BIA](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/paul_morton_bia/32/480_2.png) [@Paul\_Morton\_BIA](https://discourse.chef.io/u/Paul_Morton_BIA)\
**Post date:** [February 8, 2013, 3:47am UTC](https://discourse.chef.io/t/how-to-determine-windows-node-os-info-in-a-cookbook/3584/2 "2013-02-08T03:47:26Z")

</div>

If the environmental variable programfiles(x86) exists you are on 64 bit windows. This is how the windows cookbook determines the bittedness of the os.

On Feb 7, 2013, at 7:42 PM, "Peter Loron" [peterl@standingwave.org](mailto:peterl@standingwave.org) wrote:

> I'm working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?
> 
> Thanks.
> 
> -Pete

---

<div class="post-metadata">

**Author:** ![Larry\_Wright](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/larry_wright/32/177_2.png) [@Larry\_Wright](https://discourse.chef.io/u/Larry_Wright)\
**Post date:** [February 8, 2013, 3:47am UTC](https://discourse.chef.io/t/how-to-determine-windows-node-os-info-in-a-cookbook/3584/3 "2013-02-08T03:47:49Z")

</div>

You can use node["processor"]["machine"] to detect this. It will return i386 or x86\_64, depending on the whether it is 32 or 64-bit respectively.

On Thursday, February 7, 2013 at 9:41 PM, Peter Loron wrote:

> I'm working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?
> 
> Thanks.
> 
> -Pete

---

<div class="post-metadata">

**Author:** ![Tim\_Smith1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tim_smith1/32/283_2.png) [@Tim\_Smith1](https://discourse.chef.io/u/Tim_Smith1)\
**Post date:** [February 8, 2013, 3:48am UTC](https://discourse.chef.io/t/how-to-determine-windows-node-os-info-in-a-cookbook/3584/4 "2013-02-08T03:48:03Z")

</div>

Try running Ohai on the node to see what attributes are available. That information is deffinetly there.

-Tim

On Feb 7, 2013, at 7:41 PM, Peter Loron [peterl@standingwave.org](mailto:peterl@standingwave.org) wrote:

> I'm working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?
> 
> Thanks.
> 
> -Pete

---

<div class="post-metadata">

**Author:** ![Peter\_Loron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/peter_loron/32/338_2.png) [@Peter\_Loron](https://discourse.chef.io/u/Peter_Loron)\
**Post date:** [February 8, 2013, 4:32pm UTC](https://discourse.chef.io/t/how-to-determine-windows-node-os-info-in-a-cookbook/3584/5 "2013-02-08T16:32:05Z")

</div>

Hi, Larry. This did not seem to be exposed in the cookbook, and I didn't find it when I looked in ohai output either. I'm using Chef 0.11.2, so maybe that was changed?

-pete

On Feb 7, 2013, at 7:47 PM, Larry Wright [larrywright@gmail.com](mailto:larrywright@gmail.com) wrote:

> You can use node["processor"]["machine"] to detect this. It will return i386 or x86\_64, depending on the whether it is 32 or 64-bit respectively.
> 
> On Thursday, February 7, 2013 at 9:41 PM, Peter Loron wrote:
> 
> > I'm working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?
> > 
> > Thanks.
> > 
> > -Pete

---

<div class="post-metadata">

**Author:** ![Peter\_Loron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/peter_loron/32/338_2.png) [@Peter\_Loron](https://discourse.chef.io/u/Peter_Loron)\
**Post date:** [February 8, 2013, 4:32pm UTC](https://discourse.chef.io/t/how-to-determine-windows-node-os-info-in-a-cookbook/3584/6 "2013-02-08T16:32:21Z")

</div>

That did the trick! Thanks Paul.

-pete

On Feb 7, 2013, at 7:47 PM, Paul Morton - BIA [pmorton@biaprotect.com](mailto:pmorton@biaprotect.com) wrote:

> If the environmental variable programfiles(x86) exists you are on 64 bit windows. This is how the windows cookbook determines the bittedness of the os.
> 
> On Feb 7, 2013, at 7:42 PM, "Peter Loron" [peterl@standingwave.org](mailto:peterl@standingwave.org) wrote:
> 
> > I'm working on a cookbook that downloads and installs a MSI. However, I need to know if the node running the cookbook is 32 or 64 bit Windows. Any pointers on this?
> > 
> > Thanks.
> > 
> > -Pete
