I’ve always liked the idea of taking a series of Microsoft PowerShell scripts and putting them behind a user interface so that I can give the tool to other users. I’m not sure why this idea appeals to me, but probably because it makes me feel like a programmer, if only for a little while. I came across this post by Stephen Owen and I had to try it out.
The project that I picked for this was based on the AWS PowerShell tools that I hadn’t used yet. Let’s face it, this is a good way to check out two different things, I didn’t have much experience with: The AWS PowerShell Tools and XAML for creating GUIs.
If you want to create your own GUI form for PowerShell scripts, please read Stephen’s post, download the code that I used and modify it, or both of them!
Use the AWS PowerShell Console
Before you use this console, you must install and configure the AWS PowerShell tools provided by Amazon. They can be found here: https://aws.amazon.com/powershell/
After the installation of the tools, run the Initialize-AWSDefaults to set your default region and user keys. These defaults will be leveraged by the custom PowerShell Console.
NOTE: One thing that you may want to modify is the desktop background. I’ve used theITHollow logo for the background, but you may want a different image. This can be modified by changing this line of code in the PowerShell form:
1 <ImageBrush ImageSource="http://theithollow.com/wp-content/uploads/2016/10/AWS-PoshBackground.png"/>
Go to Github and download the code. From here, you can run the code in your favorite PowerShell ISE. Once the code has been executed, a GUI will pop open. From here, you can select the “Get-EC2Instance-State” button to populate the grid with your EC2 instances as well as their state. Select any of the EC2-Instances and then click the appropriate button in the EC2 Actions sub-window to manage them.
I’ve created a short video to demonstrate the operations. Please feel free to modify, or reuse any of the provided code for your own projects and take a peak at Stephen Owen’s series on XAML!