krypted.com

Tiny Deathstars of Foulness

Let’s face it, connecting to Windows Servers is a must for many of us. And some of us want to do so programatically. I did look at populating the CoRD database in a previous article. But now, luckily CoRD has recently introduced a command line interface for managing just these types of connections on the fly as well. And, it is very straight forward. There are two ways to call CoRD from the command line. The first is similar to how we handled VNC in an earlier article. Simply leverage the open command and call the URL with a rdp in the beginning. For example, if you want to open a connection to a server called windows.krypted.com you would use the following command: open rdp://windows.krypted.com As with VNC you can also inject he user name and the password as well. To do so insert the username after the rdp:// and with an @ before the domain or IP. And to inject the password follow the username with a : and then the password followed by the @. For example, if our username were daneel and our password were seldon then the command would be: open rdp://daneel:seldon@windows.krypted.com There are other options as well, which you can find at the CoRD Wiki. You can also connect by calling the CoRD command, which is located in the /Applications/CoRD.app/Contents/MacOS directory. The CoRD command then has the following options: host – define the IP address or host name of the computer you are connecting to port – if a custom port (not 3389) is used then use that to connect to the computer u – define a username p – define a password d – Windows domain name a – set screen depth to 8, 16, 24 or 32 width – set the width of the resultant window height – set the height of the resultant window So if you would like to connect to windows.krypted.com with the same user and password as before, but now with a custom port of 3390 you would use the following command: /Applications/CoRD.app/Contents/MacOS/CoRD -host windows.krypted.com -port 3390 -u daneel -p seldon I guess next I’m going to have to build a Dashboard widget to fire up a connection on the fly… ūüėČ

February 1st, 2010

Posted In: Mac OS X, Windows Server

Tags: , , , , , , , , ,

Since I already started down this path, we can also push out information for a Windows box therefore programatically allowing you to push updates to two programs and be able to manage all your boxen.  You would push something along the following (creating a file that matches your naming convention followed by .rdp):
connect to console:i:0 bitmapcachepersistenable:i:1 redirectdrives:i:0 disable wallpaper:i:1 disable full window drag:i:1 disable menu anims:i:1 disable themes:i:0 audiomode:i:0 desktopwidth:i:1024 desktopheight:i:768 session bpp:i:16 cord save password:i:0 startdisplay:i:0 cord fullscreen:i:0 cord row index:i:2 full address:s:10.10.10.10 username:s:charles domain:s: cord label:s:charles
So programatically you can change any of the settings by replacing it with a variable.  Therefore, in a script if we just wanted to push a new address and user name then you could simply echo the data into a file as follows, which would use the $1 to $4 positions (thus enabling you to send the data from another applications API into CoRD):
#!/bin/bash echo "connect to console:i:0 bitmapcachepersistenable:i:1 redirectdrives:i:0 disable wallpaper:i:1 disable full window drag:i:1 disable menu anims:i:1 disable themes:i:0 audiomode:i:0 desktopwidth:i:1024 desktopheight:i:768 session bpp:i:16 cord save password:i:0 startdisplay:i:0 cord fullscreen:i:0 cord row index:i:2 full address:s:$1 username:s:$2 domain:s: cord label:s:$3"> /Users/cedge/Library/Application Support/CoRD/Servers/$4
This could be pretty handy if, let's say, you're using the EC2 scripts from earlier to derive a username and password from Amazon and then pushing them into CoRD by calling this script.  For example, if the script is called CoRDSetup.sh then you would run:
./CoRDSetup.sh address.domain.com username machinelabel filename
I'm sure there are way better ways to go about this, but it's a quick and easy proof of concept that gets the job done.  Like with the ARD article, there are again no passwords being sent to CoRD.

May 14th, 2009

Posted In: Mac OS X, Mass Deployment

Tags: , ,