clean up command encoding
This commit is contained in:
parent
47e57a7cd9
commit
cf6d4ef5a1
|
@ -22,21 +22,13 @@ module VagrantPlugins
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
logger.debug("Starting remote powershell with command:\n#{command}")
|
logger.debug("Starting remote powershell with command:\n#{command}")
|
||||||
command = command.chars.to_a.join("\x00").chomp
|
|
||||||
command << "\x00" unless command[-1].eql? "\x00"
|
|
||||||
if(defined?(command.encode))
|
|
||||||
command = command.encode('ASCII-8BIT')
|
|
||||||
command = Base64.strict_encode64(command)
|
|
||||||
else
|
|
||||||
command = Base64.encode64(command).chomp
|
|
||||||
end
|
|
||||||
|
|
||||||
args = ["-NoProfile"]
|
args = ["-NoProfile"]
|
||||||
args << "-ExecutionPolicy"
|
args << "-ExecutionPolicy"
|
||||||
args << "Bypass"
|
args << "Bypass"
|
||||||
args << "-NoExit"
|
args << "-NoExit"
|
||||||
args << "-EncodedCommand"
|
args << "-EncodedCommand"
|
||||||
args << command
|
args << ::WinRM::PowershellScript.new(command).encoded
|
||||||
if ps_info[:extra_args]
|
if ps_info[:extra_args]
|
||||||
args << ps_info[:extra_args]
|
args << ps_info[:extra_args]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue