2014-04-12 22:44:39 +00:00
|
|
|
require "tempfile"
|
|
|
|
|
|
|
|
require "vagrant/util/powershell"
|
|
|
|
|
|
|
|
module VagrantPlugins
|
|
|
|
module HostWindows
|
|
|
|
module Cap
|
|
|
|
class RDP
|
|
|
|
def self.rdp_client(env, rdp_info)
|
|
|
|
config = nil
|
|
|
|
opts = {
|
|
|
|
"drivestoredirect:s" => "*",
|
2014-04-12 23:22:35 +00:00
|
|
|
"full address:s" => "#{rdp_info[:host]}:#{rdp_info[:port]}",
|
2014-04-12 22:44:39 +00:00
|
|
|
"prompt for credentials:i" => "1",
|
|
|
|
"username:s" => rdp_info[:username],
|
|
|
|
}
|
|
|
|
|
|
|
|
# Create the ".rdp" file
|
|
|
|
config = Tempfile.new(["vagrant-rdp", ".rdp"])
|
|
|
|
opts.each do |k, v|
|
|
|
|
config.puts("#{k}:#{v}")
|
|
|
|
end
|
|
|
|
config.close
|
|
|
|
|
|
|
|
# Launch it
|
|
|
|
Vagrant::Util::PowerShell.execute("mstsc", config.path)
|
|
|
|
ensure
|
2014-04-12 23:38:01 +00:00
|
|
|
config.close if config
|
2014-04-12 22:44:39 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|