Windows Server 2012 R2 Windows PowerShell Fundamentals

3y ago
75 Views
5 Downloads
1.48 MB
35 Pages
Last View : 16d ago
Last Download : 2m ago
Upload by : Tia Newell
Transcription

Windows Server2012 R2 – WindowsPowerShellFundamentalsWindows PowerShell is a command-line shell and scriptinglanguage that helps IT professionals achieve greater controland productivity. Using a new, admin-focused scriptinglanguage, more than 230 standard command-line tools, andconsistent syntax and utilities, Windows PowerShell allows ITprofessionals to more easily control system administration andaccelerate automation.Produced by HynesITe, Inc.Version 5.211/13/2013Windows Server2012 R2Hands-on lab

This document supports a preliminary release of a software product that may be changed substantially prior to final commercialrelease. This document is provided for informational purposes only and Microsoft makes no warranties, either express or implied, inthis document. Information in this document, including URL and other Internet Web site references, is subject to change withoutnotice. The entire risk of the use or the results from the use of this document remains with the user. Unless otherwise noted, thecompanies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted in examples hereinare fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, orevent is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Withoutlimiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, ortransmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, withoutthe express written permission of Microsoft Corporation.Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matterin this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this documentdoes 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 theMicrosoft group of companies.All other trademarks are property of their respective owners.

Windows Server 2012 R2 – Windows PowerShell FundamentalsIntroductionEstimated time to complete this lab30 minutesObjectivesIn this lab, you will learn the fundamentals of using Windows PowerShell commands, known as cmdlets,including the following techniques: Exploring Windows PowerShell HelpWindows PowerShell has a powerful documentation mechanism. Administrators can query thehelp subsystem with a unified command set. Developers are provided with a set of common toolsto lower the time invested in documentation. Constructing a pipelineWindows 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 commandsWindows PowerShell does not limit the kind of formatting that can be applied to a simple objectnor does it place any restrictions on the destination of the output. Developers can extend thewide range of available choices through the development of cmdlets. Using filtering and sorting commandsAs a complement to formatting, filtering and sorting commands are very useful for cmdlet outputmanipulation. Windows PowerShell provides typical filtering and sorting cmdlets for most tasks,and developers can also extend them by creating new cmdlets. Using -WhatIf and -ConfirmThese are common switches you can apply to cmdlets. Working with variablesLike any Windows-based scripting language, Windows PowerShell has variables too, but they aremuch more powerful than the variables in older scripting languages. Windows PowerShellvariables are actually mapped to underlying classes in the Microsoft .NET Framework. And in theFramework, variables are objects, meaning they can store data and also manipulate it in manyways. Working with providersThe provider represents a set of stored data (e.g. the Microsoft Windows Registry, the Windowsfile system, Active Directory) that can be accessed and navigated through Windows PowerShellcommands.Lab created by HynesITe, Inc. For questions or comments, send an email message to labs@holsystems.comPage 3

Windows Server 2012 R2 – Windows PowerShell FundamentalsPrerequisitesBefore 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 labWindows PowerShell is a command-line shell and scripting language that helps IT professionals achievegreater control and productivity. Using a new admin-focused scripting language, more than 230 standardcommand-line tools, and consistent syntax and utilities, Windows PowerShell allows IT professionals tomore easily control system administration and accelerate automation.Intended audienceThis lab is intended for network administrators who wish to learn the Windows PowerShell interface andlanguage.Virtual machine technologyThis lab is completed using virtual machines that run on Windows Server 2012 Hyper-V technology. Tolog on to the virtual machines, press CTRL ALT END and enter the following credentials: Username: Administrator Password: Passw0rd!Computers in this labThis lab uses computers as described in the following table. Before you begin the lab, you must ensurethat the virtual machines are started and then log on to the computers.ComputerRoleConfigurationDCDomain controllerDomain controllerAll user accounts in this lab use the password Passw0rd!Note regarding pre-release softwarePortions of this lab include software that is not yet released, and as such may still contain active or knownissues. While every effort has been made to ensure this lab functions as written, unknown or unanticipatedresults may be encountered as a result of using pre-release software.Note regarding user account controlSome steps in this lab may be subject to user account control. User account control is a technology whichprovides additional security to computers by requesting that users confirm actions that requireadministrative rights. Tasks that generate a user account control confirmation are denoted using a shieldicon. If you encounter a shield icon, confirm your action by selecting the appropriate button in the dialogbox that is presented.Note on activationThe 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 ofLab created by HynesITe, Inc. For questions or comments, send an email message to labs@holsystems.comPage 4

