PowerShell for monitoring and managing Windows 7 desktops remotely
-
Upload
ravikanth-chaganti -
Category
Technology
-
view
2.692 -
download
2
description
Transcript of PowerShell for monitoring and managing Windows 7 desktops remotely
virtual techdaysINDIA │ 9-11 February 2011
Monitoring and managing remote Windows 7 desktops with Windows PowerShellRavikanth C │ Dell Inc.
About Me• Work at Dell Inc.• Windows PowerShell MVP• Author of:• Free eBook: Layman’s guide to PowerShell 2.0 remoting• Free eBook: WMI Query Language via PowerShell• Cheat Sheet: SharePoint 2010 PowerShell cmdlets
• Blog at: http://www.ravichaganti.com/blog• Twitter: @Ravikanth
Session Outline• Objectives• What is PowerShell?• Cmdlets to manage remote systems• PowerShell remoting for remote system management• PowerShell for WMI event monitoring• Software & hardware inventory
• Takeaways• Learn how to use PowerShell cmdlets to manage remote
systems• Learn how to use PowerShell remoting• Learn how to monitor remote systems using WMI
What is PowerShell?• Object-based Shell• Interactive commands
• Scripting language• Automate everything • Sharable and reusable
• Comes built-in on Windows 7 & Windows Server 2008 R2
• Download available for Windows XP, Windows 2003, and Windows Vista
Cmdlets to manage remote systems• 35 cmdlets with –ComputerName parameter• Get-Command -type cmdlet | Where {
$_.Definition -like "*-ComputerName*"}
Working with performance data• One cmdlet• Get-Counter
• Gets live, real-time performance counter data• Sample interval and Maximum samples can be
altered• Run as administrator to be able to read all
counters
virtual techdaysINDIA │ 9-11 February 2011
DEMO: Working with Performance Data
Working with processes• Five cmdlets• Get-Process• Debug-Process• Start-Process• Stop-Process• Wait-Process
• Start-Process and Stop-Process have no –ComputerName Parameter
virtual techdaysINDIA │ 9-11 February 2011
DEMO: Working with processes
PowerShell remoting• Not all remoting is the same• Get-Process, Get-Service, and others use .NET
Framework methods• Not all cmdlets have –ComputerName parameter• Remoting requirements:• Windows PowerShell 2.0 • Microsoft .NET Framework 2.0 or later• Windows Remote Management 2.0
• To configure PowerShell remoting: • start PowerShell as admin• Use Enable-PSRemoting
Remoting Methods• Supports both fan-in and fan-out remoting• Invoke-Command• Can be used for both 1-1 and 1-many remoting
• Interactive remoting• Similar to a telnet session• Enter-PSSession
• Implicit remoting• Import a remote session into local session• Import-PSSession
virtual techdaysINDIA │ 9-11 February 2011
DEMO: PowerShell remoting
WMI Event monitoring• Events generated by operating system and
several other components• Use Register-WMIEvent cmdlet• Create temporary consumer to trigger an action
based on an event• Requires knowledge of WMI Query Language• Unregister-Event to delete the consumer
virtual techdaysINDIA │ 9-11 February 2011
DEMO: WMI Event monitoring
Software Inventory• Use Get-WMIObject cmdlet• For remote systems use –ComputerName parameter• Query Win32_Product WMI class
• For software installed via MSI• Install & Uninstall software remotely• Query Windows registry for a list of all other
software
virtual techdaysINDIA │ 9-11 February 2011
DEMO: Software Inventory
virtual techdaysINDIA │ 9-11 February 2011
RESOURCES
PowerShell remoting ebooks Layman’s guide to PowerShell remoting: http://www.ravichaganti.com/blog/?p=1780 Administrator’s guide to PowerShell remoting: http://
powershell.com/cs/media/p/4908.aspx WMI Query Language
http://www.ravichaganti.com/blog/?p=1979 Getting started with PowerShell
http://technet.microsoft.com/en-us/scriptcenter/dd742419
virtual techdaysTHANKS│9-11 February 2011
[email protected] │ @Ravikanth (Twitter)