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

More Related Content

Viewers also liked

Automating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShellAutomating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShellConcentrated Technology
 
PowerShell v4 Desired State Configuration
PowerShell v4 Desired State ConfigurationPowerShell v4 Desired State Configuration
PowerShell v4 Desired State ConfigurationJason Stangroome
 
Basic PowerShell Toolmaking - Spiceworld 2016 session
Basic PowerShell Toolmaking - Spiceworld 2016 sessionBasic PowerShell Toolmaking - Spiceworld 2016 session
Basic PowerShell Toolmaking - Spiceworld 2016 sessionRob Dunn
 
PowerShell Functions
PowerShell FunctionsPowerShell Functions
PowerShell Functionsmikepfeiffer
 
Three cool cmdlets I wish PowerShell Had!
Three cool cmdlets I wish PowerShell Had!Three cool cmdlets I wish PowerShell Had!
Three cool cmdlets I wish PowerShell Had!Thomas Lee
 
VDI-in-a-Box: Microsoft Desktop Virtualization for Smaller Businesses and Uses
VDI-in-a-Box:  Microsoft Desktop Virtualization for Smaller Businesses and UsesVDI-in-a-Box:  Microsoft Desktop Virtualization for Smaller Businesses and Uses
VDI-in-a-Box: Microsoft Desktop Virtualization for Smaller Businesses and UsesConcentrated Technology
 
Introduction to powershell
Introduction to powershellIntroduction to powershell
Introduction to powershellSalaudeen Rajack
 
Free tools for win server administration
Free tools for win server administrationFree tools for win server administration
Free tools for win server administrationConcentrated Technology
 
Ive got a powershell secret
Ive got a powershell secretIve got a powershell secret
Ive got a powershell secretChris Conte
 

Viewers also liked (19)

Ad disasters & how to prevent them
Ad disasters & how to prevent themAd disasters & how to prevent them
Ad disasters & how to prevent them
 
Automating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShellAutomating Active Directory mgmt in PowerShell
Automating Active Directory mgmt in PowerShell
 
PowerShell v4 Desired State Configuration
PowerShell v4 Desired State ConfigurationPowerShell v4 Desired State Configuration
PowerShell v4 Desired State Configuration
 
Basic PowerShell Toolmaking - Spiceworld 2016 session
Basic PowerShell Toolmaking - Spiceworld 2016 sessionBasic PowerShell Toolmaking - Spiceworld 2016 session
Basic PowerShell Toolmaking - Spiceworld 2016 session
 
PowerShell Functions
PowerShell FunctionsPowerShell Functions
PowerShell Functions
 
Managing SQLserver
Managing SQLserverManaging SQLserver
Managing SQLserver
 
No-script PowerShell v2
No-script PowerShell v2No-script PowerShell v2
No-script PowerShell v2
 
PS scripting and modularization
PS scripting and modularizationPS scripting and modularization
PS scripting and modularization
 
Ha & drs gotcha's
Ha & drs gotcha'sHa & drs gotcha's
Ha & drs gotcha's
 
PowerShell custom properties
PowerShell custom propertiesPowerShell custom properties
PowerShell custom properties
 
PowerShell and WMI
PowerShell and WMIPowerShell and WMI
PowerShell and WMI
 
Automating ad with powershell
Automating ad with powershellAutomating ad with powershell
Automating ad with powershell
 
Three cool cmdlets I wish PowerShell Had!
Three cool cmdlets I wish PowerShell Had!Three cool cmdlets I wish PowerShell Had!
Three cool cmdlets I wish PowerShell Had!
 
PS error handling and debugging
PS error handling and debuggingPS error handling and debugging
PS error handling and debugging
 
Server Core2
Server Core2Server Core2
Server Core2
 
VDI-in-a-Box: Microsoft Desktop Virtualization for Smaller Businesses and Uses
VDI-in-a-Box:  Microsoft Desktop Virtualization for Smaller Businesses and UsesVDI-in-a-Box:  Microsoft Desktop Virtualization for Smaller Businesses and Uses
VDI-in-a-Box: Microsoft Desktop Virtualization for Smaller Businesses and Uses
 
Introduction to powershell
Introduction to powershellIntroduction to powershell
Introduction to powershell
 
