FAQ
Hey Oliver,

I finally got around to working on this today, and discovered I fixed it
long ago and completely forgot to push the change to github. oops :)

Looks like I took a different approach.

https://github.com/adenning/winfacts/blob/master/lib/facter/os_architecture.rb

I only run Puppet on Windows 7 and XP nodes (yeah that's right), but I can
confirm this handles 32-bit OS on x64 and accounts for some variations I
ran into with various embedded Windows.

Adam
On Friday, November 30, 2012 9:27:05 AM UTC-6, r0k5t4r wrote:

Hi Adam,

The class Win32_OperatingSystem<http://msdn.microsoft.com/en-us/library/aa394239%28VS.85%29.aspx>exists on Vista and above. For older systems you can use
Win32_ComputerSystem<http://msdn.microsoft.com/en-us/library/aa394102%28VS.85%29.aspx>.
I found this information here:


http://www.adminarsenal.com/admin-arsenal-blog/bid/19689/Determining-OS-Architecture

The following minor change did the trick for windows 2003.

Facter.add(:os_architecture) do
confine :operatingsystem => :windows
setcode do
result = ''
require 'win32ole'
wmi = WIN32OLE.connect('winmgmts://./root/CIMV2')
winver = Facter.value('kernelmajversion')
case winver
when /5.2|5.1|5.0/
query = wmi.ExecQuery('select SystemType from
Win32_ComputerSystem')
query.each do |os|
result = os.SystemType
break
end
if result == "X86-based PC"
result = "32-bit"
else
result = "64-bit"
end
result
else
query = wmi.ExecQuery('select OSArchitecture from
Win32_OperatingSystem')
query.each do |os|
result = os.OSArchitecture
break
end
result
end
end
end

Have a nice weekend.

On Friday, November 30, 2012 2:16:11 PM UTC+1, r0k5t4r wrote:

Hi Adam,

thanks a lot. I have successfully implemented your or_architecture fact
on our machines. But it looks like it is not workung under Windows 2003
32Bit.I have to check this...

Regards,
Oli
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/dwLVirsRsswJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 8 of 8 | next ›
Discussion Overview
grouppuppet-users @
categoriespuppet
postedNov 21, '12 at 4:08p
activeDec 6, '12 at 7:51p
posts8
users3
websitepuppetlabs.com

3 users in discussion

R0k5t4r: 4 posts Ad: 3 posts Josh Cooper: 1 post

People

Translate

site design / logo © 2023 Grokbase