Permalink
Browse files

[COOK-581] force 64-bit powershell process from 32-bit ruby processes

  • Loading branch information...
1 parent e1e3f1b commit c6df8261d3adfd7b44cb8fc394d013b1a627f7ae @schisamo schisamo committed Jun 14, 2011
Showing with 12 additions and 1 deletion.
  1. +12 −1 powershell/libraries/core.rb
@@ -31,10 +31,21 @@ def initialize(name, run_context=nil)
super
@resource_name = :powershell
@provider = Chef::Provider::PowershellScript
- @interpreter = "powershell.exe"
+ @interpreter = locate_powershell_interperter
@returns = [0,42] # successful commands return exit code 42
end
+ private
+ def locate_powershell_interperter
+ # force 64-bit powershell from 32-bit ruby process
+ if ::File.exist?("c:/windows/sysnative/WindowsPowershell/v1.0/powershell.exe")
+ "c:/windows/sysnative/WindowsPowershell/v1.0/powershell.exe"
+ elsif ::File.exist?("c:/windows/system32/WindowsPowershell/v1.0/powershell.exe")
+ "c:/windows/system32/WindowsPowershell/v1.0/powershell.exe"
+ else
+ "powershell.exe"
+ end
+ end
end
end

0 comments on commit c6df826

Please sign in to comment.