Ubuntu 17.10 TIP Install Microsoft PowerShell GMH 066

GMH-066 Ubuntu 17.10 Tip Install Powershell Install Microsofts Powershell on Ubuntu 17.10 Aadrvark. Why Powershell when Ubuntu has the power of Bash? I have been torn between where to focus my efforts on and looked at the ecosystem of both Bash and Powershell. Bash beats Powershell is sheer numbers but Powershell seems to be drawing the interest some very innovative folks.

Professionally I work in a Windows environment, my soul works in Linux. In this case, I’m bilingual and I need to speak the language of the country (Environment) I’m living in. I have written some pretty cool Powershell scripts and I’m helping others move from the Windows CMD line into Powershell.

To help me in my withdrawal from Linux, I have installed CYGwin on most windows systems and use the GIT BASH window frequently. I also use a networking tool called MobaXTerm which also has the heart of CYGWin in it. Some of the future videos in this series will have references to Powershell so installing it is important. Some folks find it difficult to dip their toes into the Linux Terminal. For many, this video is a short visit to that strange place. To others, I am boring the shit out them. I promise it will get more interesting in the future.

NOTE: In the recording of this video, the remote desktop connection from the X11VNC server kept crashing after 5-10 minutes. I had to cut out all the cuss words. You might alow notice the cursor highlighting disappears from time to time

Reference: https://austin.cady.io/install-micros…

# Install Curl sudo apt-get install curl # Import the public repository GPG keys curl https://packages.microsoft.com/keys/m… | sudo apt-key add –

# Register the Microsoft Ubuntu repository curl https://packages.microsoft.com/config… | sudo tee /etc/apt/sources.list.d/microsoft.list

# Update apt-get sudo apt-get update

# Install PowerShell sudo apt-get install -y PowerShell

# Link to Missing libicu55
http://security.ubuntu.com/ubuntu/poo…

NOTE: This version of the lib is for an AMD system like the one I’m using. If your system is different you may need to locate the proper lib.

# Install libicu55 using CLI package installer
sudo dpkg -i ./libicu55_55.1-7ubuntu0.3_amd64.deb

# Start Powershell pwsh

# Simple command to test PS
write-host “Hello there GeeMustHave fans.” -foregroundcolor yellow

I hope you enjoyed this video and if you liked it or my escapades then click on that LIKE button. Do this Geek a favor, SUBSCRIBE to my YouTube channel. I would really appreciate it!

Any questions or feedback are greatly appreciated.

Now… go build or code something…

YouTube: https:YouTube/c/GeekMustHave

Blog: Https://GeekMustHave.com

GitHub: https://GitHub/GeekMustHave

Facebook: https://goo.gl/QqFZgF

Twitter: https://twitter.com/hashtag/geekmusth…

Twitter: https://twitter.com/hashtag/geekmusthave

 

 

I know how to Code, I can code in anything…. not

Every time I talk to a recent grad I hear a variation of the phrase, “I know how to code, I can code in anything.” This is, on the surface, true for some bits like boolean logic and loops. Where it starts to fail for me is when I need to leverage a language’s ecosystem.…

Same experience with me.  I know how to program in about 10 different languages. Some are lost languages like Etruscan and Cobol.  Recently I had to learn Ruby and I said how hard can that be?  It was hard.  One group of people we focused on JavaScript, Node and multiple JS libraries.  I said this is just a scripting language.  Yep, wrong again.  A few years ago I started using Arduino which used a C++ language.  I’ve programmed in C# they are almost the same.  Same like a bicycle is like a motorcycle.

I have learned to respect the learning curve on any new “Language”.  I appreciate the YouVideo and subscription to Udemy that I have.  It still takes time, more time than getting on a bicycle after 10 years.

I now know twelve languages and the last two took almost as much time as the first ten.

via I Know How to Code, I Can Code in Anything — DZone Web Dev Zone

BACKUP TIP Mount NAS Share to backup with CrashPlan GMH-062

Please excuse video compression, video editor went crazy on me. Backup tip, How to mount a NAS share drive so CrashPlan Pro can use it. GMH-062 I use CrashPlan Pro for making a backup copy of my stuff on a large NAS system. I discovered that the standard (NET USE) command didn’t mount the NAS Share as a SYSTEM drive.

CrashPlan Pro runs as a SYSTEM service and could not see my W: or NAS Share. NOTE: CrashPlan Pro doesn’t support or recommend this suggested solution. Use at your own risk! SPECIAL THANKS: Phoenix Workgroup LLC for server space and permission to publish this. I tried a number of solutions from Google and ended up with this one working the best of all of them.

This set of Powershell scripts are tarted up to make them look pretty and contain links to all the people who helped make it work. Let me know in the comments if this works for you. Boxes, Thomas Jensen https://goo.gl/pfMvT8 System Internals Microsoft https://goo.gl/KbFLqr GeekMustHave File Server https://goo.gl/c4ms2h GeekMustHave GitHub https://goo.gl/RLPUob

I hope you enjoyed this video and if you liked it or my escapades then click on that LIKE button. Do a Geek a favor, SUBSCRIBE to my YouTube channel. I would really appreciate it! Any questions or feedback are greatly appreciated. Now… go build or code something…

YouTube: https:YouTube/c/GeekMustHave

Blog: Https://GeekMustHave.com

GitHub: https://GitHub/GeekMustHave

Facebook: https://goo.gl/QqFZgF

