1 / 36

Getting Started with VMware PowerCLI

Getting Started with VMware PowerCLI. Jake Robinson, Systems Engineer Bluelock. Welcome. Intro Microsoft Powershell Break! VMware PowerCLI vCloud Powershell Extra Question/Lab Time. What is Powershell ?. The Powershell cmdlet. Native, compiled command

svea
Download Presentation

Getting Started with VMware PowerCLI

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. Getting Started with VMware PowerCLI Jake Robinson, Systems Engineer Bluelock

  2. Welcome • Intro • Microsoft Powershell • Break! • VMware PowerCLI • vCloudPowershell • Extra Question/Lab Time

  3. What is Powershell?

  4. The Powershell cmdlet • Native, compiled command • Always follow verb-noun format • Get-Beer • Snap-ins • Aliases

  5. Getting Help • Get-Help • Get-Command • http://bit.ly/15jUeM

  6. Piping and the Pipeline • The “pipe” • Passes output(object) to another command • Get-Process notepad | Stop-Process • Get-Process | Where-Object {$_.name –eq notepad} | Stop-Process • Woah, what the heck is “$_” • Special variable for “This.” • Basically, whatever object is currently in the pipeline.

  7. Variables • They store stuff. (objects) • They start with a $. • $jake = “nerd”

  8. Some important Variables

  9. Arithmetic and Assignment Operators

  10. Comparison Operators

  11. Filtering and Formatting • Where-Object • Only show me certain objects • Get-Process | Where-Object {$_.WS –gt 10MB} • Select-Object • Only show me certain properties of an object • Get-Process | select name, id

  12. Filtering and Formatting • Format-List • Vertical view of properties • Not fun to look at when you have more that one object • Great for deep-diving into a single object • Format-List * (displays all properties of an object) • Format-Table • Horizontal view of properties • Not fun to look at when you have lots of properties • Great for viewing a lot of objects and a few properties

  13. Foreach-Object • Foreach-Object • Do something to each object in our pipeline • Get-Process | Foreach-Object {Write-host “Jake” $_.name} Process Write-Host “Jake” $_.name Process Write-Host “Jake” $_.name Process Write-Host “Jake” $_.name Process Write-Host “Jake” $_.name Get-Process ForEach-Object

  14. Functions • Reusable code! • Save functions in a .ps1 file • Import functions by “dot-sourcing” • . C:\scripts\myFunctions.ps1 space dot

  15. Function Example

  16. Powershell ISE • “Integrated Scripting Environment” • Ooh, colors… • Panes • Script pane • Command pane • Output pane

  17. Powershell ISE Script Pane Output Pane Command Pane

  18. BREAK TIME! Get-Beer | where {$_.temperature –eq COLD}

  19. Bluelock is Hiring! • Want a Challenge? Passionate about virtualization? • Systems Engineer • Software Engineer • Support Specialist (2nd Shift) • Engagement Manager • Account Executive • Accounting Specialist • For more info: • http://www.bluelock.com/information-center/careers/

  20. VMware PowerCLI

  21. What is PowerCLI?

  22. Adding the Snapinvs Running PowerCLI • The PowerCLI icon generates aliases • (egGet-PowerCLIHelp) • A little slower startup, in my experience • Adding the snapin to powershell • Easy to add snapin • Don’t rely on aliases • Easier for task scheduling • Add to Powershell profile

  23. Add snapin and connect • Add-PSSnapinvmware.vimautomation.core • Demo… • Let’s look at their Cmdlets… • Get-Command –PSSnapinvmware* • Connect-VIServer • Demo…

  24. Getting information • Get-Datacenter • Get-Cluster • Get-Datastore • Get-VirtualSwitch • Get-ResourcePool • Get-VM • Get-Harddisk

  25. Getting more detail • Format-List * • Get-View • (Advanced) • Returns the ENTIRE .NET object • Including methods and properties!

  26. Reporting • There’s a Cmdlet for that… • ConvertTo-HTML • Export-CSV • Out-File • vCheck • http://www.virtu-al.net/featured-scripts/vcheck/ • LOTS of fun information!

  27. Making Changes • Start/Stop/Reset VMs (hard) • Shutdown/Restart VMGuest (Soft) • VM settings • The –WhatIf switch • Create VMs • The –RunAsync switch • Delete VMs • -DeletePermanently

  28. Cool personal use cases • The case of the Hex WWNs • The case of the Broken Path • The case of the Over-Powered Hosts

  29. Your turn… • Connect-VIServer<vCenter Server> • Browse around with some Get Cmdlets • Create a new VM (use your first initial, last name as the VM) • Power it up! Create a snapshot! • Power it down, Delete the VM! • Can you

  30. VMware Onyx

  31. Onyx • It’s a vCenter Proxy • Captures traffic, turns it into PowerShell Code • http://labs.vmware.com/flings/onyx • Demo… Code! vSphere Client Onyx vCenter

  32. vCloudPowershell

  33. Why the Cloud? Act Quickly Unknowns Change your Mind

  34. vCloudPowershell • The inventory dilemma again! • Can’t get the info from vCenter • All the info was in vCloud Director • The vCloud API • RESTful • Nothing existed for Powershell

  35. vCloudPowershell • Demo! • Get-vCloudVM • PowerOff-vCloudVM • PowerOn-vCloudVM • Get-vCloudConsole

  36. Set-TheEnd Twitter: @jakerobinson Web: bluelock.com

More Related