Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def run_powershell(powershell_command)
- puts %Q-Executing powershell #{powershell_command}-
- output = system("powershell.exe #{powershell_command}")
- puts "Executed powershell output #{output}"
- end
- success = system("powershell.exe #{powershell_command}")
- if success then
- ...
- end
- output = `powershell.exe #{powershell_command}`
- success = $?.exitstatus == 0
- output = IO::popen(["powershell.exe", powershell_command]) {|io| io.read}
- success = $?.exitstatus == 0
- def powershell_output_true?()
- ps_command = "(1+1) -eq 2"
- cmd_str = "powershell -Command " " + ps_command + " " "
- cmd = shell_out(cmd_str, { :returns => [0] })
- if(cmd.stdout =~ /true/i)
- Chef::Log.debug "PowerShell output is true"
- return true
- else
- Chef::Log.debug "PowerShell output is false"
- return false
- end
- end
Add Comment
Please, Sign In to add comment