VSP1883 VMware vSphere PowerCLI Best Practices
The session has been split in 2 parts, first of all they listed some BestPractices to follow when you’re coding (18 BestPractices to be specific) and finally they let the public to choose a number between 19 and 42 to explain corresponding BestPractices.
The more interesting/usefull BestPractices we found were :
[BP n°6, n°7 and n°8] Using Get-View, with -Property and -Filter to speed up execution time (as we could see with the new version of vCheck). For exemple, the cmdlet Get-VM is executed client-side whereas the cmdlet Get-View is executed server-side, the execution time difference is about 15x !
[BP n°3] Use the cmdlet New-VIProperty for creating custom properties still to speed up execution time (as you can read on awesome post from LucD : The making of a New-VIProperty called lunID)
[BP n°11 and n°12] As PowerCLI is a PowerShell module, use as possible native tool like Sort-Object, Group-Object
[BP n°13] Recursive functions can also speed up execution time and simplify scripts
[BP n°16] Send-MailMessage is available with PowerShell v2 and should be use as possible instead of old v1 objects
There were much more, some taken straight from their book, some new (we sadly saw no BestPractices about mass using OneLiner ^^)
A very nice session with a lot of good reminders/tips and last but not least, it was presented by the PowerCLI Kings themselves :p
Only one deception, being a little late and missing PowerCLIMan entrance and were on a crappy spot for pictures 🙁