180 likes | 333 Views
INDIA │ 9-11 February 2011. virtual techdays. Monitoring and managing remote Windows 7 desktops with Windows PowerShell. Ravikanth C │ Dell Inc. About Me. Work at Dell Inc. Windows PowerShell MVP Author of: Free eBook: Layman’s guide to PowerShell 2.0 remoting
E N D
INDIA │ 9-11 February 2011 virtual techdays Monitoring and managing remote Windows 7 desktops with Windows PowerShell Ravikanth 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-typecmdlet|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
INDIA │ 9-11 February 2011 virtual techdays 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
INDIA │ 9-11 February 2011 virtual techdays 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
INDIA │ 9-11 February 2011 virtual techdays 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
INDIA │ 9-11 February 2011 virtual techdays 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
INDIA │ 9-11 February 2011 virtual techdays DEMO: Software Inventory
INDIA │ 9-11 February 2011 virtual techdays • 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 RESOURCES
THANKS│9-11 February 2011 virtual techdays Ravikanth@Ravichaganti.com │ @Ravikanth (Twitter)