Install PowerShell on AWS Linux and Tools

awlogo.pngAWS Linux is based on CentOS when considering how to install Windows PowerShell.  This installation is done from the AWS Command Line using SSH into the Public-DNS key for your AWS Linux instance.  The instructions from Microsoft and Amazon are not that easy to follow for AWS Linux instances.  This post summarizes the research and testing done to implement PowerShell on a AWS Linux instance.

You will need to use ‘wget’ to download the most current version of the Powershell installable. Type the following at the AWS Linux command prompt.

wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.9/powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm

The response will look something like

Resolving github-cloud.s3.amazonaws.com (github-cloud.s3.amazonaws.com)... 52.216.80.200
Connecting to github-cloud.s3.amazonaws.com (github-cloud.s3.amazonaws.com)|52.216.80.200|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 40391065 (39M) [application/octet-stream]
Saving to: ‘powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm’

powershell-6.0.0_al 100%[===================>] 38.52M 26.6MB/s in 1.4s

2017-01-11 19:21:31 (26.6 MB/s) - ‘powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm’ saved [40391065/40391065]

Next step is to install this RPM package, type the following at the AWS Linux command prompt.

sudo yum install powershell-6.0.0_alpha.9-1.el7.centos.x86_64.rpm

You will be asked if it is OK to proceed, followed by a lengthy response ending with something that looks like.

Is this ok [y/d/N]: y
Downloading packages:
libunwind-1.1-10.8.amzn1.x86_64.rpm | 72 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libunwind-1.1-10.8.amzn1.x86_64 1/2
Installing : powershell-6.0.0_alpha.9-1.x86_64 2/2
Verifying : powershell-6.0.0_alpha.9-1.x86_64 1/2
Verifying : libunwind-1.1-10.8.amzn1.x86_64 2/2

Installed:
powershell.x86_64 0:6.0.0_alpha.9-1

Dependency Installed:
libunwind.x86_64 0:1.1-10.8.amzn1

Complete!

Now to test if it worked, enter the following at the command prompt.

powershell

If the install worked you will see the standard PowerShell prompt.

Copyright (C) 2016 Microsoft Corporation. All rights reserved.

PS /home/ec2-user>

 

Now to see what got installed run the following command at the PS prompt

Get-Module -ListAvailable

