This document is a slide deck presentation about managing an enterprise from a single seat using Windows PowerShell remoting. The presentation introduces PowerShell remoting, how it works using WinRM, and how to enable and use remoting for 1:1 connections, running commands on multiple computers simultaneously, using persistent sessions, and leveraging implicit remoting to access remote modules. The presentation is copyrighted material from Concentrated Technology that can be used within one's own organization and provides contact information for the company.
2. Managing Your Enterprise from a Single Seat: Windows PowerShell Remoting Don Jones Senior Partner and Technologist Concentrated Technology, LLC Required Slide SESSION CODE: WSV319
4. Introductions Me: Don Jones, Concentrated Technology Microsoft MVP Award recipient Contributing Editor, TechNet Magazine Author of 45+ IT books Blogger at http://ConcentratedTech.com You: A Busy Windows Administrator Looking to enable single-seat administration Comfortable with command-line tools and utilities
6. How Remoting Works Utilizes WinRM v2 First shipped with PowerShell v2, installs with PowerShell v2 Auto-starts on servers, but not on clients (consider configuring to auto-start) Communicates via HTTP or HTTPS Default ports are not 80/443; ports can be customized Applications register with WinRM as an endpoint This tells WinRM the application is there WinRM must be configured to permit this (e.g., secure by default) Also: WS-MAN (Web Services for Management) is the protocol name
7. PowerShell Requirements PowerShell v2 only on both ends Ships with Win7 and Win2008R2; downloadable for Win2003, Vista, WinXP Must explicitly enable WinRM, register PowerShell as an endpoint, on machine that will accept incoming connections Run Enable-PSRemotingor Disable-PSRemoting (to disable) No configuration needed on computers that will initiate connections (e.g., where you are physically sitting) Remoting is a strong argument for deploying PowerShell v2 everywhere and enabling remoting Remoting can also be controlled via Group Policy object (download ADM template for Win2008 and Win2003; comes with Win2008R2)
9. 1:1 Remoting Think “SSH” functionality – interactive remote command line Use Enter-PSSession and computer name to start Use Exit-PSSession to “go home” and close the connection Help for Enter-PSSession shows parameters for specifying non-default ports, alternate credentials, etc.
11. 1:Many Remoting Use Invoke-Command with a list of computer names (many ways to provide that list) Specify a command in a –scriptblock {}, or specify a –file to run Local files will be pushed out to the remote computer(s) -command is an alias for –scriptblock Separate multiple commands with ; in the scriptblock Throttled to 32 machines at once by default (can modify) Can specify alternate ports/credentials/etc Runs synchronously; use –AsJob to run as a background job
12. What Comes Back Results on the remote computers are serialized into XML for transmission across the wire PSComputerName property is added with the name of the computer each object came from (useful for sorting/grouping) XML is deserialized when received on your end, and turned back into objects Deserialized objects are not “live;” they are snapshots, and do not contain methods (e.g., they’re static) Ran as a job? Use Receive-Job to get the results objects from the job (specify –keep to keep the results cached, or capture them into a variable or something)
14. Sessions Specifying –computerName with Invoke-Command or Enter-PSSession creates a session, uses it, and then closes it Inconvenient if you want to connect to the same computer again and again, especially if you’re specifying ports/credentials/etc Use New-PSSession to create persistent connections Consumes memory/process (a tiny bit) on both ends Use Remove-PSSession to close connections; Get-PSSession to get a list of them Pass session to –session parameter of Invoke-Command or Enter-PSSession to re-use the session
16. A Troubling Scenario New modules are shipping all the time – such as the ActiveDirectory module in Windows Server 2008 R2 These modules often can’t be installed on older versions of Windows The trick is to have remoting enabled on a machine where the module can be run… …and to use implicit remoting to make it look like that module is installed on your local computer
19. Summary WinRM implements the WS-MAN service that makes it work Enable remoting on receiving machines only Use Enter-PSSession and Invoke-Command Persistent sessions with *-PSSession Implicit remoting for easier access to remote modules Any last questions? Windows PowerShell v2: TFM on sale in the TechEd Bookstore!
20. Track Resources Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub. Resource 1 Resource 2 Resource 3 Resource 4
21. Resources Required Slide Learning Sessions On-Demand & Community Microsoft Certification & Training Resources www.microsoft.com/teched www.microsoft.com/learning Resources for IT Professionals Resources for Developers http://microsoft.com/technet http://microsoft.com/msdn
22. Related Content Required Slide Speakers, please list the Breakout Sessions, Interactive Sessions, Labs and Demo Stations that are related to your session. Breakout Sessions (session codes and titles) Interactive Sessions (session codes and titles) Hands-on Labs (session codes and titles) Product Demo Stations (demo station title and location)