Reylor Innovations

IT Professional By Day, Hobby Technologist By Night

Author: Jeff Beard

Raspberry Pi As Cheap Thin Client

My workplace offers Remote Desktop Services (RDS) with all the tools I need to get my job done when I’m away from my laptop (or for when I’m too lazy to get it out of the car). Today I went about setting up a home workstation, looking for an inexpensive way to connect to this compute in the cloud using something I already had around the house. Who doesn’t have a few Raspberry Pi’s kicking around in their drawers? As it turns out a Raspberry Pi 3 running Raspbian Stretch fits the bill nicely, HDMI, wifi, plenty of USB for keyboard, and mouse, etc. I briefly checked out the Raspberry Pi Thin Client project but since I already had a Pi running the latest Stretch image, I figured I’d roll with that.

I checked out a few RDP apps for Linux and settled on freerdp, which is available via aptitude.

sudo apt-get install freerdp-x11

After reading over the documentation and looking at a few examples, I found the right syntax to setup the connection to my work’s RDS server, sitting behind a web gateway. The switches are relatively self explanatory, the last /f is to start the session full screen.

xfreerdp /g:gateway.foo.bar /gu:user@foo.bar /gp:gatewaypassword /v:rdsserver.foo.bar /u:user@foo.bar /p:rdspassword /f

I put this command in a script. In the example below you see a “sleep 5” command just before the connection string, more on this later.

I wanted this connection to fire as soon as my Raspberry Pi started up. To do this I added the script to LXDE’s autostart file so it fires after the default pi user logs in.

~/.config/lxsession/LXDE-pi/autostart

In my testing I found the Pi would boot so quickly into X that it beat the WiFi connection. So, I added sleep 5 in my connection script to give the Pi 5 seconds to “settle down” and connect to WiFi before attempting the RDS connection.

Voila, on boot and after the pi user logs in, my connectts.sh script fires which connects me right into my RDS server!

Install Linux On Windows 10 With Powershell

With Microsoft’s Windows 10 Fall Creator update, they enabled the ability to install the Linux subsystem with Powershell. This is a great alternative for system administrators and power users who don’t want to use a Microsoft Account and Windows Store with their Windows 10 installation.

The steps are simple and as follows.

Open an administrative Powershell window and type:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Install a Linux distribution, in this example, Ubuntu:

Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.zip -UseBasicParsing

Extract the downloaded file

Expand-Archive ~/Ubuntu.zip ~/Ubuntu

Run the installer

And you’re off to the races!

Graphical Linux Apps In Windows 10

By now those who care know that Windows 10 includes the ability to run a Linux subsystem. With the latest updates to the OS, you can now download a few Linux distributions right through the Microsoft Store

 
 

 
 

I’ve been playing with this on and off for various things, shuffling certificates around using OpenSSL, testing things for work, etc. I wanted to see what would happen if I tried to launch a graphical application and was not terribly surprised when I was greeted with an error.

 
 

There is no graphical system available from the Linux subsystem in Windows but there is a workaround if you want to do this. At a high level you need to redirect the graphical calls to a X system that runs in Windows. One such tool to do this is called Xming – https://sourceforge.net/projects/xming/.

 
 

After installing Xming you can head back to the Linux console and launch graphical applications by prefacing them with:

 
 

DISPLAY=:0

 
 

…as shown below.

 

Voila! Your application launches right in Windows.

 
 

Unfortunately, because the display calls are being redirected through what is considered a “remote” X server, performance is OK but not adequate for things like video or photo editing. Still, it’s a neat trick for people that have this kind of niche requirement for work or pleasure.

Microsoft Flow – Data Transformation for Visual Folks

I’ve been playing with Microsoft Flow lately. For the uninitiated it’s similar to tools like IFTTT and Zapier and, being a Microsoft product, has rich integration with Microsoft services (particularly those found within the Office 365 suite). It also can work with popular third party tools like Slack and Trello. Visual tools that take data from one place, massage it and output it into various workflows have long captured my attention. They have the power to transform old processes into new behaviors and patterns, taking advantage of new technologies and hopefully increase efficiency.

