Hi @AurimasNav,
You could also use powershell_out mixin. There was already a discussion around this here:
The powershell_out is more expensive approach but since you are shelling out you can parse the stderr and return codes.
Either you choose the powershell_exec or the powershell_out you beed to include their proper mixin:
require "chef/mixin/powershell_out"
include Chef::Mixin::PowershellOut
script = <<-EOH
# your_awsome_ps_script
EOH
result = powershell_out(script)
require "chef/mixin/powershell_exec"
include Chef::Mixin::PowershellExec