Open main menu

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 SkillsEdit

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.

ReadingsEdit

MultimediaEdit

ExamplesEdit

Get-HelpEdit

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

Get-Help

Get-HostEdit

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.[2]

Get-Host

Update-HelpEdit

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

Update-Help

ActivitiesEdit

  1. Review Microsoft: Windows PowerShell. Identify the different resources available to learn and use PowerShell, and the different versions of PowerShell available for download.
  2. 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.
  3. Review Microsoft MSDN: Starting Windows PowerShell. Start PowerShell. Then start PowerShell ISE. Compare the two PowerShell environments.
  4. 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.
  5. 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.
  6. 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
    
  7. Review Microsoft: Windows PowerShell Quick Reference. Download the reference and print or save it for future use.

Lesson SummaryEdit

  • 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.[4]
  • PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems.[5]
  • Administrative tasks in PowerShell are generally performed by cmdlets.[6]
  • PowerShell console help is accessed using the Get-Help cmdlet and is updatable with fresh content using the Update-Help cmdlet.[7]
  • PowerShell can execute four kinds of named commands: cmdlets, scripts, functions, and executable programs.[8]
  • PowerShell scripts are saved with a .ps1 file extension.[9]
  • Cmdlets follow a <verb>—<noun> naming pattern.[10]
  • Cmdlets output their results as objects.[11]
  • PowerShell implements the concept of a pipeline, which enables the output of one cmdlet to be piped as input to another cmdlet.[12]
  • PowerShell pipelines are used to compose complex commands, using the | operator to connect stages.[13]
  • Windows PowerShell includes a dynamically typed scripting language which supports variables, functions, conditions, loops, structured error/exception handling, as well as integration with .NET.[14]
  • Variables in PowerShell scripts have names that start with $, and they can be assigned any value, including the output of cmdlets.[15]
  • $_ refers to the current object in the pipeline.[16]
  • PowerShell script execution is disabled by default and must be enabled explicitly.[17]
  • PowerShell 2.0 is integrated with Windows 7 and Windows Server 2008 R2.[18]
  • PowerShell 3.0 is integrated with Windows 8 and Windows Server 2012.[19]
  • PowerShell 4.0 is integrated with Windows 8.1 and Windows Server 2012 R2.[20]
  • PowerShell 3.0 and 4.0 may be installed on Windows 7 and later operating systems.[21]

Key TermsEdit

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).[22]
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.[23]
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.[24]
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).[25]
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).[26]
Get-Help
Retrieves a list of all available help topics.[27]
Get-Host
Gets an object that represents the current host program.[28]
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.[29]
.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.[30]
pipeline
A set of data processing elements connected in series, where the output of one element is the input of the next one.[31]
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.[32]
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.[33]
Update-Help
Downloads and installs the newest help files on your computer.[34]
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.[35]
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.[36]

Review QuestionsEdit

Enable JavaScript to hide answers.
Click on a question to see the answer.
1. Windows PowerShell is a _____ and _____ from Microsoft, consisting of a _____ and _____ built on the _____.
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.
2. PowerShell provides full access to _____ and _____, enabling administrators to perform administrative tasks on _____.
PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems.
3. Administrative tasks in PowerShell are generally performed by _____.
Administrative tasks in PowerShell are generally performed by cmdlets.
4. PowerShell console help is accessed using the _____ cmdlet and is updatable with fresh content using the _____ cmdlet.
PowerShell console help is accessed using the Get-Help cmdlet and is updatable with fresh content using the Update-Help cmdlet.
5. PowerShell can execute four kinds of named commands: _____, _____, _____, and _____.
PowerShell can execute four kinds of named commands: cmdlets, scripts, functions, and executable programs.
6. PowerShell scripts are saved with a _____ file extension.
PowerShell scripts are saved with a .ps1 file extension.
7. Cmdlets follow a _____ naming pattern.
Cmdlets follow a <verb>—<noun> naming pattern.
8. Cmdlets output their results as _____.
Cmdlets output their results as objects.
9. PowerShell implements the concept of a _____, which enables the output of one cmdlet to be _____ as input to another cmdlet.
PowerShell implements the concept of a pipeline, which enables the output of one cmdlet to be piped as input to another cmdlet.
10. PowerShell _____ are used to compose complex commands, using the _____ operator to connect stages.
PowerShell pipelines are used to compose complex commands, using the
11. Windows PowerShell includes a dynamically typed scripting language which supports _____, _____, _____, _____, _____, as well as integration with _____.
Windows PowerShell includes a dynamically typed scripting language which supports variables, functions, conditions, loops, structured error/exception handling, as well as integration with .NET.
12. Variables in PowerShell scripts have names that start with _____, and they can be assigned _____.
Variables in PowerShell scripts have names that start with $, and they can be assigned any value, including the output of cmdlets.
13. _____ refers to the current object in the pipeline.
$_ refers to the current object in the pipeline.
14. PowerShell script execution is _____ by default and must be _____ explicitly.
PowerShell script execution is disabled by default and must be enabled explicitly.
15. PowerShell 2.0 is integrated with _____.
PowerShell 2.0 is integrated with Windows 7 and Windows Server 2008 R2.
16. PowerShell 3.0 is integrated with _____.
PowerShell 3.0 is integrated with Windows 8 and Windows Server 2012.
17. PowerShell 4.0 is integrated with _____.
PowerShell 4.0 is integrated with Windows 8.1 and Windows Server 2012 R2.
18. PowerShell 3.0 and 4.0 may be installed on _____ and later operating systems.
PowerShell 3.0 and 4.0 may be installed on Windows 7 and later operating systems.

AssessmentsEdit

See AlsoEdit

ReferencesEdit