On October 18th Microsoft released version 8 of it’s Remote Desktop app via the App Store. Which is great as the older version had been more than buggy & we’ve just started a project which requires users to RDP into VM’s.
Below are the steps taken to figure out how a connection is created and stored, as well as a way to script the connections.
Contents
Investigation
Following Rich Troutons excellent steps I managed to download a copy that is App Store account free.
Next steps was to figure out how to deploy connections to this app. Well, that’d be a simple plist in ~/Library/Preferences right? Nope! Remember this is Microsoft (the people whom use a plist in the format of the windows registry…), so off armed with TextWrangler, Composer & steely determination I went about figuring this thing out.
I loaded up Composer & ran “Monitor File System Changes” then preceded to create a connection in Microsoft Remote Desktop. it appears that the path of the plist is indeed not standard & exists in: ~/Library/Containers/com.microsoft.rdc.mac/Data/Library/Preferences/com.microsoft.rdc.mac.plist
UPDATE: As per the comments below, it appears for Mac App Store application plists is always in this location
A Quick Look in Finder of the plist showed that at the top there is an array which contains a UUID for each Connection.
This UUID string is then used within each key to differentiate settings between connections.
Luckily enough the UUID seems to be generated using the simple command below & so can easily be scripted using:
uuidgen
From there on it’s pretty straightforward to create a script, below is the GUI with the variable names as per the script which can be found on at the bottom of this post
Examples of variables to pass can be seen in my Casper Remote window below:
In the above example I have left the UUID field blank, which will create one when the script runs. You could specify your own UUID by generating one via the uuidgen command above & thus give you the ability to easily update a Connections settings down the line.
Once the above is run, the connection should appear My desktops section within the Microsoft Remote Desktop app.
This now reminds me to Vote Up the following feature request to allow a script to be used multiple times within a policy so this could be used to specify multiple servers, if you agree it’s here.
That path is standard for MAS sandboxed applications. Launch any other MAS-purchased app and look for it to show up in Containers.
MRD is a rebranded iTap, so any eccentricities are the original vendor’s, not Microsoft’s.
http://itap-mobile.com/desktop/rdp
Didn’t know that path was standard as so far have avoided MAS apps. Do these apps still respect MCX?
Did you find a way to deploy the redirection preferences?
Every way I tried ended with no results, and sharing the home folder for the users to upload files is critical in our environment.
Hi Gur,
Sorry for the delay, but I have been making a lot of changes around here.
Could you send me an example plist setup with the redirection preferences?
Hi
this is an link to the file – https://www.dropbox.com/s/w78xzxv224yqx2v/RDC%20Example.txt
the line show at the GUI, but doesn’t work when connected
Gur,
Can I have the full plist? Please submit via the contact page if you wish.
Any idea how to pre-populate the gateway?
I’m sure it could be scripted, but as we don’t have one I’m not sure how.
Maybe upload a copy of your plist with the gateway filled out using the contact page?
I’ll see if I can figure it out when looking @ Gur’s redirection.
Hi,
Did you get my file?
Did you mange to check this problem?
Sorry. I received the file but have not been able to try & recreate yet.
All day meeting tomorrow, but maybe by end of week.
Hi,
Anything new?
Sorry Gur.
I’m struggling to even get it working via the GUI.
I’ll reach out to one of my colleagues when i’m back in the office next year.
Hi Gur,
I’ve got this working, but mapping ~/Desktop is not mapping to the remote computers desktop.. instead it can be found under “My Computer.”
Is that what you’re trying to achieve?
Yes, just need the user to be able to use his documents with the remote computer.
Does Copying the prefs to another computer works?
Hi Gur,
Sorry I’m looking to re-visit the script & re-write it via Python.. I’ll test what you’re looking for when that happens.
I’m noticing that I have to convert the plist to binary after creating it in order for it to work properly. Anyone else seeing this behavior?
How are you converting the plist?
Using “plutil” I converted it to binary with this command:
plutil -convert binary1
I went a step further and added a spot at the top of the script to check for the plist’s existence and then converted it to XML so that if there were existing bookmarks they would hopefully not be destroyed. So I threw this in right after grabbing the logged in user:
if [[ -e /Users/”$loggedInUser”/Library/Containers/com.microsoft.rdc.mac/Data/Library/Preferences/com.microsoft.rdc.mac.plist ]]; then
/usr/bin/plutil -convert xml1 /Users/”$loggedInUser”/Library/Containers/com.microsoft.rdc.mac/Data/Library/Preferences/com.microsoft.rdc.mac.plist
fi
Then at the end, before the chown, I convert back to binary:
/usr/bin/plutil -convert binary1 /Users/”$loggedInUser”/Library/Containers/com.microsoft.rdc.mac/Data/Library/Preferences/com.microsoft.rdc.mac.plist
Hope that’s clear.
First line of code
rdcUuid=”” -> rdcUUID=””
… and it would be better to have plistFile defined once in case it changes rather than having it 11 times.