1 / 22

VSP1361 VMware vSphere PowerCLI 101

VSP1361 VMware vSphere PowerCLI 101 . Name, Title, Company. Why Automate. Save Time Reduce Risk Scale. Agenda. Introduction to PowerShell vCenter management Storage management Automating VM lifecycle. PowerShell 101 (Terminology).

ada
Download Presentation

VSP1361 VMware vSphere PowerCLI 101

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VSP1361VMware vSpherePowerCLI 101 Name, Title, Company

  2. Why Automate • Save Time • Reduce Risk • Scale

  3. Agenda • Introduction to PowerShell • vCenter management • Storage management • Automating VM lifecycle

  4. PowerShell 101 (Terminology) • Cmdlet(pronounced command-lets) are compiled .NET class that perfoma single action on an object. They are named in the <verb>-<singular noun> format. • Objects: A collection of properties and methods with a unique type name. • Pipeline: Passes whole .NET objects from one cmdlet to another enabling clean powerful syntax.

  5. Pipeline in Action Get-VM | Where-Object {$_.PowerState –eq ‘Powered Off’} | Start-VM | Format-Table Get-VM Format-Table Where-Object Start-VM PowerShell Pipeline

  6. PowerShell 101 ( Key Cmdlets) • Get-Command • Get-Help • Get-Module • Get-Member • Format-List

  7. Grow Environment! Live Demo

  8. Needs & Environment Tasks: Create new datacenter Add existing Host and VMs to new vCenter instance. Create a new cluster Add new Host to the new cluster Cmdlets used: Connect-VIServer New-Datacenter Add-VMHost New-Cluster Set-Cluster Move-VMHost

  9. Grow Environment # Add host to vCenter Connect-VIServervCenter01.sea-tm.netapp.com # Create Datacenter $Datacenter=New-Datacenter-NameBellevue-Location(Get-Folder) # Add the first host Add-VMHost-NamevSphere1.sea-tm.netapp.com-Location$Datacenter` -Force # Create new cluster $Cluster=New-Cluster-NameVMworld-Location$Datacenter # Set the HA/DRS Settings for our cluster Set-Cluster-cluster$Cluster-HAEnabled$True` -HAIsolationResponseDoNothing-DrsEnabled$True-Confirm:$false # Move our existing host into the new cluster Move-VMHost-VMHostvSphere1*-Destination$Cluster # Add an additional host to the cluster Add-VMHost-NamevSphere2.sea-tm.netapp.com-Location$Cluster` -Force-RunAsync

  10. ZOMG I Needs Storage?! Live Demo

  11. Needs & Environment Tasks: Find and remove any large snapshots. Provision new storage on Array Add datastore to hosts Move VMs to new storage. Cmdlets used: Get-VM Get-Snapshot Get-VMHost New-Datastore Sort-Object Format-Table Remove-Snapshot Set-NaQtree Set-NaNfsExport Move-VM Get-Datastore Connect-NaController New-NaVol Set-NaSis Enable-NaSis Start-NaSis Get-NaQtree

  12. ZOMG I Needs Storage?! # Find any large snapshots. Get-VM|Get-Snapshot|Sort-ObjectSizeMB-Descending|Format-TableVM,Name,SizeMB # Delete that sucka! Get-Snapshot-VMSQL01-Nameupdates|Remove-Snapshot-RunAsync # we're still a little tight... Create a new datastore! # Import the NetApp DataONTAP PowerShell Toolkit Import-ModuleDataONTAP # Connect to the NetApp Controller Connect-NaController10.58.92.213 # Create a new volume, and configure dedupe New-NaVol-Namevmdata1-Aggregateaggr1-SpaceReservenone-Size10t| Set-NaSis-Scheduleauto | Enable-NaSis| Start-NaSis| Get-NaQtree| Set-NaQtree-SecurityStyleunix # Create the NFS export Set-NaNfsExport-Persistent-Path/vol/vmdata1-Root'172.16.3.0/24'` -ReadWrite'172.16.3.0/24' # Add datastore Get-Cluster VMworld |Get-VMHost|New-Datastore-Namevmdata1-Nfs` -Path/vol/vmdata1-NfsHost172.16.3.213 # Move a VM to make some more room in our oversubscribed datastore. Get-VMExch*|Move-VM-Datastore(Get-Datastorevmdata1)-RunAsync

  13. VM Provisioning Live Demo!

  14. Needs & Environment Tasks: Clone an existing VM. Create a new VM. Convert VM to VM Template. Deploy multiple VMs from Template. Delete a VM. Cmdlets used: Get-Cluster Get-Datacenter Get-VM Get-VMHost New-VM Remove-VM Set-VM ForEach-Object

  15. VM Provisioning # We'll use this more than once! $vmhost=Get-Cluster-NameVMworld|Get-VMHost|Select-first1 # Clone a VM for the ops team to test a patch. New-VM-NameSQL03_Clone-VMSQL03-VMHost$VMHost-RunAsync # Create a new VM $VM=New-VM-Name"AwesomeVM01"-VMHost$vmhost-DiskMB61440` -MemoryMB4196 # Now Make a template of that fool $template=$VM|Set-VM-ToTemplate-Name"VMworld Template" # Add a force multiplier 1..6|ForEach-Object{ New-VM-Name"VM$_"-Template$template-VMHost$vmhost-RunAsync } # Cleanup old VM Get-VMSQL03_Clone|Remove-VM-DeletePermanently

  16. Resources - Books

  17. Resources - Blogs

  18. Resources - Blogs

  19. Resources - Forums

  20. Resources - Forums

  21. Resources - Forums

  22. Where to go from here? Books: Learn Windows PowerShell in a Month of Lunches VMware vSphere PowerCLI Reference Blogs: http://www.lucd.info/ http://www.virtu-al.net/ Forums: http://www.vmware.com/go/PowerCLI http://powershellcommunity.org http://social.technet.microsoft.com/Forums/en/ITCG/threads Twitter: Use the hashtag #PowerShell #PowerCLI to get help.

More Related