Your SlideShare is downloading. ×
0
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Providence VMUG - PowerCLI
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Providence VMUG - PowerCLI

887

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
887
On Slideshare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Providence VMUG PowerCLI Jonathan Frappier, @jfrappier www.virtxpert.com
  • 2. Providence VMUG | PowerCLI • Who am I (aka why you should listen to me) • Why automate? • Why PowerCLI? • PowerCLI 101: Get-AllTHEcmdlets! • Combining PowerCLI cmdlets into scripts • Live demo (because that’s always a good idea) • Next steps challenge • Community resources • Q&A
  • 3. Providence VMUG | PowerCLI Who am I? • 15+ Years in technology • VMware Certified Advanced Professional – Data Center Design (VCAP5-DCD) • EMC Proven Cloud Infrastructure and Services (EMCCIS) • Community dude – Twitter, blogger, podcaster @vbrownbag, VMware vExpert 2013-2014, EMC Elect 2014 • Author • I have struggled with automation, I have struggled with business that didn’t understand the value, I taught those companies why automation was important
  • 4. Providence VMUG | PowerCLI Why automate? • NOT a time saver…at first
  • 5. Providence VMUG | PowerCLI Why automate? Automation is the path to ITaaS. Automation enables Standardization, Standardization leads to Security
  • 6. Providence VMUG | PowerCLI Why automate? 1. Understand business requirements 2. Documentation 3. Standardization 4. Automation 5. Security
  • 7. Providence VMUG | PowerCLI Why PowerCLI?
  • 8. Providence VMUG | PowerCLI
  • 9. Providence VMUG | PowerCLI Why PowerCLI? • Free, extremely powerful tool with over 370 cmdlets • Ability to control installation, management and configuration of vSphere components (vSphere, vCenter, ESXi, Networking, Storage, VMs), vCloud Director, VMware View • Designed for system administrators, low learning curve • Important tool used for custom ESXi images and Auto Deploy • Use seamlessly with standard Windows PowerShell cmdlets/functions • Many community resources • Did I mention free?
  • 10. Providence VMUG | PowerCLI Why PowerCLI - Example • Even basic vSphere tasks can be a very lengthy process • Creating a new VM requires ~ 33 mouse clicks • 1 line in PowerCLI can do the same thing as 33 mouse clicks!
  • 11. Providence VMUG | PowerCLI Get-Started (not a real cmdlet) • On 64-bit systems, launch PowerShell and PowerShell x86 consoles and run – Set-ExecutionPolicy RemoteSigned • New- & Set-OSCustomizationSpec cmdlets are 32-bit only • Run PowerShell and PowerCLI as Administrator (even if you are an administrator)
  • 12. Providence VMUG | PowerCLI PowerCLI 101 – Get cmdlets • Allows you to retrieve information (e.g. “get”) • If you remember only 1 Get cmdlet, make it Get-Help Get-* • You use Get-Help to get information about a specific cmdlet: Get- Help Get-VM (-examples)
  • 13. Providence VMUG | PowerCLI PowerCLI 101 – Example - Get-VMHost
  • 14. Providence VMUG | PowerCLI PowerCLI 101 – Display Output • Format-Wide, Format-List, Format-Table (Default)
  • 15. Providence VMUG | PowerCLI PowerCLI 101 – Filtering • Select-Object (select) – Get-VMHost | Get-VMHostNetworkAdapter | Select-Object Mac • Where-Object – Get-VMHost | Get-VMHostNetworkAdapter | Where-Object –eq Mac – -eq, -like, -contains, -notcontains, -gt, -ge, -lt, -le • Out-GridView – Get-VMHost | Get-VMHostNetworkAdapter | Out-GridView
  • 16. Providence VMUG | PowerCLI PowerCLI 101 – Set cmdlets • Allows you to configure settings (e.g. “set”) • If you remember only 1 Get cmdlet, make it Get-Help • Most (All?) Get cmdlets have a corresponding Set cmdlet • In many cases you need to Get something before you can Set something
  • 17. Providence VMUG | PowerCLI PowerCLI 101 – Example Set-VMHostNetworkAdapter • In many cases you need to Get something before you can Set something – Get-VMHost host | Get-VMHostNetwork Adapter –VMKernel | Set- VMHostNetworkAdapter parameters
  • 18. Providence VMUG | PowerCLI PowerCLI 101 -whatif • Allows you to see the result of running a cmdlet or script • Useful for testing
  • 19. Providence VMUG | PowerCLI PowerCLI 101 Add-, New-, Remove- cmdlets • Add-VMHost – Adds a host to be managed by vCenter • Add-VMHostNtpServer – Adds the specified NTP server to ESXi • New-Cluster – Creates a new cluster • New-VM – Creates a new VM • Remove-Cluster – Removes the cluster • Remove-VM – Removes the VM from vCenter
  • 20. Providence VMUG | PowerCLI What is wrong with this command?
  • 21. Providence VMUG | PowerCLI Why PowerCLI – Prompt for Input Instead of: You can ask for user input:
  • 22. Providence VMUG | PowerCLI Why PowerCLI – Read from CSV Instead of: You can provide data in a CSV: Reference post from Sebastian Barylo via www.vmwaremine.com http://goo.gl/cRlbwp
  • 23. Providence VMUG | PowerCLI
  • 24. Providence VMUG | PowerCLI Tips • #Comment #Everything #Hashtag • Use full cmdlets (e.g. Select-Object instead of Select) • Indent, Indent, Indent (This is for you Kanji) – Indent once after every bracket – De-indent(?) after every closed bracket • PowerShell console shortcuts: – http://technet.microsoft.com/en-us/magazine/ff678293.aspx
  • 25. Providence VMUG | PowerCLI Next steps challenge • Keep PowerCLI open, start with Get-Cmdlets • Review the vSphere Hardening Guide ~100 PowerCLI examples for both Get- and Set- cmdlets • Find a PowerCLI/PowerShell editor you like: PowerGUI, PowerShell ISE, PowerShell Plus, NotePad++ and plenty of commercial offerings • 30/60/90 day service desk reports: What are you repeating (KISS)? Document it, automate it. • Share your scripts: Blog, GitHub, Twitter
  • 26. Providence VMUG | PowerCLI PowerCLI Ninja Challenge?
  • 27. Providence VMUG | PowerCLI Community Resources • Twitter: @PowerCLI, @PowerCLIbot, @PowerTip, @Powerscripting, @AlanRenouf, @JeffHicks, @vNoob • Blogs/Sites: – http://www.virtu-al.net/ | http://www.virtu-al.net/vcheck – https://www.vmware.com/support/developer/PowerCLI/ – http://professionalvmware.com/?s=powercli – http://www.vmware.com/security/hardening-guides • Book: Learning PowerCLI – https://smile.amazon.com – https://charitywater.org – https://charitywater.org/birthdays
  • 28. Providence VMUG | PowerCLI Q&A • Twitter: @jfrappier, @vBrownBag (hashtag: #vBrownBag) • G+: +JonathanFrappier • LinkedIn: /in/jonathanfrappier • http://virtxpert.com • http://professionalvmware.com • Book: VMware vSphere Resource Management Essentials http://amzn.to/1fAWGzk

×