Free tools for win server administration
Free tools for win server administrationFree tools for win server administration
Free tools for win server administration
 
Ive got a powershell secret
Ive got a powershell secretIve got a powershell secret
Ive got a powershell secret
 

Similar to Inventory your network and clients with PowerShell

Windows Server 2008 Management
Windows Server 2008 ManagementWindows Server 2008 Management
Windows Server 2008 ManagementHi-Techpoint
 
Automating Desktop Management with Windows Powershell V2.0 and Group Policy M...
Automating Desktop Management with Windows Powershell V2.0 and Group Policy M...Automating Desktop Management with Windows Powershell V2.0 and Group Policy M...
Automating Desktop Management with Windows Powershell V2.0 and Group Policy M...Microsoft TechNet
 
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...Joel Oleson
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellSharePoint Saturday NY
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellSharePoint Saturday NY
 
How to become a Super Productive Developer
How to become a Super Productive DeveloperHow to become a Super Productive Developer
How to become a Super Productive DeveloperAbhishek Sur
 
Managing VMware with PowerShell - VMworld 2008
Managing VMware with PowerShell - VMworld 2008Managing VMware with PowerShell - VMworld 2008
Managing VMware with PowerShell - VMworld 2008Carter Shanklin
 
PowerShell in the enterprise - TechED India 2011
PowerShell in the enterprise - TechED India 2011PowerShell in the enterprise - TechED India 2011
PowerShell in the enterprise - TechED India 2011Ravikanth Chaganti
 
Wsv406 Advanced Automation Using Windows Power Shell2.0
Wsv406 Advanced Automation Using Windows Power Shell2.0Wsv406 Advanced Automation Using Windows Power Shell2.0
Wsv406 Advanced Automation Using Windows Power Shell2.0jsnover1
 
NET Event - Migrating WinForm
NET Event - Migrating WinFormNET Event - Migrating WinForm
NET Event - Migrating WinFormRaffaele Garofalo
 
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with SilverlightRe-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with SilverlightFrank La Vigne
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and TechniquesBala Subra
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging TechniquesBala Subra
 
Sql Server & PowerShell
Sql Server & PowerShellSql Server & PowerShell
Sql Server & PowerShellAaron Shilo
 
Wsv315 Windows Power Shell For Beginners
Wsv315 Windows Power Shell For BeginnersWsv315 Windows Power Shell For Beginners
Wsv315 Windows Power Shell For Beginnersjsnover1
 
Better User Experience with .NET
Better User Experience with .NETBetter User Experience with .NET
Better User Experience with .NETPeter Gfader
 

Similar to Inventory your network and clients with PowerShell (20)

Windows Server 2008 Management
Windows Server 2008 ManagementWindows Server 2008 Management
Windows Server 2008 Management
 
PowerShell Remoting
PowerShell RemotingPowerShell Remoting
PowerShell Remoting
 
Automating Desktop Management with Windows Powershell V2.0 and Group Policy M...
Automating Desktop Management with Windows Powershell V2.0 and Group Policy M...Automating Desktop Management with Windows Powershell V2.0 and Group Policy M...
Automating Desktop Management with Windows Powershell V2.0 and Group Policy M...
 
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
STSADM Automating SharePoint Administration - Tech Ed South East Asia 2008 wi...
 
Windows PowerShell
Windows PowerShellWindows PowerShell
Windows PowerShell
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
 
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with PowershellBrian Jackett: Managing SharePoint 2010 Farms with Powershell
Brian Jackett: Managing SharePoint 2010 Farms with Powershell
 
How to become a Super Productive Developer
How to become a Super Productive DeveloperHow to become a Super Productive Developer
How to become a Super Productive Developer
 
Managing VMware with PowerShell - VMworld 2008
Managing VMware with PowerShell - VMworld 2008Managing VMware with PowerShell - VMworld 2008
Managing VMware with PowerShell - VMworld 2008
 
PowerShell in the enterprise - TechED India 2011
PowerShell in the enterprise - TechED India 2011PowerShell in the enterprise - TechED India 2011
PowerShell in the enterprise - TechED India 2011
 
Wsv406 Advanced Automation Using Windows Power Shell2.0
Wsv406 Advanced Automation Using Windows Power Shell2.0Wsv406 Advanced Automation Using Windows Power Shell2.0
Wsv406 Advanced Automation Using Windows Power Shell2.0
 
