2. About Me Lead Engineer at Dell Windows PowerShell MVP Author of Free eBook: Layman’s guide to PowerShell 2.0 remoting Free eBook: WMI Query Language via PowerShell (coming soon) Co-author on Quest’s SharePoint 2010 & PowerShell cheat sheet Blog at http://www.ravichaganti.com/blog
4. PowerShell 2.0 Features Advanced Functions Integrated Scripting Environment Remoting Background jobs Eventing Better error handling & debugging support Several new cmdlets
6. PowerShell Remoting Enables Universal Code Execution Model Whatever runs locally should run anywhere Uses Windows Remote Management Supports several remoting methods Invoke-Command Interactive remoting Implicit remoting
7. PowerShell for Hyper-V No built-in cmdlets Rich set of WMI interfaces under rootirtualization namespace 108 classes prefixed with Msvm_ Complex to script PowerShell module for Hyper-V Developed by James O’neill http://pshyperv.codeplex.com System Center Virtual Machine Manager cmdlets
8. Hyper-V WMI - Overview Get enabled when Hyper-V role is installed Present in rootirtualization namespace 108 classes Excluding the CIM and system classes Can be categorized in to: BIOS Input Integration Component Memory / Processor / Networking / Storage / Serial / Video Devices Virtual System & Virtual System Management Profile Registration & Resource Management
9. Hyper-V WMI: Virtual Machine Management Msvm_VirtualSystemManagementService class is used Create, Delete, and Manage VMs DefineVirtualSystem DestroyVirtualSystem ModifyVirtualSystem ModifyVirtualSystemResources RemoveVirtualSystemResources Import, Export, and snapshot VMs ImportVirtualSystemEx ExportVirtualSystemEx CreateVirtualSystemSnapshot RemoveVirtualSystemSnapshot
10. Hyper-V WMI: Virtual Network Management Msvm_VirtualSwitchManagementService class is used Create, Delete, and Manage virtual network components CreateSwitch CreateSwitchPort DeleteSwitch DeleteSwitchPort ConnectSwitchPort DisconnectSwitchPort
11. Hyper-V WMI: Virtual Storage Management Msvm_ImageManagementService class is used Create, Mount, and Dismount virtual media CreateFixedVirtualHardDisk CreateDynamicVirtualHardDisk CreateDifferencingVirtualHardDisk Mount Unmount ValidateVirtualHardDisk
12. Hyper-V PowerShell Module Scripting WMI interfaces is Quite complex Quite verbose Hyper-V PowerShell Module Developed by James O’neill Can be download from http://pshyperv.codeplex.com Import-Module –Name hyperv Get-Command –Module hyperv Contains 122 cmdlets