Required Slide<br />
Inventory Your Network and Clientswith Windows PowerShell<br />Don Jones<br />Senior Partner and Technologist<br />Concent...
This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it withi...
Introductions<br />Me: Don Jones, Concentrated Technology<br />Microsoft MVP Award recipient<br />Contributing Editor, Tec...
Agenda<br />Windows PowerShell, Briefly<br />Windows Management Instrumentation, Briefly<br />Exploring WMI<br />Playing w...
Windows PowerShell, Briefly<br />This session’s code will work with v1 and v2 (up until “advanced functions” at the very e...
Security Notes<br />Windows PowerShell disables script execution (but not commands) by default; see Help about_execution* ...
WMI, Briefly<br />Present since Windows NT 4.0<br />Does not require PowerShell on the remote computer<br />Uses Remote Pr...
WMI Security<br />Configured (by default) on the root namespace<br />Typically, don’t mess with this – many things rely on...
WMI Security and Namespaces<br />DEMO<br />
Differences from Machine to Machine<br />WMI namespaces will vary based on the roles/products/technologies installed on a ...
Documentation<br />Easiest: Plug class name into favorite search engine<br />First 1-2 results usually msdn.microsoft.com/...
Exploring WMI<br />DEMO<br />
Using PowerShell Locally<br />Use Get-WmiObjectcmdlet<br />Cannot specify alternate credentials for local connections (by ...
Filtering Results<br />Use –filter parameter to narrow down instances returned (large result sets can take a lot of time a...
WMI in PowerShell, Locally<br />DEMO<br />
Going Remote<br />Use –computerName parameter to specify remote computer(s)<br />-computername ”Client17”<br />-computerna...
Multiple Computers<br />Remote connections are synchronous and sequential (not parallel)<br />Use –AsJob to run in backgro...
WMI in PowerShell, Remotely<br />DEMO<br />
The Steps<br />Move command into a “batch file” for easier repetition<br />Enclose command in a function for parameterizat...
Building a WMI Tool<br />DEMO<br />Remember! I’ll save all my scripts and make them downloadable fromwww.ConcentratedTech....
Conclusion<br />WMI + PowerShell = Very Powerful, Very Convenient<br />And a great way to learn PowerShell incrementally!<...
Track Resources<br />Required Slide <br />Track PMs will supply the content for this slide, which will be inserted during ...
Resources<br />Required Slide<br />Learning<br />Sessions On-Demand & Community<br />Microsoft Certification & Training Re...
Related Content<br />Required Slide<br />Speakers, please list the Breakout Sessions, Interactive Sessions, Labs and Demo ...
Required Slide<br />Complete an evaluation on CommNet and enter to win!<br />
© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be...
This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it withi...
Upcoming SlideShare
Loading in...5
×

Inventory your network and clients with PowerShell

1,174

Published on

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

  • Be the first to like this

No Downloads
Views
Total Views
1,174
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Inventory your network and clients with PowerShell

  1. 1. Required Slide<br />
  2. 2. Inventory Your Network and Clientswith Windows PowerShell<br />Don Jones<br />Senior Partner and Technologist<br />Concentrated Technology, LLC<br />Required Slide<br />SESSION CODE: WCL308<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 />Needing to inventory management information from one or more remote computers, both server and client (but especially client)<br />
  5. 5. Agenda<br />Windows PowerShell, Briefly<br />Windows Management Instrumentation, Briefly<br />Exploring WMI<br />Playing with WMI on Your Local Computer<br />Using WMI on Remote Computers<br />Making a Flexible WMI Tool in Steps<br />
  6. 6. Windows PowerShell, Briefly<br />This session’s code will work with v1 and v2 (up until “advanced functions” at the very end – that’s v2 only)<br />V1: Ships with Win2008 and Vista, available for WinXP and Win2003<br />V2: Ships with Win2008R2 and Win7, available for WinXP, Win2003, Vista, and Win2008<br />Primarily a command-line shell; has scripting capabilities, but we won’t be diving into them (much) – we’ll be using scripts as “batch files” mainly<br />Note: I make all scripts downloadable from my Web site, no need to take notes<br />
  7. 7. Security Notes<br />Windows PowerShell disables script execution (but not commands) by default; see Help about_execution* for details<br />Windows PowerShell is subject to User Account Control (UAC); for our purposes, ensure you explicitly run “as Administrator” for necessary remote privileges<br />
  8. 8. WMI, Briefly<br />Present since Windows NT 4.0<br />Does not require PowerShell on the remote computer<br />Uses Remote Procedure Calls (RPCs) for communication; does not require PowerShell v2 / WinRM “remoting” on remote machines<br />Organized into:<br />Namespaces: Top-level, strictly organizational, usually product-related<br />Classes: Represent potential manageable elements<br />Instances: Real-world occurrences of classes<br />Properties & Methods: Elements of an instance<br />Properties contain management information<br />Methods perform actions (such as reconfiguration)<br />
  9. 9. WMI Security<br />Configured (by default) on the root namespace<br />Typically, don’t mess with this – many things rely on WMI and can get angry if you fuss with the permissions<br />Use WMI Control MMC snap-in to modify (or view – great way for seeing what namespaces are installed)<br />
  10. 10. WMI Security and Namespaces<br />DEMO<br />
  11. 11. Differences from Machine to Machine<br />WMI namespaces will vary based on the roles/products/technologies installed on a computer<br />Individual classes will vary based on product or Windows version<br />Classes’ properties and methods can vary from version to version, too<br />Core Windows OS and hardware stuff is in rootCIMv2; most classes start with Win32_ or CIM_ prefix in the class name<br />Best to get a “WMI Explorer” or “WMI Browser” that can be focused at a remote computer to see what that computer has<br />You don’t need a class on your computer in order to query it from a remote computer (very handy)<br />
  12. 12. Documentation<br />Easiest: Plug class name into favorite search engine<br />First 1-2 results usually msdn.microsoft.com/…, which will be what you want<br />Only rely on “core” classes being well-documented – everything else is pretty inconsistently documented<br />Use search engines to find examples – even VBScript examples can usually provide some help<br />Pipe retrieved WMI objects to Get-Member or to Format-List * in order to see what properties/methods they have, and what values the properties contain<br />
  13. 13. Exploring WMI<br />DEMO<br />
  14. 14. Using PowerShell Locally<br />Use Get-WmiObjectcmdlet<br />Cannot specify alternate credentials for local connections (by design); make sure shell is running as Administrator<br />Specify –class name to query; retrieves all instances and all properties by default<br />
  15. 15. Filtering Results<br />Use –filter parameter to narrow down instances returned (large result sets can take a lot of time and resources)<br />-filter "property <comparison> value”<br />Numeric values are not delimited<br />String/date values are delimited in single quotes<br />Easiest to enclose the entire filter in double quotes<br />Valid comparison operators:<br />= > < <> <= => <br />LIKE (use % as a wildcard)<br />These are different from PowerShell’s native operators!<br />
  16. 16. WMI in PowerShell, Locally<br />DEMO<br />
  17. 17. Going Remote<br />Use –computerName parameter to specify remote computer(s)<br />-computername ”Client17”<br />-computername (get-content names.txt)<br />-computername “client17”,”client18”,”client19”<br />Other parameters allow specification of alternate credential<br />-credential CONTOSOAdministrator<br />Graphically prompts for password – by design<br />Use Get-Credentialto create a reusable credential object that contains a password<br />
  18. 18. Multiple Computers<br />Remote connections are synchronous and sequential (not parallel)<br />Use –AsJob to run in background<br />Use remoting (Invoke-Command) for parallel processing (not in this session)<br />Failure of one computer will not stop the command from continuing<br />You can trap errors and log them; we’ll see how later<br />
  19. 19. WMI in PowerShell, Remotely<br />DEMO<br />
  20. 20. The Steps<br />Move command into a “batch file” for easier repetition<br />Enclose command in a function for parameterization<br />Add error handling / logging<br />Upgrade function to a filtering function to accept pipeline input<br />Enables scenarios like getting names from AD OR a text file<br />Upgrade function to an advanced function (v2 only) for cmdlet-like behavior<br />Package as a Script Module (v2 only) for easier distribution and re-use by others<br />Add comment-based help so you can tell what the heck it’s doing<br />(I’ll demo – you remind me of what step is next)<br />
  21. 21. Building a WMI Tool<br />DEMO<br />Remember! I’ll save all my scripts and make them downloadable fromwww.ConcentratedTech.com in a few days – no need to take notes!<br />
  22. 22. Conclusion<br />WMI + PowerShell = Very Powerful, Very Convenient<br />And a great way to learn PowerShell incrementally!<br />Build reusable, cmdlet-like tools<br />Now in the TechEd Bookstore:Windows PowerShell v2: TFM by Don Jones & Jeffery Hicks<br />Download this session’s scripts & slides fromwww.ConcentratedTech.com<br />
  23. 23. 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 />
  24. 24. 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 />
  25. 25. 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 />
  26. 26. Required Slide<br />Complete an evaluation on CommNet and enter to win!<br />
  27. 27. © 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 />
  28. 28. 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 />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×