The response will be a list of the modules installed, you may need more, but this is a good start.

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.0.1.0 Microsoft.PowerShell.Archive {Compress-Archive, Expand-Archive}
Manifest 3.0.0.0 Microsoft.PowerShell.Host {Start-Transcript, Stop-Transcript}
Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-ItemProp...
Manifest 3.0.0.0 Microsoft.PowerShell.Security {Get-Credential, Get-ExecutionPolicy, Set-E...
Manifest 3.1.0.0 Microsoft.PowerShell.Utility {Format-List, Format-Custom, Format-Table, ...
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProv...
Script 3.3.9 Pester {Describe, Context, It, Should...}
Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, ...
Script 0.0 PSDesiredStateConfiguration {IsHiddenResource, StrongConnect, Write-Met...
Script 1.2 PSReadLine {Get-PSReadlineKeyHandler, Set-PSReadlineKe...

Remember with AWS Linux it’s YUM not APT-GET.

Powershell Tools for AWS

There is a reference for installation of AWS Tools for Powershell at http://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up.html

There is a set of Powershell tools that should be installed.  Enter the following at the PS prompt.

Install-Package -Name AWSPowerShell.NetCore -Source https://www.powershellgallery.com/api/v2/ -ProviderName NuGet -ExcludeVersion -Destination ~/.local/share/powershell/Modules

The will result in something that looks like

Name                           Version          Source                           Summary                 
----                           -------          ------                           -------                 
AWSPowerShell.NetCore          3.3.37.1         https://www.powershellgallery... The AWS Tools for Po...

With this set of Cmdlet’s you can now perform almost all of the AWS services management using PowerShell commands.  You will need to import the module by entering the following at the PS prompt.

import-module AWSPowerShell.NetCore

Then verify that the module actually got loaded

get-module

Which should result in something looking like, notice the new binary at the top of the list which is the PowerShell library for AWS

ModuleType Version  Name                            ExportedCommands
---------- -------  ----                            ----------------
Binary     3.3.37.1 AWSPowerShell.NetCore           {Add-AASScalableTarget, Add-ACMCertificateT...
Manifest   3.1.0.0  Microsoft.PowerShell.Management {Add-Content, Clear-Content, Clear-Item, Cl...
Manifest   3.0.0.0  Microsoft.PowerShell.Security   {ConvertFrom-SecureString, ConvertTo-Secure...
Manifest   3.1.0.0  Microsoft.PowerShell.Utility    {Add-Member, Add-Type, Clear-Variable, Comp...
Binary     1.0.0.1  PackageManagement               {Find-Package, Find-PackageProvider, Get-Pa...
Script     1.2      PSReadLine                      {Get-PSReadlineKeyHandler, Get-PSReadlineOp...

Now check what the version of the AWS Tools for Powershell is by typing the following at the PS prompt.

Get-AWSPowerShellVersion

Which should result in something that looks like the following.

AWS Tools for PowerShell Core
Version 3.3.37.1
Copyright 2012-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Amazon Web Services SDK for .NET
Core Runtime Version 3.3.7.1
Copyright 2009-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.

Release notes: https://aws.amazon.com/releasenotes/PowerShell

This software includes third party software subject to the following copyrights:
- Logging from log4net, Apache License
[http://logging.apache.org/log4net/license.html]

Congratulations, now you can AWS your heart out using PowerShell scripting commands.

 

 

 

 

 

 

AngularJS vs ReactJS, both.. because it “Depends”

AngularJS-vs-ReactJS-detailed.jpgAngularJS is managed by Google and ReactJS is owned by Facebook. Both of them are unique and resourceful in their own ways. These frameworks are quite easy to use with high-end potential to build cutting-edge mobile and web applications. However, they have their differences too. Which brings the topic ‘AngularJS vs ReactJS: which is better?’Before…

via AngularJS vs ReactJS — DZone Web Dev Zone

Powershell Learning tool

  • Learn PowerShell quickly from the interactive learning center
  • Execute PowerShell fast and accurately using the powerful IDE
  • Access hundreds of pre-loaded scripts from the QuickClick Library
  • Use the script editor to code & debug PowerShell faster
  • Visit the IDERA PowerShell Community for the latest tips and scripts

Interactive Learning Center

Experience PowerShell by example. Short tutorials guide you through basic concepts at your own pace. The comprehensive learning center also includes dynamically created help topics from currently installed PowerShell CmdLets, Snap-Ins, Modules, Providers and WMI objects.

Powerful IDE

The Console allows you to work interactively with PowerShell from a feature rich Windows UI. The Start page offers easy access to tasks, recent files and Getting Started topics. Plus, many productivity tools including System Explorer, Variables Monitor, Code Snippets, Command History, Remoting and many others.

Pre-loaded Scripts

Access hundreds of pre-loaded scripts for SQL Server, SharePoint, Active Directory and Exchange from the QuickClick™ Library. The tree structure organization lets you easily execute scripts in the Interactive Console, edit in the Code Editor and publish as self-contained XML documents that can be shared with colleagues and friends. PowerShell Plus includes all the scripts from the IDERA PowerShell Scripts for SQL Server free download.

Advanced Script Editor

The advanced debugger and script editor lets you build and test complex PowerShell scripts, try one line PowerShell commands from an embedded console, and sign your script with a security certificate all from a single workspace. Editor and encoding features include: code folding, bookmarks, breakpoints, formatting, find and replace, and much more.

Download Community Scripts

Search and download thousands of community scripts from PoshCode and Tech Net script center libraries – directly from the PowerShell Plus console and editor. Plus, publish and share scripts you have created to any network share.

Powershell 5.0 on Windows 10

power01.jpgPowerShell version 5 is installed by default on Windows 10 systems.  However, if you had a previous version, say version 1.0 installed, the new version 5.0 gets installed beside it.  Having both PowerShell version installed can be a problem.  The key is know where each version installed and how to verify which version you are actually running.  Now that PowerShell is available “Everywhere” it may become more of a candidate for managing all systems across Windows, Linux and Mac.

Determine Version

To determine the PowerShell version you must open PowerShell and run the following command

  $PSVersionTable.PSVersion

If you are running Version 5.0 of PowerShell you should see something along the lines of the screen below, anything else is probably not Version 5.0.

power02.jpg

 

Where is Version 5.0

Version 5.0 is now located in this directory

power03.jpg

Since most of the stuff you do with PowerShell is admin work you may want to set the shortcut to run in admin mode automatically.

This is what the non-admin version of PowerShell looks like

power06.jpg

So go to wherever your shortcut is located and right-click and get to the “Properties”.

power07.jpg

Click on Advanced button to get to the super-admin stuff.

power08.jpg

The check the Run as administrator, with great power comes great responsibility.

Responsibility.gif

 

Now when you click on the PowerShell you will be prompted with a Windows pop-up asking you to confirm your new power.  After you accept the responsibility PowerShell will look like.

power09

You may want to consider giving the PowerShell ISE some of that Spidy Admin love as well.  I do most of my work in the ISE so it makes sense to give it the “power” too.

 

Damn it! Now you tell me, SSMS2016 & PowerShell don’t mix

PS_BreaksI’ve been told by friends to stop being the early adopter for technology thingies.  I’m on step 4 of the 12 step Technology Anonymous (TA) program but, I still help trying out the latest database thing, in this case, SQL Server Management Studio 2016.  Yea… should have waited, most of my existing PowerSell scripts that backup and sync stuff across my development and staged areas just kinda stopped.  I’d like to thank Drew for his post about this! Helped me get my SQLFoo back in the groove again.  I promise I will not miss another TA meeting.