Skip to content

Instantly share code, notes, and snippets.

@nhed
Last active August 2, 2016 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nhed/ec3f6b490f712fc90bf0e43a072c67a0 to your computer and use it in GitHub Desktop.
Save nhed/ec3f6b490f712fc90bf0e43a072c67a0 to your computer and use it in GitHub Desktop.
RDP Snippet for LinCastor
#!/usr/bin/env bash
#
# LinCastor Helper for launching microsoft remote desktop on OSX from commandline
#
# Executed with lincastor (https://onflapp.wordpress.com/lincastor/)
# Lincastor RDP config:
# - title: RDP
# - choose one of the handlers: shell
# - shell body: exec ~/bin/rdp_launcher.sh
#
# Usage:
# open rdp://lab@10.12.115.34:22372
#
# Notes:
# - RDP file created from jtemplate just the first run
# - Not saving password if provided in URL as not sure how to relay it to RDP app (exported
# rdp files do not contain them nor would it be a good idea to list in plain text)
# - Obviously feel free to play with different default values in the template or
# modify generated files in ~/Documents/RDP
declare RDP_APP="/Applications/Microsoft Remote Desktop.app"
declare RDP_DIR=~/Documents/RDP
[ -d "${RDP_DIR}" ] || mkdir -p "${RDP_DIR}"
declare RDP_FILE="${RDP_DIR}/${URL_VALUE}.rdp"
[ -z "${URL_PORT}" ] && URL_PORT=3389
if [ ! -e "${RDP_FILE}" ]; then
cat<<__EOF__ > "${RDP_FILE}"
screen mode id:i:2
use multimon:i:0
session bpp:i:24
full address:s:${URL_HOST}:${URL_PORT}
audiomode:i:0
username:s:${URL_VALUE/[:@]*/}
disable wallpaper:i:0
disable full window drag:i:0
disable menu anims:i:0
disable themes:i:0
alternate shell:s:
shell working directory:s:
authentication level:i:2
connect to console:i:0
gatewayusagemethod:i:0
disable cursor setting:i:0
allow font smoothing:i:1
allow desktop composition:i:1
redirectprinters:i:0
prompt for credentials on client:i:0
__EOF__
fi
open "${RDP_APP}" "${RDP_FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment