Steve Bigelow: What if IT admins could use a single tool
to configure entire fleets of systems,
troubleshoot critical problems, and automate
complex data center activities? Look no further.
PowerShell has been a vital tool for years, and
it's better than ever. PowerShell is a scripting
language that adds functions essential for
automation and scalability. Microsoft designed the
PowerShell language to automate system tasks such
as batch processing, and to create System
Management Tools for commonly implemented
processes. Its purpose is to help IT professionals
configure systems and automated administrative
tasks. System administrators in both IT
departments and external entities like managed
service providers use it because of its scripting
capabilities. It's built on the dotnet framework
and works with objects. While most command line
shells are text based. PowerShell can handle a
wide range of activities. It can manage individual
computers or entire server fleets with equal ease.
It can configure system hardware and install or
update software. It can provide detailed reports
on system operations and dependencies. It can even
extract information on OSS such as the specific
version and service pack levels. PowerShell
providers are programs that make data contained in
specialized data stores accessible at the command
line. Those data stores include file system drives
and Windows registries. PowerShell replaced
Microsoft's command prompt which dates back to the
dos of the 1980s. Microsoft, for example, made
PowerShell the default command line interface CLI
for Windows 10. As of build 14791 Power shells
role is a command line shell is how most users
become acquainted with the technology. It's
available by default on most recent Windows
systems. In 2016, Microsoft open sourced
PowerShell and made it available on Linux and
macOS. Here, we'll go over the basics of
PowerShell and how to get started with it. For a
deeper dive, explore our complete collection on
all things PowerShell by clicking on the link
above or in the description below.
The most appealing reason to use PowerShell or any
kind of command line interface is to have precise
and repeatable control over a desired action or
task flow. This kind of control can be difficult
or even impossible to replicate with a traditional
graphical user interface. When you try to perform
an intricate task with a GUI, that means you are
manually clicking buttons, moving sliders,
selecting files from multilayered menus, and
taking other actions. GUIs were designed to be
comfortable for humans to use, but they can be
time consuming and cumbersome. They're also error
prone, especially when a task must be repeated
hundreds or 1000s of times. PowerShell is a
command line interface with a mature and detailed
scripting language. It lets someone with
rudimentary programming skills craft a detailed
set of specific instructions, also called a
script. For a desired tasks such as configuring a
new computer or installing a new software package.
The task can be just about anything, finding a
desired file maybe, or describing a desired state
configuration for the system or other systems.
Once the script is created, it can be saved as a
file and executed with a click. That way the same
task can be repeated exactly the same way for any
number of times. Different scripts can also be
chained together to create complex and highly
detailed tasks. functions like these are
absolutely essential for automation and
scalability. So what PowerShell does is help
system administrators perform complex and highly
repetitive tasks with a high level of automation
and accuracy that a GUI simply can't replicate.
PowerShell is a complex platform with a vast array
of functions that support sophisticated enterprise
class tasks. Many of these can be automated with
programming scripts, or specific commands called
commandlets. Most system administrators must
become proficient in PowerShell. To perform their
day to day duties well need to learn PowerShell
there is no single pathway to learning PowerShell
but here's a quick list of some common approaches.
tinker with it
PowerShell is free and already installed on
virtually every Windows computer.
Just type PowerShell into the Windows search bar
to locate it PowerShell enthusiasts can deepen
their knowledge by trying new commands and
experimenting with new commandlets study Microsoft
documentation. Microsoft provides free and
comprehensive documentation for all aspects of
PowerShell including commands and commandlets.
students and professionals alike can use it to
expand their PowerShell knowledge. Take a training
course direct from Microsoft, Microsoft provides
free and extensive learning content for PowerShell
including a self paced introduction. take online
classes, you'll find a wide range of self study
and guided courses focused on various aspects and
use cases for PowerShell Udemy promotes a range of
PowerShell courses including learning Windows
PowerShell, Master Microsoft, PowerShell, and
PowerShell. For Active Directory administrators.
Check your local colleges and Adult Education
Centers to see if they offer instructor led
coursework for PowerShell Users. Finally, you can
go old school and read books. There are countless
books out there to help pump up your PowerShell
expertise. Two recent examples are learn
PowerShell and a month of lunches by Travis plunk,
JAMES PETTY, and Tyler Leonhard and Windows Server
Automation with PowerShell cookbook by Thomas Lee.
Remember, none of the options I just mentioned are
mutually exclusive. In fact, mixing it up a little
in any combination can accelerate your route to
PowerShell proficiency ready to try out PowerShell
it's easy to access. Any computer running Windows
10 Or later already has PowerShell installed by
default. You can invoke PowerShell simply by
typing PowerShell into the search bar. Then select
the PowerShell app from the resulting search list.
You can also call up PowerShell by entering
PowerShell dot exe in the Run dialog PowerShell
seven supports cross platform installation on many
Linux distributions, you can launch it by typing
PW sh at the Linux command prompt. The launch
process is similar under macOS. Once PowerShell is
installed, simply open a terminal window and type
the command PW sh. Now let's dive into creating
and running a PowerShell script. PowerShell is
primarily what's called an execution platform. So
developers generally create scripts in a different
tool, and then run those scripts through
PowerShell. There are countless options for
creating a script, most common being almost any
ordinary text editor, the PowerShell, ISC,
Microsoft Visual Studio code, or even the basic
notepad app in Windows. Let's review some basic
steps to create a simple one command script. In
this example, we'll just use Notepad on Windows
11. First, open Notepad
in Notepad, use the right dash host command and
enclose some basic text in quotations.
Then click File and select the Save As option.
Next, enter a useful name for the script such as
script dot ps1.
Click the Save button.
Now you've created a script and saved it as a ps1
file. Next, you need to change the execution
policy on the system so that scripts will run as
scripts are blocked by default. To do this on
Windows 11, follow these steps. Click Start and
Search for PowerShell then select run as
administrator PowerShell starts now type the
command set dash execution policy remote signed.
This tells PowerShell to change the execution
policy. Select the Yes to all option by typing a
and pressing enter.
Finally, the new script can be executed using the
ampersand command. The path to the script and the
name of the ps1 file created. It should look like
this.
When creating script files, it's a good idea to
provide a well known folder path for holding
script files.
It's also a sound practice to include version
control or other version management techniques,
such as adding a version designation to the ps1
file name. For example. Instead of naming the file
script dot ps1 and
something more meaningful. For example, this name
indicates that the file version 1.0 was created on
the first of February 2023.
Even though PowerShell is now open source,
Microsoft continues to actively contribute to open
source PowerShell development. After two decades.
PowerShell is ubiquitous in enterprises. Actually,
it's practically irreplaceable. Now, don't expect
groundbreaking new features and functionality in
PowerShell just continual updates and maintenance
into the foreseeable future to meet the changing
capabilities of Windows, Linux and Mac OS. That
said, there are some developments on the immediate
horizon, including better and simplified
automation, improved configuration and remote
operation