Windows Server 2012 R2 – Windows PowerShell Fundamentalssoftware has been taken into account in the design of the lab. Consequently, the lab is in no way affectedby this state. For operating systems other than Windows 8, please press Cancel or Close if prompted by anactivation dialog box. If you are prompted by an Activate screen for Windows 8, press the Windows key todisplay the Start screen.Lab created by HynesITe, Inc. For questions or comments, send an email message to labs@holsystems.comPage 5

Windows Server 2012 R2 – Windows PowerShell FundamentalsExercise 1: Exploring Windows PowerShellIn 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 valuedata types.Reviewing the help available in Windows PowerShellIn 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 WindowsPowerShell.2.At the Windows PowerShell command prompt, type the following command, and then pressENTER 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@holsystems.comPage 6

Windows Server 2012 R2 – Windows PowerShell FundamentalsFigure 1: Executing the Help commandIn the output you can see a second column with a value of Alias, Cmdlet, Provider, or HelpFile. An alias isan alternative name for a command, usually an abbreviation or a name used by other shells for similarfunctionality. Cmdlets are .NET classes that are exposed as APIs, commands, and GUIs. Providers areextensions to Windows PowerShell that provide features such as policy verification or metadataaugmentation. Help files contain information for different topics, including command descriptions andtopics on how to extend Windows PowerShell.4.Press SPACE BAR until the command prompt returns. Alternatively, you can type the letter Q tocancel the output.5.To view help information about the Get-Command cmdlet, at the Windows PowerShell commandprompt, type the following command, and then press ENTER. help Get-CommandThe help contains the syntax for the command as well as a brief description.Figure 2: Obtaining help for the Get-Command cmdlet6.To see detailed help for the Get-Command cmdlet, at the Windows PowerShell commandprompt, type the following command, and then press ENTER. help Get-Command -DetailedThe 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@holsystems.comPage 7

Windows Server 2012 R2 – Windows PowerShell FundamentalsFigure 3: Obtaining help for the Get-Command cmdlet in detailed mode7.To view the entire help content for the Get-Command cmdlet, at the Windows PowerShellcommand prompt, type the following command, and then press ENTER. help Get-Command –FullFigure 4: View the entire help content for the Get-Command cmdletLab created by HynesITe, Inc. For questions or comments, send an email message to labs@holsystems.comPage 8

Windows Server 2012 R2 – Windows PowerShell FundamentalsThe full help for the cmdlet includes parameter data types and notes. This is a technical view of thecommand’s help.Help regarding conceptual topics in Windows PowerShell begins with the prefix about . To display helpabout a Windows PowerShell concept, type Get-Help followed by the concept name. To view a list ofconceptual topics, type Get-Help about.List the commands available in Windows PowerShellIn this step, you will list all available commands in Windows PowerShell.1.To view the list of available commands, at the Windows PowerShell command prompt, type thefollowing command, and then press ENTER. Get-Command2.Review the list of commands available. Take note of the naming convention for commands with aCommandType of Cmdlet.Figure 5: List of Windows PowerShell commandsWindows PowerShell uses verb-noun naming conventions to make cmdlets discoverable and obvious inwhat they do.3.At the command prompt, type the following command, but do not press ENTER. Get-CLab created by HynesITe, Inc. For questions or comments, send an email message to labs@holsystems.comPage 9

Windows Server 2012 R2 – Windows PowerShell Fundamentals4.Press TAB. Windows PowerShell expands the command to Get-CAAuthorityInformationAccess.5.Press TAB again. The command is changed to Get-CACrlDistributionPoint.If you do not see these cmdlets, make sure you are performing the steps on DC.6.You can continue pressing TAB to cycle through all the available commands that begin withGet-C. Similarly, you can cycle backwards by pressing SHIFT-TAB.You can easily display a list of available Windows PowerShell commands. In addition, you can enter aportion of a command name and use tab-completion to resolve the partial command to a full WindowsPowerShell command.7.Press ENTER to execute the expanded Windows PowerShell command.Format and filter output using Windows PowerShellIn this step, you will learn how to use command parameters and cmdlets to filter data. Also, you will learnhow to format the displayed output.1.To view a list of services installed on the computer, at the Windows PowerShell command prompt,type the following command, and then press ENTER. Get-ServiceA list of services is displayed.Figure 6: The Get-Service commandLab created by HynesITe, Inc. For questions or comments, send an email message to labs@holsystems.comPage 10