Twitter: https://twitter.com/hashtag/geekmusthave

 

 

 

Boxes -Spice up boring Bash or Powershell scripts

boxes.pngBoxes is a text filter which can draw any kind of box around its input text. Box design choices range from simple boxes to complex ASCII art.  Boxes come with a good collection of ASCII art to start with.  I’m a sucker for boxes, they spice up what would be boring script files.  Boxes were always available on Linux, and now it’s available under Windows.  That’s if you can find them.

This little ditty is a reminder for myself of how to install this on a Windows machine so it is available from everywhere.

Boxes are from Thomas Jensen, download them from this link and save yourself a headache using google to find either boxes, Linux or combinations.  Version 1.2 has been released and has a few extra little goodies.

Getting it installed so you can use it any Powershell script on your system is a little difficult but worth the effort.

Part of my setup for every Windows system I use is to create a directory under the C:\ root to store the commands that are mine.  These are mostly portable applications but include little utilities like Boxes.  I call this directory C:\myCommands.   When I add this directory to the PATH statement it makes all those commands I added to the directory, available from any directory on the computer.

2017-08-21_15-32-07.png

Adding the path is done by editing the environment variable for your account, not the system account.  Look for the Path variable and Edit it.

2017-08-21_16-40-27.png

Then add the special place you created for your stuff.  In my case (C:\myCommands).

2017-08-21_16-40-31.png

When you unzip the BOXES.ZIP program from this link, it is just 2 files.  The EXE which does the work and the CFG which has the ASCII artwork in it.  I unzip them both into the (c:\myCommands) directory.

2017-08-21_15-33-58.png

The last step to getting boxes everywhere is to add a new environment variable to your account.  Start with looking for environment variables.

2017-08-21_16-47-19.png

The name of the new environment variable is BOXES.  The value is your special place (C:\myCommands).

2017-08-21_16-47-36

Verify that the new environment variable has been created.

2017-08-21_16-47-42.png

To have all of this stuff to start working you will need to reboot.  

Now open up the PowerShell window and type:

write-output "GeekMustHave rocks!" | boxes -a hc -d ian_jones

The (ian_jones) is one my favorite ASCII art frames.  There are plenty more art frames in the CFG file.

2017-08-21_16-54-56.png

I also have a YouTube Channel (GeekMustHave) no spaces or your get the makeup ladies.

If you stop by to visit please subscribe to let me know this post helped you.

https://www.youtube.com/channel/UChNSlqKgG8_l0h0C8vRLvbA

 

 

FreeCommander XE and Powershell

FreeCommanderPortable.png

FreeCommandwe XE is a great replacement for the standard Windows Explorer.  It comes in standard installations and a portable version.  This can be configured to replace the Windows Explorer when you press (Windows)+E keys.   There is a DOS function under tools or keyboard shortcut (CtrL)-D that opens up a DOS Command Line.  There is also an option to have a small text box at the bottom to run DOSCMDS on the fly. Nice!  I have forced myself to use Powershell for the Windows command line.  How do I get FreeCommander to open Powershell instead of the DOS CMD line?

To start the DOS CMD in FreeCommander.

aa.png

The command line is the standard DOS command line with the title changed to FreeCommander

2017-08-18_19-52-06.png

Let’s change it to open Powershell instead.  Start by opening up the settings.

2017-08-18_19-54-25.png

Then open the settings to change the DOS configuration.

2017-08-18_19-55-47.png

Now it’s as simple as entering in the path to your Powershell command.  Yea, that’s not necessarily that simple.  The path name can vary from machine to machine and how PowerShell was installed.

On my Windows 10 system press the (Windows) key and start typing “powershell”.

2017-08-18_19-59-19.png

Now right-click on the Windows Powershell (Desktop app) to open up some options.  We want to know the path where Powershell is located.  I’m thinking the “Open file location” will work.

2017-08-18_20-01-43.png

This opens up a Windows Explorer window to where your Powershell is located.  To get the full path name you have to manually combine the File Name, then click on the directory to expand the path name, then paste them all together.  Still pretty much a pain in the ass.

2017-08-18_20-06-39.png

Let’s try a trick here.  Right-click on the “Windows PowerShell” command, then select the properties for this command.

2017-08-18_20-10-30.png

The “Target” is the path to the Powershell command.  Look, Windows even highlighted it for you.  If it didn’t, then highlight it manually.  Press (Ctrl)-C to copy it.

2017-08-18_20-16-06.png

Then paste (ctrl)-v the path it into the “DOS box command specifications” and press OK.

2017-08-18_20-20-28

Now when you click on (Tools)->(Dos) or press (Ctrl)-d, the wonderful, glorious PowerShell command line window opens up and you can CmdLet your way to heaven.

2017-08-18_20-26-07.png

Welcome to the New-Order.

Visit my YouTube channel to fill up on your technoGeek desires.  Subscribe if this blog post helped you.

2017-08-18_20-28-39.png

 

 

 

 

 

 

Powershell + JavaScript + ConvertToHTML = Web Reports

powershell-hero-16-9-ratio.jpg

Some tips and tricks on how to use a combination of Powershell, JavaScript, and the ConvertToHTML Powerlet to get some nicely formatted web reports.  This article is in multiple parts and start with the first one or you will get totally lost.

I’m getting better at PowerShell and never thought to combine these things together.  The solution is pretty simple stuff but very creative.  This is a Maker project in my mind.

Via: Database Weekly

 

 

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.