22
POWERCLI WORKSHOP LONDON VMUG Jonathan Medd

Jonathan Medd. Je ne suis pas Alan Renouf Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

Embed Size (px)

Citation preview

Page 1: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

POWERCLI WORKSHOP

LONDON VMUG

Jonathan Medd

Page 2: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

Je ne suis pas Alan Renouf Today’s theme is simple and practical

examples to improve the management of your VMware Infrastructure

What’s New? Reporting Useful One-Liners / Short Scripts Project Onyx VESI

Page 3: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

Buy this book

Two ebook copies to give away to those who ask / answer questions

Page 4: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

You should also get this

Practical PowerCLI examples side-by-side vSphere topics

Page 5: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

PowerCLI 4.0 U1 is out!

More than 60 new cmdlets since the last release earlier this year

Cmdlet reference is now online - http://bit.ly/6Cx1s7

vSphere PowerCLI Administration Guide http://bit.ly/08iWLQK

Virtu-Al’s summary of the new cmdlets http://bit.ly/8KMGdg

Page 6: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

A few of the new cmdlets Set-PowerCLIConfiguration -

DefaultServerMode multiple Stop-VMHost Server01 -Confirm (or

–whatif) ;-) Set-HardDisk -HardDisk $hd -

CapacityKB $extendedCapacity -HostCredential $ hostCred -GuestCredential $guestCred

Page 7: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

PowerShell 2.0 is out!

More than 100 new cmdlets since v1.0 Installed by default in Windows 7 /

Server 2008 R2 New features: Remoting, Advanced

Functions, Background Jobs, ISE

Page 8: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

vCheck (Daily Report)

Schedule this report to run every day in your environment

Have a person dedicated to working through highlighted issues each day – if possible rotate between team members, say weekly

http://bit.ly/24KTGe

Page 9: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

vCheck

Page 10: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

vCheck – New in V3

Page 11: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

vCheck Examples - Snapshots Do you know every old Snapshot you

have? Hassle the Snapshot Creator Manage those which are required to be

kept

Page 12: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

vCheck Examples – Too Many CPU’s

Weren’t aware of these until they turned up in the daily report

Could potentially cause some unnecessary high CPU %RDY times

All now down to 2 x vCPU

Page 13: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

vCheck Examples – VM’s on Local Storage Often created ‘temporarily’ whilst waiting for SAN

space. Still there months later. Could effect host maintenance since can’t be

VMotioned

Page 14: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

Find Host Version and Build Get-VMHost | Get-View | Select-Object Name,

@{N="Version";E={$_.config.product.version}}, @{N="Build";E={$_.config.product.build}} | Sort-Object Name | Export-Csv C:\Scripts\Hosts.csv -NoTypeInformation

Demo: Get-View Exploring

Page 15: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

Who’s seen one of these?

Or three in one month? Three different servers, same model, same ESX version, same CPU error

Page 16: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

Find Vendor, Model and Bios Get-VMHost | Get-View | Select-Object Name,

@{N="Vendor";E={$_.summary.hardware.vendor}}, @{N="Model";E={$_.summary.hardware.model}}, @{N="Bios Version";E={$_.hardware.biosinfo.biosversion}}, @{N="Release Date";E={$_.hardware.biosinfo.releasedate}} | Sort-Object Name | Export-Csv C:\Scripts\Bios.csv -NoTypeInformation

Note: Some vendors don’t seem to be populating this information for all models

Page 17: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

SVMotion Moved entire production infrastructure between

SAN’s in different data centres with no downtime simply by scheduling these commands

Get-VM Server01 | Move-VM –Datastore (Get-DataStore Datastore10)

Combine with Import-CSV to make it even easier for large batches

Watch out for VM’s with multiple disks in different datastores if you have multiple target datastores

Page 18: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

Slot Size

What are ESX Slot Sizes? ‘Prevent VMs from being powered on if

they violate availability constraints’ Cluster with seemingly plenty of capacity

won’t power on VM’s. Watch out for ‘expensive’ VM’s with CPU

or Memory reservations, and / or vSMP

Page 19: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

Slot Size Code

Page 20: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

Project Onyx from PowerCLI team Currently in Alpha Think Macro Recorder for Excel Best for automating things that can’t be

automated using native PowerCLI cmdlets

Beats having to read the API documentation

Project Onyx Demo

Page 21: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

The VESI

Offshoot from Quest PowerGUI tool PowerShell scripts bundled up into a

GUI interface Great for beginners to use PowerShell

scripts before getting to grips with writing your own

Great for more advanced scripters wishing to share code

VESI Demo

Page 22: Jonathan Medd.  Je ne suis pas Alan Renouf  Today’s theme is simple and practical examples to improve the management of your VMware Infrastructure

Resources

http://blogs.vmware.com/vipowershell/ http://www.virtu-al.net/ http://lucd.info/ PowerCLI community forum

http://bit.ly/6BwTUS