1 / 21

Module XA

Module XA. Using Windows PowerShell ®. Module Overview. Introduction to Windows PowerShell 3.0 Windows PowerShell Remoting Using Windows PowerShell Cmdlets. Lesson 1: Introduction to Windows PowerShell 3.0.

nuru
Download Presentation

Module XA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Module XA Using WindowsPowerShell®

  2. Module Overview • Introduction to Windows PowerShell 3.0 Windows PowerShell Remoting Using Windows PowerShell Cmdlets

  3. Lesson 1: Introduction to Windows PowerShell 3.0 • Overview of Windows PowerShell Enhancements in Windows PowerShell 3.0 Cmdlets in Windows PowerShell Overview of the Windows PowerShell ISE Demonstration: Using the Windows PowerShell ISE Editor The Windows PowerShell Pipeline Creating and Running Windows PowerShell Scripts

  4. Overview of Windows PowerShell • Windows PowerShell 3.0 is included with Windows 8, and supports existing scripts and command-line tools • Cmdlets are available for performing common system and administration tasks • The .NET framework is leveraged and provides access to thousands of objects • An extensible interface enables enterprise developers to build custom tools and utilities to administer their software • Windows PowerShell accepts and returns .NET objects, which can be directly manipulated or sent to other tools or databases

  5. Enhancements in Windows PowerShell 3.0 • Hundreds of cmdlets • Robust sessions • Windows PowerShell ISE enhancements • Transactions enable managing commands as a logical unit • Windows PowerShell workflows • Scheduled jobs • Enhanced online help • Delegated administration • Show-Command

  6. Cmdlets in Windows PowerShell • Windows PowerShell has rules for naming and implementing cmdlets. • To access the help documentation, run Get-Help or help, followed by the cmdlet name. • Get-Help has parameters to adjust the amount of help displayed. • Other cmdlets that you can use for accessing help: Update-Help, Show-Command, Get-Command,and tab completion Get-Help Get-EventLog • Get-EventLog -help • -detailed • -examples • -full • -online

  7. Overview of the Windows PowerShell ISE The ISE enables you to run commands and design, write, test, and debug scripts in a Windows GUI Windows PowerShell tabs IntelliSense suggestions Script pane Add-in Tools pane Console pane

  8. Demonstration: Using the Windows PowerShell ISE Editor • In this demonstration, you will see how to use Windows PowerShell ISE to perform basic tasks, such as: • Moving and resizing the Console pane, and Script pane • Showing or hiding the Script pane • Changing the text size in all panes of Windows PowerShell ISE • Opening a script file and using IntelliSense

  9. The Windows PowerShell Pipeline • The pipeline connects the output from one cmdlet to the input of another cmdlet • The combination of the first cmdlet, pipe, and second cmdlet makes a pipeline Process Object Get-ADUser Cmdlet Pipe Get-ADUser –Filter * Enable ADAccountCmdlet | Enable-ADAccount

  10. Creating and Running Windows PowerShell Scripts Execution Policy restricts script execution. The execution policies include: • Restricted • AllSigned • RemoteSigned • Bypass • Unrestricted Scripts: • Are text files with a .ps1 extension • Contain one or more PowerShell cmdlets • Require a full or relative path to execute: • .\RunScript.ps1 • E:\Demo\RunScript.ps1

  11. Lesson 2: Windows PowerShell Remoting • Overview of Windows PowerShell Remoting How Remote Commands Are Processed Managing Windows PowerShell Remote Sessions How to Run Remote Commands

  12. Overview of Windows PowerShell Remoting • Remoting features of Windows PowerShell are built on WinRM • Run an individual command, or create a persistent connection or session to run a series of commands • Remote administration also is known as remoting • Three types of remoting: • One-to-Many (Fan-Out) • One-to-One • Many-to-One (Fan-In)

  13. How Remote Commands Are Processed 1. Local computer sends the Windows PowerShell command to the remote computer by using the WinRM protocol • All of the local input to a remote command is collected before any of it is sent to the remote computer • The output is returned to the local computer as it is generated 2. Command runs in Windows PowerShell on the remote computer 3. Command results are sent back by using the WinRM protocol and appear in Windows PowerShell on the local computer

  14. Managing Windows PowerShell Remote Sessions Two types of PowerShell remote sessions: Create a temporary session • You can start an temporary session by using the Invoke-Command cmdlet with the ComputerName parameter • A temporary connection is created for the command and closes the connection when the command completes Create a persistent session • Open a new Windows PowerShell session (PSSession) on the remote computer, then connect to the computer and enter the session • The New-PSSession cmdlet creates the PSSession • The Invoke-Command cmdlet enables cmdlets to be run within the PSSession • You can run as many commands as desired during the session • You must manually close the PSSession by using the Exit-PSSession cmdlet

  15. How to Run Remote Commands To run a remote command on a single computer: • Create a session object for a single computer using New-PSSessionand specifying a single computer using the ComputerName parameter. • Use the ComputerNameparameter to specify a single computer for Invoke-Command. To run a remote command on multiple computers: • Create a session object for multiple computers using New-PSSession and specifying a multiple computers using the ComputerName parameter. • Use the ComputerName parameter to specify multiple computers for Invoke-Command. To run a local script on remote computers: • Use the FilePath parameter of the Invoke-Command cmdlet

  16. Lesson 3: Using Windows PowerShell Cmdlets • Using Conditional Expressions, Loops, and Variables What Is Windows PowerShell Eventing? Group Policy Management Requirements Cmdlets for Group Policy Administration

  17. Using Conditional Expressions, Loops, and Variables • A variable is a temporary holding place in memory for a value, object, or collection of objects • Variables are named and all names are preceded by a $ character $ADDS = Get-ADDomain • There are a number of loop conditions: • Foreach • If • While • for

  18. Eventing is the immediate notification of • important actions or events What Is Windows PowerShell Eventing? • Windows PowerShell supports eventing by listening, acting on, and forwarding management and system events • When registering for an event through remoting, event notifications can be automatically forwarded to a central computer • Windows PowerShell scripts can respond synchronously or asynchronously to system events

  19. To use Group Policy cmdlets, run one of the following: • Windows Server 2008 R2 or higher on a domain controller or on a member server that has the Group Policy Management role installed • Windows 7 or higher with RSAT installed. RSAT includes the Group Policy Management Console and its cmdlets Group Policy Management Requirements • You can use Group Policy settings to specify whether Windows PowerShell scripts run before non-Windows PowerShell scripts during: • User computer startup and shutdown • User logon and logoff • By default, Windows PowerShell scripts run after non-Windows PowerShell scripts. 

  20. Cmdlets for Group Policy Administration Use Windows PowerShell to automate the management of GPOs and the configuration of registry-based settings These cmdlets perform tasks for domain-based GPOs: • Maintain GPOs including GPO creation, removal, backup, and import • Associate GPOs with Active Directory containers • Set inheritance flags and permissions on Active Directory organizational units and domains • Configure registry-based policy settings and Group Policy Preferences Registry settings • Create and edit Starter GPOs

  21. Module Review and Takeaways • Review Questions Tools Best Practice Common Issues and Troubleshooting Tips

More Related