Managing enterprise with PowerShell remoting

889 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
889
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
25
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Managing enterprise with PowerShell remoting

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

×