Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Managing Hyper-V With PowerShell

8,925 views

Published on

This was the slide deck used for my technet Webcast

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Managing Hyper-V With PowerShell

  1. 1. Managing Microsoft Hyper-V with PowerShell<br />Ravikanth Chaganti<br />
  2. 2. About Me<br />Lead Engineer at Dell<br />Windows PowerShell MVP<br />Author of<br />Free eBook: Layman’s guide to PowerShell 2.0 remoting<br />Free eBook: WMI Query Language via PowerShell (coming soon)<br />Co-author on Quest’s SharePoint 2010 & PowerShell cheat sheet<br />Blog at http://www.ravichaganti.com/blog<br />
  3. 3. Agenda<br />PowerShell 2.0 features<br />Integrated Scripting Environment<br />PowerShell remoting<br />PowerShell for Hyper-V<br />Hyper-V WMI – Overview<br />Virtual Machine Management<br />Virtual Network Management<br />Virtual Storage Management<br />Hyper-V PowerShell Module<br />Q & A<br />
  4. 4. PowerShell 2.0 Features<br />Advanced Functions<br />Integrated Scripting Environment<br />Remoting<br />Background jobs<br />Eventing<br />Better error handling & debugging support<br />Several new cmdlets<br />
  5. 5. Integrated Scripting Environment (ISE)<br />Output Pane<br />Script Pane<br />Command Pane<br />
  6. 6. PowerShell Remoting<br />Enables Universal Code Execution Model<br />Whatever runs locally should run anywhere<br />Uses Windows Remote Management<br />Supports several remoting methods<br />Invoke-Command<br />Interactive remoting<br />Implicit remoting<br />
  7. 7. PowerShell for Hyper-V<br />No built-in cmdlets<br />Rich set of WMI interfaces under rootvirtualization namespace<br />108 classes prefixed with Msvm_<br />Complex to script<br />PowerShell module for Hyper-V<br />Developed by James O’neill<br />http://pshyperv.codeplex.com<br />System Center Virtual Machine Manager cmdlets<br />
  8. 8. Hyper-V WMI - Overview<br />Get enabled when Hyper-V role is installed<br />Present in rootvirtualization namespace<br />108 classes<br />Excluding the CIM and system classes<br />Can be categorized in to:<br />BIOS<br />Input<br />Integration Component<br />Memory / Processor / Networking / Storage / Serial / Video Devices<br />Virtual System & Virtual System Management<br />Profile Registration & Resource Management<br />
  9. 9. Hyper-V WMI: Virtual Machine Management<br />Msvm_VirtualSystemManagementService class is used<br />Create, Delete, and Manage VMs<br />DefineVirtualSystem<br />DestroyVirtualSystem<br />ModifyVirtualSystem<br />ModifyVirtualSystemResources<br />RemoveVirtualSystemResources<br />Import, Export, and snapshot VMs<br />ImportVirtualSystemEx<br />ExportVirtualSystemEx<br />CreateVirtualSystemSnapshot<br />RemoveVirtualSystemSnapshot<br />
  10. 10. Hyper-V WMI: Virtual Network Management <br />Msvm_VirtualSwitchManagementService class is used<br />Create, Delete, and Manage virtual network components<br />CreateSwitch<br />CreateSwitchPort<br />DeleteSwitch<br />DeleteSwitchPort<br />ConnectSwitchPort<br />DisconnectSwitchPort<br />
  11. 11. Hyper-V WMI: Virtual Storage Management<br />Msvm_ImageManagementService class is used<br />Create, Mount, and Dismount virtual media<br />CreateFixedVirtualHardDisk<br />CreateDynamicVirtualHardDisk<br />CreateDifferencingVirtualHardDisk<br />Mount<br />Unmount<br />ValidateVirtualHardDisk<br />
  12. 12. Hyper-V PowerShell Module<br />Scripting WMI interfaces is<br />Quite complex<br />Quite verbose<br />Hyper-V PowerShell Module<br />Developed by James O’neill<br />Can be download from http://pshyperv.codeplex.com<br />Import-Module –Name hyperv<br />Get-Command –Module hyperv<br />Contains 122 cmdlets<br />
  13. 13. Hyper-V PowerShell Module: Virtual Machine<br />Get-VM<br />New-VM<br />Remove-VM<br />Move-VM<br />Export-VM<br />Import-VM<br />Many more….<br />Get-Command -noun VM*<br />
  14. 14. Get-VMSwitch<br />New-VMExternalSwitch<br />New-VMInternalSwitch<br />New-VMPrivateSwitch<br />Remove-VMSwitch<br />Many More..<br />Get-Command –Noun VM*Switch<br />Get-Command -Noun VMNIC*<br />Hyper-V PowerShell Module: Virtual Network<br />
  15. 15. Hyper-V PowerShell Module: Virtual Storage<br />Compress-VHD<br />Convert-VHD<br />Dismount-VHD<br />Expand-VHD<br />Get-VHD<br />Merge-VHD<br />Mount-VHD<br />New-VHD<br />Test-VHD<br />Add-VMDrive<br />Remove-VMDrive<br />
  16. 16. Hyper-V PowerShell Module: VM Resources<br />Add-VMNIC<br />Add-VMDisk<br />Set-VMCPUCount<br />Set-VMMemory<br />Set-VM<br />Many More..<br />
  17. 17. References<br />Hyper-V WMI interfaces: http://msdn.microsoft.com/en-us/library/cc136986(v=VS.85).aspx<br />PowerShell Module for Hyper-V: http://pshyperv.codeplex.com<br />Getting Started with PowerShell: http://technet.microsoft.com/en-us/scriptcenter/dd742419<br />
  18. 18. Q & A<br />

×