public override void ExecuteCmdlet()
        {
            DownloadRDPFileOptions options = new DownloadRDPFileOptions(this.BatchContext, this.PoolName, this.VMName,
                this.VM, this.DestinationPath, this.DestinationStream, this.AdditionalBehaviors);

            this.BatchClient.DownloadRDPFile(options);
        }
        /// <summary>
        /// Downloads an RDP file using the specified options.
        /// </summary>
        /// <param name="options">The download options</param>
        public void DownloadRDPFile(DownloadRDPFileOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (options.Stream != null)
            {
                // Don't dispose supplied Stream
                CopyRDPStream(options.Stream, options.Context.BatchOMClient, options.PoolName, options.VMName, options.VM, options.AdditionalBehaviors);
            }
            else
            {
                string vmName             = options.VM == null ? options.VMName : options.VM.Name;
                string verboseLogFileName = string.Format("for vm {0}", vmName);
                WriteVerbose(string.Format(Resources.Downloading, "RDP", verboseLogFileName, options.DestinationPath));

                using (FileStream fs = new FileStream(options.DestinationPath, FileMode.Create))
                {
                    CopyRDPStream(fs, options.Context.BatchOMClient, options.PoolName, options.VMName, options.VM, options.AdditionalBehaviors);
                }
            }
        }
        /// <summary>
        /// Downloads an RDP file using the specified options.
        /// </summary>
        /// <param name="options">The download options</param>
        public void DownloadRDPFile(DownloadRDPFileOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (options.Stream != null)
            {
                // Don't dispose supplied Stream
                CopyRDPStream(options.Stream, options.Context.BatchOMClient, options.PoolName, options.VMName, options.VM, options.AdditionalBehaviors);
            }
            else
            {
                string vmName = options.VM == null ? options.VMName : options.VM.Name;
                string verboseLogFileName = string.Format("for vm {0}", vmName);
                WriteVerbose(string.Format(Resources.Downloading, "RDP", verboseLogFileName, options.DestinationPath));

                using (FileStream fs = new FileStream(options.DestinationPath, FileMode.Create))
                {
                    CopyRDPStream(fs, options.Context.BatchOMClient, options.PoolName, options.VMName, options.VM, options.AdditionalBehaviors);
                }
            }
        }