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.

Power Cli Workshop London Vmug

  • Login to see the comments

  • Be the first to like this

Power Cli Workshop London Vmug

  1. 1. PowerCLI Workshop London VMUG<br />Jonathan Medd<br />
  2. 2. Je ne suis pas Alan Renouf<br />Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure<br />What’s New?<br />Reporting<br />Useful One-Liners / Short Scripts<br />Project Onyx<br />VESI<br />
  3. 3. Buy this book<br />Two ebook copies to give away to those who ask / answer questions<br />
  4. 4. You should also get this<br />Practical PowerCLI examples side-by-side vSphere topics<br />
  5. 5. PowerCLI 4.0 U1 is out!<br />More than 60 new cmdlets since the last release earlier this year<br />Cmdlet reference is now online -<br />vSpherePowerCLI Administration Guide<br />Virtu-Al’s summary of the new cmdlets<br />
  6. 6. A few of the new cmdlets<br />Set-PowerCLIConfiguration -DefaultServerMode multiple<br />Stop-VMHost Server01 -Confirm (or –whatif) ;-) <br />Set-HardDisk -HardDisk $hd -CapacityKB $extendedCapacity -HostCredential $ hostCred -GuestCredential $guestCred<br />
  7. 7. PowerShell 2.0 is out!<br />More than 100 new cmdlets since v1.0<br />Installed by default in Windows 7 / Server 2008 R2<br />New features: Remoting, Advanced Functions, Background Jobs, ISE<br />
  8. 8. vCheck (Daily Report) <br />Schedule this report to run every day in your environment<br />Have a person dedicated to working through highlighted issues each day – if possible rotate between team members, say weekly<br /><br />
  9. 9. vCheck<br />
  10. 10. vCheck – New in V3<br />
  11. 11. vCheck Examples - Snapshots<br />Do you know every old Snapshot you have?<br />Hassle the Snapshot Creator<br />Manage those which are required to be kept<br />
  12. 12. vCheck Examples – Too Many CPU’s<br />Weren’t aware of these until they turned up in the daily report<br />Could potentially cause some unnecessary high CPU %RDY times<br />All now down to 2 x vCPU<br />
  13. 13. vCheck Examples – VM’s on Local Storage<br />Often created ‘temporarily’ whilst waiting for SAN space. Still there months later.<br />Could effect host maintenance since can’t be VMotioned<br />
  14. 14. Find Host Version and Build<br />Get-VMHost | Get-View | Select-Object Name, @{N=&quot;Version&quot;;E={$_.config.product.version}}, @{N=&quot;Build&quot;;E={$}} | Sort-Object Name | Export-CsvC:ScriptsHosts.csv -NoTypeInformation<br />Demo: Get-View Exploring<br />
  15. 15. Who’s seen one of these?<br />Or three in one month? Three different servers, same model, same ESX version, same CPU error<br />
  16. 16. Find Vendor, Model and Bios<br />Get-VMHost | Get-View | Select-Object Name, @{N=&quot;Vendor&quot;;E={$_.summary.hardware.vendor}}, @{N=&quot;Model&quot;;E={$_.summary.hardware.model}}, @{N=&quot;Bios Version&quot;;E={$_.hardware.biosinfo.biosversion}}, @{N=&quot;Release Date&quot;;E={$_.hardware.biosinfo.releasedate}} | Sort-Object Name | Export-Csv C:ScriptsBios.csv -NoTypeInformation<br />Note: Some vendors don’t seem to be populating this information for all models<br />
  17. 17. SVMotion<br />Moved entire production infrastructure between SAN’s in different data centres with no downtime simply by scheduling these commands<br />Get-VM Server01 | Move-VM –Datastore (Get-DataStore Datastore10)<br />Combine with Import-CSV to make it even easier for large batches<br />Watch out for VM’s with multiple disks in different datastores if you have multiple target datastores<br />
  18. 18. Slot Size<br />What are ESX Slot Sizes?<br />‘Prevent VMs from being powered on if they violate availability constraints’<br />Cluster with seemingly plenty of capacity won’t power on VM’s.<br />Watch out for ‘expensive’ VM’s with CPU or Memory reservations, and / or vSMP<br />
  19. 19. Slot Size Code<br />
  20. 20. Project Onyx from PowerCLI team<br />Currently in Alpha<br />Think Macro Recorder for Excel<br />Best for automating things that can’t be automated using native PowerCLI cmdlets<br />Beats having to read the API documentation<br />Project Onyx Demo<br />
  21. 21. The VESI <br />Offshoot from Quest PowerGUI tool<br />PowerShell scripts bundled up into a GUI interface<br />Great for beginners to use PowerShell scripts before getting to grips with writing your own<br />Great for more advanced scripters wishing to share code<br />VESI Demo<br />
  22. 22. Resources<br /><br /><br /><br />PowerCLI community forum<br />