Module: Chef::Mixin::PowershellExec
- Included in:
- DSL::Universal
- Defined in:
- lib/chef/mixin/powershell_exec.rb
Instance Method Summary collapse
-
#powershell_exec(script) ⇒ Chef::PowerShell
Run a command under PowerShell via a managed (.NET) COM interop API.
-
#powershell_exec!(script) ⇒ Object
The same as the #powershell_exec method except this will raise Chef::PowerShell::CommandFailed if the command fails.
Instance Method Details
#powershell_exec(script) ⇒ Chef::PowerShell
Run a command under PowerShell via a managed (.NET) COM interop API. This implementation requires the managed dll to be registered on the target machine.
Requires: .NET Framework 4.0 or higher on the target machine.
101 102 103 |
# File 'lib/chef/mixin/powershell_exec.rb', line 101 def powershell_exec(script) Chef::PowerShell.new(script) end |
#powershell_exec!(script) ⇒ Object
The same as the #powershell_exec method except this will raise Chef::PowerShell::CommandFailed if the command fails
107 108 109 110 111 |
# File 'lib/chef/mixin/powershell_exec.rb', line 107 def powershell_exec!(script) cmd = Chef::PowerShell.new(script) cmd.error! cmd end |