Posts

Showing posts from September, 2016

Retrieving AWS EC2 instance screenshot with PowerShell

Image
Few months ago, Amazon announced the ability to capture and show the console screen of an EC2 instance. It really helps troubleshooting in certain situations. While it is available through the GUI console, one has to explore further with the PowerShell way. ;-) Reading up on the AWS documentation, the AWS PowerShell cmdlet, Get-EC2ConsoleScreenshot , allows us to retrieve the image data. Let's give it a try in the PowerShell console. The result doesn't really look like an image, does it? Worry not, the data is actually a jpeg file encoded in BASE64 format. We just have to convert it back to bytes with the [convert]::FromBase64String() before saving the file. Now, opening up the saved screenshot. Oh well... this doesn't look perfect but good to know. I've put these together in a PowerShell function: Save-EC2consoleScreenshot.  And now that's a pragmatic way to retrieve the EC2 instance screenshot! Feel free to have a look of it on GitHub: Link . Ho

Updating the rdg connection file of the Remote Desktop Connection Manager program.

Image
Since the new job starts few months ago, I've been very busy stepping out my comfort zone and learning new topics: AWS, Puppet and Linux. :) Pretty exciting journey but I miss PowerShell a lot... Anyway, I'd like to share this small PowerShell script with you. You can find the project here:  UpdateRDG on GitHub . It updates the Remote Desktop Connection Manager  connection file which sometimes is handy for switching between environments. (Yes yes, we all know RDP is not a server management tool... but slowly we'll pay off the technical debt.) The file itself is an XML document so not too hard to work with PowerShell. Here is an example of the rdg file created using the GUI for demo purpose. The <server>....</server> block defines the server node information. So our goal is adding the server blocks based on whatever input there is. The input can be Hyper-V, VMware, Azure, AWS or even Excel spreadsheet. Here I query Hyper-V for the vm information and yo