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
editAfter 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
editMultimedia
editExamples
editGet-Help
editThe Get-Help cmdlet displays information about Windows PowerShell commands and concepts.[1]
Get-Help
Get-Host
editThe 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-Help
editThe Update-Help cmdlet downloads and installs the newest help files on your computer.[3]
Update-Help
Activities
edit- 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
edit- 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 Terms
edit- 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 Questions
edit1.
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.
Assessments
editSee Also
editReferences
edit- ↑ Microsoft TechNet: Get-Help
- ↑ Microsoft TechNet: Get-Host
- ↑ Microsoft TechNet: Update-Help
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia: Windows PowerShell
- ↑ Wikipedia:CMD.EXE
- ↑ Wikipedia: Component Object Model
- ↑ Wikipedia:COMMAND.COM
- ↑ Wikipedia: Compiler
- ↑ Wikipedia: Command-line interface
- ↑ Microsoft TechNet: Using the Get-Help Cmdlet
- ↑ Microsoft TechNet: Get-Host
- ↑ Wikipedia: Interpreted language
- ↑ Wikipedia: .NET Framework
- ↑ Wikipedia: Pipeline (computing)
- ↑ Wikipedia: Scripting language
- ↑ Wikipedia: Shell (computing)
- ↑ Microsoft TechNet: Update-Help
- ↑ Wikipedia: Windows Management Instrumentation
- ↑ Wikipedia: Windows Script Host