EXCERPT

PowerShell: not just for Windows anymore

From Learn PowerShell in a Month of Lunches, 4th Edition by Travis Plunk, James Petty, Tyler Leonhardt, Don Jones, Jeffery Hicks

Why you can no longer afford to ignore PowerShell

Life without PowerShell

  • Microsoft tried to deal with that problem a bit haphazardly, and VBScript was probably its most successful attempt. It might have taken you an hour to write a VBScript that could import new users from a CSV file, but after you’d invested that hour, creating users in the future would take only a few seconds. The problem with VBScript is that Microsoft didn’t make a wholehearted effort in supporting it. Microsoft had to remember to make things VBScript accessible, and when developers forgot (or didn’t have time), you were stuck. Want to change the IP address of a network adapter by using VBScript? OK, you can. Want to check its link speed? You can’t, because nobody remembered to hook that up in a way that VBScript could get to. Sorry. Jeffrey Snover, the architect of Windows PowerShell, calls this the last mile. You can do a lot with VBScript (and other, similar technologies), but it tends to let you down at some point, never getting you through that last mile to the finish line.

Life with PowerShell

Windows, Linux and macOS, Oh My!

Meet PowerShell

USEFUL TERMS We should define a few terms that we use in this article:

PowerShell on Windows

  • The console application is tiny. It loads fast and doesn’t use much memory.
  • It doesn’t require any more .NET Framework stuff than PowerShell needs.
  • You can set the colors to be green text on a black background and pretend you’re working on a 1970s-era mainframe.
Figure 1 Configuring the console application’s properties

PowerShell on macOS

Installation on macOS

brew cask install powershell
==> Satisfying dependencies
All Formula dependencies satisfied.
==>Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.1.3/powershell-7.1.3-osx-x64.pkg
==> Verifying SHA-256 checksum for Cask 'powershell'.
==> Installing Cask powershell
==> Running installer for powershell; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
installer: Package name is PowerShell - 7.1.3
installer: Installing at base path /
installer: The install was successful.
powershell was successfully installed!
~ pwsh
PowerShell 7.1.3
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /Users/steve>

PowerShell on Linux (Ubuntu 18.04)

Installation on Ubuntu 18.04

snap install powershell –-classic
PowerShell 7.1.3 from Microsoft PowerShell✓ installed
~ pwsh
PowerShell 7.1.3
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /Users/tyleonha>

Is PowerShell for you?

  • Administrators (regardless of your os) who primarily run commands and consume tools written by others.
  • Administrators (regardless of your os) who combine commands and tools into more-complex processes, and perhaps package those as tools which less-experienced administrators can use.
  • Administrators (regardless of your os) and developers who create reusable tools and applications.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Manning Publications

Follow Manning Publications on Medium for free content and exclusive discounts.