vagrant/plugins/hosts/windows/cap/rdp.rb
oss-core-libraries-dashboard[bot] 73228596f4
[COMPLIANCE] Update Copyright and License Headers (Batch 3 of 7) (#13763)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2025-12-22 16:46:39 +05:30

33 lines
876 B
Ruby

# Copyright IBM Corp. 2010, 2025
# SPDX-License-Identifier: BUSL-1.1
require "pathname"
require "tmpdir"
require "vagrant/util/subprocess"
module VagrantPlugins
module HostWindows
module Cap
class RDP
def self.rdp_client(env, rdp_info)
# Setup password
cmdKeyArgs = [
"/add:#{rdp_info[:host]}:#{rdp_info[:port]}",
"/user:#{rdp_info[:username]}",
"/pass:#{rdp_info[:password]}",
]
Vagrant::Util::Subprocess.execute("cmdkey", *cmdKeyArgs)
# Build up the args to mstsc
args = ["/v:#{rdp_info[:host]}:#{rdp_info[:port]}"]
if rdp_info[:extra_args]
args = rdp_info[:extra_args] + args
end
# Launch it
Vagrant::Util::Subprocess.execute("mstsc", *args, {:detach => true})
end
end
end
end
end