Windows Server 2012 R2 – Windows PowerShell FundamentalsWindows PowerShell provides a complete set of verbs to query and manipulate services, including Get,New, Restart, Resume, Set, Start, Stop, and Suspend. To view a list of service related commands typeGet-Command -Noun Service.2.Enter the following to view the status of the Spooler service: Get-Service –Name SpoolerFigure 7: Status of the Spooler serviceThe Get-Service command resolves the first input as the name parameter when you do not specify aparameter name for the input.3.Enter the following command to obtain the same result as the previous step. Get-Service SpoolerYou can use positioned or named parameters when you invoke cmdlets. Windows PowerShell providesbuilt-in code that relieves cmdlet developers from having to parse program parameters.4.Type the following command, and then press ENTER to view a list of all services that begin withM. Get-Service M*The status of all the services beginning with M is shown.Figure 8: Status of the services beginning with MMany cmdlets a

Windows Server 2012 R2 – Windows PowerShell Fundamentals Lab created by HynesITe, Inc. For questions or comments, send an email message to labs@holsystems.com Page 6 Exercise 1: Exploring Windows PowerShell In this exercise, you will explore several Windows PowerShell commands and features including help, object formatting, and safety features.

Related Documents:

Windows Server 2012 R2 Datacenter 1.3 In-place Upgrade to Windows Server 2012 R2 Performing an in-place upgrade from Windows Server 2012 or Windows Server 2008 R2 to Windows Server 2012 R2 is not recommended because this may adversely affect files and the registry. If you want to use Windows Server 2012 R2, please read this document and back-up

Several LTSC Windows Server versions that are supported with SC Series are in various phases of mainstream or extended Microsoft support: Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, and Windows Server 2019. Microsoft extended support for Windows Server 2008 R2 is scheduled to end in January 2020.

Web Server Hardware Processor - Fast Multi Core or Multi Processor Memory - 4 gig Disk - 500MB Operating System Windows Server 2008 Windows Server 2008 R2 Windows Server 2012 Windows Server 2012 R2 Windows Server 2016 Windows Server 2019 Windows Server 2022 Software IIS 7, 7.5, 8, 8.5 & 10

Bitlocker Administration and Monitoring MBAM Anforderungen: Hardware: 4 CPUs 12 GB RAM 100 GB Disk OS: Windows Server 2008 R2 SP1 Windows Server 2012/R2 Windows Server 2016 SQL Server: SQL Server 2008 R2 SQL Server 2012 SP1 SQL Server 2012 SP2 SQL Server 2014 SQL Server 2014 SP1

A computer with at least a 450MHz Pentium CPU with 128 MB of RAM, running Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7, Windows 8/8.1, Windows 10, Windows Server 2012, Windows Server 2016 or Windows Server 2019 platforms. Instal

Windows Server 2012 Standard Additional Licenses apply for Windows Server 2012 R2 Standard. “Additional licenses” for Windows Server 2012 Datacenter—Each HP OEM license for Windows Server 2012 Datacenter and Windows Server 2012 R2 Datacenter support up to 2 physical processors and an unlimited

Windows Server 2008 R2 SP1 (64 bit) ** [Recommended] Windows Server 2012, Windows Server 2012 R2, Windows Server 2016, or Windows Server 2019 Other Windows Installer 4.5 . SQL Server 2012 (Express, Web, Standard and Enterprise Edition) SQL Server 2014 (Ex

Microsoft Windows Server 2008 R2 SP1 Standard Edition Microsoft Windows Server 2008 R2 SP1 Datacenter Edition Microsoft Windows Server 2012 Family SAS 9.4 Foundation is supported on the following editions of the Windows Server 2012 family with SAS 9.4 TS1M1 and higher: Microsoft Windows Server 2012 Foundation Edition Microsoft Windows Server .