NET Event - Migrating WinForm
NET Event - Migrating WinFormNET Event - Migrating WinForm
NET Event - Migrating WinForm
 
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with SilverlightRe-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
Re-use Your Skills and Code to Expand the Reach of Your Apps with Silverlight
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging Techniques
 
Meet Windows PowerShell
Meet Windows PowerShellMeet Windows PowerShell
Meet Windows PowerShell
 
Sql Server & PowerShell
Sql Server & PowerShellSql Server & PowerShell
Sql Server & PowerShell
 
Wsv315 Windows Power Shell For Beginners
Wsv315 Windows Power Shell For BeginnersWsv315 Windows Power Shell For Beginners
Wsv315 Windows Power Shell For Beginners
 
Better User Experience with .NET
Better User Experience with .NETBetter User Experience with .NET
Better User Experience with .NET
 
Puppet
PuppetPuppet
Puppet
 

More from Concentrated Technology

Virtualization auditing & security deck v1.0
Virtualization auditing & security deck v1.0Virtualization auditing & security deck v1.0
Virtualization auditing & security deck v1.0Concentrated Technology
 
Securely connecting to apps over the internet using rds
Securely connecting to apps over the internet using rdsSecurely connecting to apps over the internet using rds
Securely connecting to apps over the internet using rdsConcentrated Technology
 
PowerShell crashcourse for Sharepoint admins
PowerShell crashcourse for Sharepoint adminsPowerShell crashcourse for Sharepoint admins
PowerShell crashcourse for Sharepoint adminsConcentrated Technology
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAConcentrated Technology
 

More from Concentrated Technology (19)

Wsus sample scripts
Wsus sample scriptsWsus sample scripts
Wsus sample scripts
 
Wsus best practices
Wsus best practicesWsus best practices
Wsus best practices
 
Virtualization today
Virtualization todayVirtualization today
Virtualization today
 
Virtualization auditing & security deck v1.0
Virtualization auditing & security deck v1.0Virtualization auditing & security deck v1.0
Virtualization auditing & security deck v1.0
 
Vdi in-a-box
Vdi in-a-boxVdi in-a-box
Vdi in-a-box
 
Top ESXi command line v2.0
Top ESXi command line v2.0Top ESXi command line v2.0
Top ESXi command line v2.0
 
Supporting SQLserver
Supporting SQLserverSupporting SQLserver
Supporting SQLserver
 
Securely connecting to apps over the internet using rds
Securely connecting to apps over the internet using rdsSecurely connecting to apps over the internet using rds
Securely connecting to apps over the internet using rds
 
Rapidly deploying software
Rapidly deploying softwareRapidly deploying software
Rapidly deploying software
 
PowerShell crashcourse for Sharepoint admins
PowerShell crashcourse for Sharepoint adminsPowerShell crashcourse for Sharepoint admins
PowerShell crashcourse for Sharepoint admins
 
Prepping software for w7 deployment
Prepping software for w7 deploymentPrepping software for w7 deployment
Prepping software for w7 deployment
 
PowerShell crashcourse for sharepoint
PowerShell crashcourse for sharepointPowerShell crashcourse for sharepoint
PowerShell crashcourse for sharepoint
 
PowerShell crashcourse
PowerShell crashcoursePowerShell crashcourse
PowerShell crashcourse
 
PowerShell crash course
PowerShell crash coursePowerShell crash course
PowerShell crash course
 
Managing SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBAManaging SQLserver for the reluctant DBA
Managing SQLserver for the reluctant DBA
 
Implementing dr w. hyper v clustering
Implementing dr w. hyper v clusteringImplementing dr w. hyper v clustering
Implementing dr w. hyper v clustering
 
Iis implementation
Iis implementationIis implementation
Iis implementation
 
Hyper v r2 deep dive
Hyper v r2 deep diveHyper v r2 deep dive
Hyper v r2 deep dive
 
How to configure esx to pass an audit
How to configure esx to pass an auditHow to configure esx to pass an audit
How to configure esx to pass an audit
 

Recently uploaded

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 

Recently uploaded (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 

Inventory your network and clients with PowerShell

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