Windows Server 2012 R2 Windows PowerShell Fundamentals
[Pages:35]Windows Server 2012 R2 ? Windows PowerShell Fundamentals
Windows Server 2012 R2
Hands-on lab
Windows PowerShell is a command-line shell and scripting language that helps IT professionals achieve greater control and productivity. Using a new, admin-focused scripting language, more than 230 standard command-line tools, and consistent syntax and utilities, Windows PowerShell allows IT professionals to more easily control system administration and accelerate automation.
Produced by HynesITe, Inc. Version 5.2 11/13/2013
This document supports a preliminary release of a software product that may be changed substantially prior to final commercial release. This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, in this document. Information in this document, including URL and other Internet Web site references, is subject to change without notice. The entire risk of the use or the results from the use of this document remains with the user. Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted in examples herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.
Copyright 2013 ? Microsoft Corporation. All rights reserved.
Microsoft, Active Directory, Windows 7, Windows PowerShell, Windows Server 2012, and Windows Vista are trademarks of the Microsoft group of companies.
All other trademarks are property of their respective owners.
Windows Server 2012 R2 ? Windows PowerShell Fundamentals
Introduction
Estimated time to complete this lab
30 minutes
Objectives
In this lab, you will learn the fundamentals of using Windows PowerShell commands, known as cmdlets, including the following techniques:
Exploring Windows PowerShell Help Windows PowerShell has a powerful documentation mechanism. Administrators can query the help subsystem with a unified command set. Developers are provided with a set of common tools to lower the time invested in documentation.
Constructing a pipeline Windows PowerShell is different from other shells because it does not use strings as parameters; instead it uses .NET objects which can be navigated, processed, reflected, and formatted.
Using formatting commands Windows PowerShell does not limit the kind of formatting that can be applied to a simple object nor does it place any restrictions on the destination of the output. Developers can extend the wide range of available choices through the development of cmdlets.
Using filtering and sorting commands As a complement to formatting, filtering and sorting commands are very useful for cmdlet output manipulation. Windows PowerShell provides typical filtering and sorting cmdlets for most tasks, and developers can also extend them by creating new cmdlets.
Using -WhatIf and -Confirm These are common switches you can apply to cmdlets.
Working with variables Like any Windows-based scripting language, Windows PowerShell has variables too, but they are much more powerful than the variables in older scripting languages. Windows PowerShell variables are actually mapped to underlying classes in the Microsoft? .NET Framework. And in the Framework, variables are objects, meaning they can store data and also manipulate it in many ways.
Working with providers The provider represents a set of stored data (e.g. the Microsoft Windows Registry, the Windows file system, Active Directory) that can be accessed and navigated through Windows PowerShell commands.
Lab created by HynesITe, Inc. For questions or comments, send an email message to labs@
Page | 3
Windows Server 2012 R2 ? Windows PowerShell Fundamentals
Prerequisites
Before working on this lab, you must have:
1. An understanding of concepts such as virtual machines, virtual hard disks, and virtual networks. 2. The ability to work in a command-line environment.
Overview of the lab
Windows PowerShell is a command-line shell and scripting language that helps IT professionals achieve greater control and productivity. Using a new admin-focused scripting language, more than 230 standard command-line tools, and consistent syntax and utilities, Windows PowerShell allows IT professionals to more easily control system administration and accelerate automation.
Intended audience
This lab is intended for network administrators who wish to learn the Windows PowerShell interface and language.
Virtual machine technology
This lab is completed using virtual machines that run on Windows Server 2012 Hyper-V technology. To log on to the virtual machines, press CTRL+ALT+END and enter the following credentials:
Username: Administrator Password: Passw0rd!
Computers in this lab
This lab uses computers as described in the following table. Before you begin the lab, you must ensure that the virtual machines are started and then log on to the computers.
Computer
Role
Configuration
DC
Domain controller
Domain controller
All user accounts in this lab use the password Passw0rd!
Note regarding pre-release software
Portions of this lab include software that is not yet released, and as such may still contain active or known issues. While every effort has been made to ensure this lab functions as written, unknown or unanticipated results may be encountered as a result of using pre-release software.
Note regarding user account control
Some steps in this lab may be subject to user account control. User account control is a technology which provides additional security to computers by requesting that users confirm actions that require administrative rights. Tasks that generate a user account control confirmation are denoted using a shield icon. If you encounter a shield icon, confirm your action by selecting the appropriate button in the dialog box that is presented.
Note on activation
The virtual machines for these labs may have been built by using software that has not been activated. This is by design in the lab to prevent the redistribution of activated software. The unactivated state of
Lab created by HynesITe, Inc. For questions or comments, send an email message to labs@
Page | 4
Windows Server 2012 R2 ? Windows PowerShell Fundamentals
software has been taken into account in the design of the lab. Consequently, the lab is in no way affected by this state. For operating systems other than Windows 8, please press Cancel or Close if prompted by an activation dialog box. If you are prompted by an Activate screen for Windows 8, press the Windows key to display the Start screen.
Lab created by HynesITe, Inc. For questions or comments, send an email message to labs@
Page | 5
Windows Server 2012 R2 ? Windows PowerShell Fundamentals
Exercise 1: Exploring Windows PowerShell
In this exercise, you will explore several Windows PowerShell commands and features including help, object formatting, and safety features.
Perform all the exercises on DC. Every command has three different levels of help available: 1. The default view shows the command description and syntax. 2. The detailed view adds usage examples and complete documentation. 3. The full view adds command's technical details including parameter and return value
data types.
Reviewing the help available in Windows PowerShell
In this step, you will learn how to view the different levels of help content available for a cmdlet. 1. To open a new Windows PowerShell command window, on the taskbar, click Windows PowerShell. 2. At the Windows PowerShell command prompt, type the following command, and then press ENTER to see a list of available help topics. help *
3. The command will fill an entire screen and then pause. Press ENTER to show the next output line, or press SPACE BAR to advance to the next page.
Lab created by HynesITe, Inc. For questions or comments, send an email message to labs@
Page | 6
Windows Server 2012 R2 ? Windows PowerShell Fundamentals
Figure 1: Executing the Help command In the output you can see a second column with a value of Alias, Cmdlet, Provider, or HelpFile. An alias is an alternative name for a command, usually an abbreviation or a name used by other shells for similar functionality. Cmdlets are .NET classes that are exposed as APIs, commands, and GUIs. Providers are extensions to Windows PowerShell that provide features such as policy verification or metadata augmentation. Help files contain information for different topics, including command descriptions and topics on how to extend Windows PowerShell.
4. Press SPACE BAR until the command prompt returns. Alternatively, you can type the letter Q to cancel the output.
5. To view help information about the Get-Command cmdlet, at the Windows PowerShell command prompt, type the following command, and then press ENTER. help Get-Command
The help contains the syntax for the command as well as a brief description.
Figure 2: Obtaining help for the Get-Command cmdlet 6. To see detailed help for the Get-Command cmdlet, at the Windows PowerShell command
prompt, type the following command, and then press ENTER. help Get-Command -Detailed
The output includes details about the parameters for the cmdlet, as well as some examples.
Lab created by HynesITe, Inc. For questions or comments, send an email message to labs@
Page | 7
Windows Server 2012 R2 ? Windows PowerShell Fundamentals
Figure 3: Obtaining help for the Get-Command cmdlet in detailed mode 7. To view the entire help content for the Get-Command cmdlet, at the Windows PowerShell
command prompt, type the following command, and then press ENTER. help Get-Command ?Full
Figure 4: View the entire help content for the Get-Command cmdlet Lab created by HynesITe, Inc. For questions or comments, send an email message to labs@
Page | 8
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- powershell jumpstart for sql server dbas
- sql server 2014 with powershell v5 cookbook
- windows server 2012 r2 windows powershell fundamentals
- 05 9780672330568 8 19 10 3 26 pm page 103
- powershell commands usalearning
- powershell the ultimate windows powershell beginners guide
- sql server hacking on scale using powershell