My example below is far from an epic transformative experience but it should give you an idea of what Flow can potentially do for you or your business. This is my attempt to learn and develop a simple Flow that takes an email from a VIP and processes it into a Microsoft Planner task.

  • Start at flow.microsoft.com and sign in with your Microsoft account.
  • Click My flows then Create from blank

  • In this case I started with the email connector, using my Office 365 account credentials.

  • After we add our source and define our variables, in this case the sender(s), the next step is to process that data into Microsoft Planner.
  • Click New Step then add an action.
  • Type Planner then select “Planner – Create a Task.”

  • Here I realized I needed to pre-create the Plan I want the task to get inserted into. I went over to tasks.microsoft.com and created a new private task (since this Plan is only for me). I created a couple of “buckets” for the data to go, such as “Response Needed” and “Response Deferred.”

  • After creating the plan I went back to the Flow, saved it and refreshed the page. This was necessary to get the Plan to show up in the drop down menu for the Flow’s action.
  • There is more information to fill out, defining the title of your Task, the Bucket ID, etc. This is fairly self explanatory, simply start typing the name of the Dynamic content and select the result to insert it into the field.

  • While not necessary, I figured it would be good to have a due date to track the items in my bucket. I figured about a day would be a good amount of time to defer the action of replying to VIP.

  • Here I discovered the “ddDays() Expression. I hoped I could use the timestamp of the message then add a day to come up with a due date 24 hours after I got the message. I had to read up on the documentation linked from the Expression and eventually pinned down the syntax (shown above).
  • Finally, I set the Assigned User Id to myself by using the To field from the email.
  • Oddly the “Create a Task” action did not include the ability to populate the Description field of the task, to remedy this I added another step at the end of my Flow.

  • The Task ID field uses a Dynamic content string from the Id field from the Planner task above, neat!
  • I put the Body of the email in the Description, saved it and sent myself a test email.
  • Because I added my email address as a VIP in the first step, sure enough a task was created in Planner with all of the details I wanted!

  • I was a little bummed to see that the Description field included the raw HTML from the message I sent. While I can easily ignore it in this simple a test message, a long, forwarded message could contain a lot of extraneous characters. I searched a bit and found a TechNet article that announced the availability of the “Html to text” action.
  • I added a step before “Create a task” for the Html to text action and input the “Body” Dynamic content from the email.  Then I referenced “The plain text converter” in the last “Update task details” step.

  • After running this Flow I now get nice and clean plain text in my Description field. Spiffy!

There are certainly better pre-made tools to get a to-do type list going from emails. This demonstration is meant to get you thinking about what Flow and similar tools could do for you or your business. Take into consideration this example.

A manufacturing company has a legacy order management system that sends order info out via email to a group of employees responsible for making the order. These employees get the email but don’t have visibility into who took ownership over what order and where orders stand throughout the day, particularly as shifts change.

A Flow could be used to capture the email from a centralized mailbox then turn it into a Planner task, dynamically inserting the content and assigning it to specific workers based on content found within the message. Throughout the day workers can use the app on a mobile device to assign orders and move them through the stages of production (buckets in Planner). Once the order is complete they would put it into a special Planner bucket which gets processed by another Flow that captures the information of who worked on the order and it’s status back to an email that legacy system receives for storage and safe keeping.

Have you used Flow or a similar tool to make your life easier? Let me know!

Welcome

Often I find myself embroiled in technical challenges I can’t justify beyond “I can’t let the computer win.” Some call it an unhealthy obsession. I call it a hobby. I also turned it into a career.

This is a place to share those experiences, for better or worse.

Where did the name Reylor come from? Ask me some time.

© 2018 Reylor Innovations

Theme by Anders NorenUp ↑