1 / 33

Managing Windows Server 2008 R2 and Windows 7 with Windows PowerShell V2

Managing Windows Server 2008 R2 and Windows 7 with Windows PowerShell V2. Corey Hynes HynesITe, Inc Session Code: SRV317. Objectives. Let you walk out of here, being able to run a script against an OU of computers, to make some sort of global configuration change. Assumption.

peregrine
Download Presentation

Managing Windows Server 2008 R2 and Windows 7 with Windows PowerShell V2

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. Managing Windows Server 2008 R2 and Windows 7 with Windows PowerShell V2 Corey Hynes HynesITe, Inc Session Code: SRV317

  2. Objectives • Let you walk out of here, being able to run a script against an OU of computers, to make some sort of global configuration change

  3. Assumption • You understand fundamental PowerShell • You are willing to learn how to write code

  4. What will we cover? • PowerShell V2 tools • Remoting • Modules • Lots of details about individual modules • PowerShell code to run commands against multiple computers • Tips and Tricks • Lots of Demos

  5. PowerShell, why you should care? • New model for administration and administrative tools • Gives ITPro’s the same ability as a developer to manipulate Windows • GUI now runs on PowerShell • Scripts, samples, guidance, all come as PowerShellscripts

  6. Tools • PowerShell Console • PowerShell ISE • Modules • Remoting • Forms

  7. PowerShell ISE • Simplify authoring of scripts • Save • Execute partial scripts • Debug • Color coding • Default on Win7 • Add to R2

  8. Remoting • This is what makes this session possible • Module: None, build in. • Key Cmdlets • Invoke-Command • New-PSSession • Enter-PSSession • Exit-PSSession • Notes • Must be enabled, GUI or Enable-PSRemoting

  9. Conceptual Model of Remoting RunSpace ScriptBlock Results Get-Service IP LAN

  10. Working in Interactive Sessions • Key Cmdlets • Enter-PSSession to start a new session • Exit-PSSession to end a new session • Session objects • New-PSSession • Note • Interactive sessions are not supported on Core

  11. Modules • Discrete collections of cmdlets • Can be authored and deployed to give you “packages” of functionality • Stored in file system • System32\WindowsPoweshell\1.0\Modules • Roles and Features add new Cmdlets • You can use a remote computer’s modules

  12. Working with Modules • Import-Module to load a module • Get-Module to load a module • Get-Command –Module <Name> to see what is in a module

  13. Managing Windows How to perform some really simple and easy things…..

  14. TroubleShooting Packs • Known as the “troubleshooters” • Module: Troubleshootingpack • Key Cmdlets • Get-Troubleshootingpack <path> • Invoke-Troubleshootingpack <path> • Notes • C:\Windows\Diagnostics\System contain build-in troubleshooting packs

  15. Role and Feature Management • Replaces ServerManager.exe • Module: ServerManager • Key Cmdlets • Get-WindowsFeature <FeatureName> • Add-WindowsFeature <FeatureName> • Properties Name, Parent, Installed, Dependson • Notes • Server Core, have to add ServerManager-PSH-Cmdlets

  16. Group Policy • Replaces: Lots of little tools and scripts • Module: GroupPolicy (part of GPMC) • Key CmdLets • Get-GPO, New-GPO • Backup-GPO • Copy-GPO • Get-GPOReport • Notes • Limited ability to “edit” GPO.

  17. Active Directory • Replaces: Scripts that were shipped with previous versions • Module: Active Directory • Key CmdLets: • Way too many to list • Over 75 Cmdlets • Notes • Requires that you have one 2008 R2 DC running the AD Web Service

  18. Best Practices • Replaces: Nothing, brand new • Module: BestPractices • Key Cmdlets • Get-BPAModel • Invoke-BPAModel • Notes: • Not all roles have BPA models that can be run. • Updates via Microsoft Update.

  19. Additional Modules • ADRMS – Rights Management • ADRMSAdmin – Rights Management Admin • AppLocker • BitsTransfer • FailoverClusters • RemoteDesktopSearvices • WebAdministration • NetworkLoadBalancing

  20. Scaling 1 to Many Running commands across many systems

  21. Known Systems • If you know the names and quantity of your targets • Use Invoke-Command with –ScriptBlockand multiple computer names

  22. Unknown Systems • If you do not know the names/quantity • You have to query for that information • Many options • Query from file • Query from Active Directory • Query results in a collection of computer names • Use a foreach loop to pass instructions to each computer

  23. Executing more Complicated Scripts • You can’t always write a One-Liner • To complex • Hard to read • Multi-line Scriptblock • Use { and } with ; to separate the lines • Exectute the script

  24. Loops • Key item to know is ForEach loop • Simple Strucure ForEach ($Object in $Objects) { $Object.DoSomething }

  25. Running “normal” commands • Not straight forward • Need to combine command and parameters • Suggestion • Shell using Cmd /C • Provide/construct string as command to run

  26. Configuration and Requirements

  27. How do I do this? • Enable remote management • Server Manager on WS08 R2 • PowerShell on ServerCore • PowerShell on Win7 • Firewall Rules and Authentication • Authentication is Kerberos • Security is WMI based security • Firewall rules Allow port 5985 for HTTP

  28. A word on Security • Big topic, not this session • In general • Authentication is Kerberos/NTLM or specified • Wire encryption can be HTTPS or IPSec • HTTPS part of WINRM configuration • IPSec outside WINRM • Remoting disabled by default • You can restrict what remote sessions can do • Query data, make changes, all or none

  29. Related Material • WSV08-HOL - Introduction to Windows PowerShell Fundamentals (40, 88, 3.14) • WSV03-HOL - Advanced Windows PowerShell Scripting (38, 54, 3.19) • WSV19-HOL - Windows Server 2008 R2: Server Management and Windows PowerShell V2 (39, 29, 3.34) • WSV20-HOL - Windows Server 2008 R2: What's New in Microsoft Active Directory (38, 53, 2.76)

  30. Complete an evaluation on CommNet and enter to win an Xbox 360 Elite!

  31. Required Slide © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related