diff --git a/CHANGELOG.md b/CHANGELOG.md index ffc6e4938..cfdd79229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ ## 1.6.2 (unreleased) +IMPROVEMENTS: + - command/rdp: Args after "--" are passed directly through to the + RDP client. [GH-3686] ## 1.6.1 (May 7, 2014) diff --git a/plugins/commands/rdp/command.rb b/plugins/commands/rdp/command.rb index 766514bcb..dd431b2cc 100644 --- a/plugins/commands/rdp/command.rb +++ b/plugins/commands/rdp/command.rb @@ -8,8 +8,18 @@ module VagrantPlugins end def execute + options = {} + opts = OptionParser.new do |o| - o.banner = "Usage: vagrant rdp [options] [name]" + o.banner = "Usage: vagrant rdp [options] [name] [-- extra args]" + end + + # Parse out the extra args to send to the RDP client, which + # is everything after the "--" + split_index = @argv.index("--") + if split_index + options[:extra_args] = @argv.drop(split_index + 1) + @argv = @argv.take(split_index) end # Parse the options and return if we don't have any target. @@ -29,6 +39,9 @@ module VagrantPlugins rdp_info = get_rdp_info(machine) raise Errors::RDPUndetected if !rdp_info + # Extra arguments if we have any + rdp_info[:extra_args] = options[:extra_args] + machine.ui.detail( "Address: #{rdp_info[:host]}:#{rdp_info[:port]}") machine.ui.detail("Username: #{rdp_info[:username]}") diff --git a/plugins/hosts/windows/cap/rdp.rb b/plugins/hosts/windows/cap/rdp.rb index eaa98e2d6..e2278569a 100644 --- a/plugins/hosts/windows/cap/rdp.rb +++ b/plugins/hosts/windows/cap/rdp.rb @@ -22,8 +22,14 @@ module VagrantPlugins end config.close + # Build up the args to mstsc + args = [config.path] + if rdp_info[:extra_args] + args = rdp_info[:extra_args] + args + end + # Launch it - Vagrant::Util::PowerShell.execute("mstsc", config.path) + Vagrant::Util::PowerShell.execute("mstsc", *args) ensure config.close if config end