# PowerShell/Introduction

This lesson introduces Windows PowerShell by looking at the PowerShell environment. Activities include PowerShell, PowerShell ISE, and the Get-Host, Get-Help, and Update-Help cmdlets.

## Objectives and Skills

After completing this lesson, you will be able to:
* Explain basic Windows PowerShell concepts.
* Describe the Microsoft resources available for learning Windows PowerShell.
* Start Windows PowerShell and Windows PowerShell ISE.
* Run the Get-Host cmdlet in Windows PowerShell and Windows PowerShell ISE.
* Get and update help in Windows PowerShell.

## Readings

* Wikipedia: Windows PowerShell
* Wikipedia: .NET Framework
* Microsoft Technet: Getting Started with Windows PowerShell

## Multimedia

* YouTube: PowerShell: Introduction and Scripting Tutorial

## Examples
#### Get-Help

The Get-Help cmdlet displays information about Windows PowerShell commands and concepts.

#### Get-Host

The Get-Host cmdlet gets an object that contains the current host program (ConsoleHost or Windows PowerShell ISE Host), Windows PowerShell version, and culture (region) settings.

#### Update-Help

The Update-Help cmdlet downloads and installs the newest help files on your computer.

## Activities

* Review Microsoft: Windows PowerShell. Identify the different resources available to learn and use PowerShell, and the different versions of PowerShell available for download.
* Review Microsoft TechNet: What's New in Windows PowerShell. Determine whether you have the most recent version of Windows PowerShell installed. If not, consider downloading and installing the current version. Version 3.0 or later should be used for this course. Watch YouTube: Update PowerShell if you need help updating PowerShell.
* Review Microsoft MSDN: Starting Windows PowerShell. Start PowerShell. Then start PowerShell ISE. Compare the two PowerShell environments.
* Review Microsoft TechNet: Using the Get-Host Cmdlet. Run the Get-Host cmdlet in both PowerShell and PowerShell ISE. Observe the differences between the two environments. Verify which version of Windows PowerShell is installed.
* Review Microsoft TechNet: Understanding and Using Updatable PowerShell Help. Run PowerShell as an administrator and then run the Update-Help cmdlet to ensure you have the latest PowerShell help files installed.
* Review Microsoft TechNet: Using the Get-Help Cmdlet. Use the Get-Help cmdlet to learn more about the Get-Host cmdlet:
    Get-Help Get-Host
* Review Microsoft: Windows PowerShell Quick Reference. Download the reference and print or save it for future use.

## Lesson Summary

* Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework.
* PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems.
* Administrative tasks in PowerShell are generally performed by cmdlets.
* PowerShell console help is accessed using the Get-Help cmdlet and is updatable with fresh content using the Update-Help cmdlet.
* PowerShell can execute four kinds of named commands: cmdlets, scripts, functions, and executable programs.
* PowerShell scripts are saved with a .ps1 file extension.
* Cmdlets follow a <verb>—<noun> naming pattern.
* Cmdlets output their results as objects.
* PowerShell implements the concept of a pipeline, which enables the output of one cmdlet to be piped as input to another cmdlet.
* PowerShell pipelines are used to compose complex commands, using the | operator to connect stages.
* Windows PowerShell includes a dynamically typed scripting language which supports variables, functions, conditions, loops, structured error/exception handling, as well as integration with .NET.
* Variables in PowerShell scripts have names that start with $, and they can be assigned any value, including the output of cmdlets.
* $_ refers to the current object in the pipeline.
* PowerShell script execution is disabled by default and must be enabled explicitly.
* PowerShell 2.0 is integrated with Windows 7 and Windows Server 2008 R2.
* PowerShell 3.0 is integrated with Windows 8 and Windows Server 2012.
* PowerShell 4.0 is integrated with Windows 8.1 and Windows Server 2012 R2.
* PowerShell 3.0 and 4.0 may be installed on Windows 7 and later operating systems.

## Key Terms
### CMD.EXE

    The Microsoft-supplied command-line interpreter on OS/2 and eComStation, Windows CE and on Windows NT-based operating systems (including Windows 2000, XP, Vista, 7, 8, Server 2003, Server 2008, Server 2008 R2 and Server 2012).

### Component Object Model (COM)

    A binary-interface standard for software components introduced by Microsoft in 1993 used to enable inter-process communication and dynamic object creation in a large range of programming languages.

### COMMAND.COM

    The filename of the default operating system shell for DOS operating systems and the default command line interpreter on Windows 95, Windows 98 and Windows ME.

### compiler

    A computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code).

### console

    A command-line interface (CLI) used as a means of interacting with a computer program where the user (or client) issues commands to the program in the form of successive lines of text (command lines).

### Get-Help

    Retrieves a list of all available help topics.

### Get-Host

    Gets an object that represents the current host program.

### interpreted language

    An interpreted language is a programming language for which most of its implementations execute instructions directly, without previously compiling a program into machine-language instructions.

### .NET Framework

    A software framework developed by Microsoft that runs primarily on Microsoft Windows which includes a large class library known as Framework Class Library (FCL) and provides language interoperability across several programming languages.

### pipeline

    A set of data processing elements connected in series, where the output of one element is the input of the next one.

### scripting language

    A programming language that supports scripts, programs written for a special run-time environment that can interpret (rather than compile) and automate the execution of tasks that could alternatively be executed one-by-one by a human operator.

### shell

    A user interface for access to an operating system's services. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer's role and particular operation.

### Update-Help

    Downloads and installs the newest help files on your computer.

### Windows Management Instrumentation (WMI)

    A set of extensions to the Windows Driver Model that provides an operating system interface through which instrumented components provide information and notification. WMI allows scripting languages like VBScript or Windows PowerShell to manage Microsoft Windows personal computers and servers, both locally and remotely.

### Windows Script Host (WSH)

    An automation technology for Microsoft Windows operating systems that provides scripting abilities comparable to batch files, but with a wider range of supported features.

## Assessments

* Flashcards: Quizlet: Windows PowerShell - Introduction
* Quiz: Quizlet: Windows PowerShell - Introduction

## See Also

* Introduction to Microsoft.NET