PowerCLI for the PowerShell Inclined

946 views
774 views

Published on

An introduction to PowerCLI for folks who already have familiarity with PowerShell. I touch on fundamentals of PowerCLI cmdlets and some little known gems.

This presentation was presented to the RTP PowerShell Users Group on 2/19/2014.

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

No Downloads
Views
Total views
946
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
20
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

PowerCLI for the PowerShell Inclined

  1. 1. PowerCLI for the PowerShell Inclined Josh Atwell vtesseract.com #vBrownBag Podcast @Josh_Atwell #RTPSUG / @RTPSUG
  2. 2. @josh_atwell - @rtpsug
  3. 3. Get-Agenda • • • • • • What is PowerCLI Getting Started Managing vSphere Environment Get-View and .ExtensionData Managing Update Manager (VUM) Project Onyx @josh_atwell - @rtpsug
  4. 4. What is PowerCLI www.vmware.com/go/powercli Windows PowerShell for VMware Virtual Infrastructure and components PowerCLI Admin Guide @josh_atwell - @rtpsug
  5. 5. PowerCLI Capabilities @josh_atwell - @rtpsug
  6. 6. First Commands Get-PowerCLIConfiguration Set-PowerCLIConfiguration –DefaultVIServerMode „multiple‟ Get-PowerCLIVersion @josh_atwell - @rtpsug
  7. 7. Connecting Connect-VIServer $cred = Get-Credential Connect-VIserver –Credential $cred Multiple Ways to Connect Connect-VIserver –AllLinked Connect-Viserver –Menu $DefaultVIServer @josh_atwell - @rtpsug
  8. 8. Get-View • Returns the vSphere .Net view objects • Filters! • Methods • Check out vNugglets.com @josh_atwell - @rtpsug
  9. 9. Get-View Filters $filter = @{“Name” = “VMName”} Get-View –ViewType “VirtualMachine” –Filter $filter @josh_atwell - @rtpsug
  10. 10. Get-View and Methods Test-vMotion $si = Get-View ServiceInstance -Server $global:DefaultVIServer $VmProvCheck = get-view $si.Content.VmProvisioningChecker $result = $VmProvCheck.CheckMigrate( $vmMoRef, $hsMoRef, $pool, $null, $null ) VM MoRefID Host MoRefID @josh_atwell - @rtpsug Resource Pool MoRefID
  11. 11. .ExtensionData Let‟s say you need a VM and what host and MoRef that VM is on $vm.Vmhost $vm.ExtensionData.MoRef.Value $vm.ExtensionData.ResourcePool.Value @josh_atwell - @rtpsug
  12. 12. Browse Datastores - Hard Use of PSDrives for browsing datastores $datastore = Get-Datastore “Name” $psdrivename = $datastore.name New-PSDrive -Name $psdrivename -PSProvider VimDatastore -Root / -Location $datastore Get-Childitem ($psdrivename + “:/”) Remove-PSdrive -name $psdrivename Confirm:$false @josh_atwell - @rtpsug
  13. 13. Browse Datastores - Easy • vi = Inventory of current VIServer • vis = Inventory of All connected VIServers • cd vi: • dir (alias for Get-ChildItem) – will give you what is in that root directory • dir –recurse – gives all objects including subfolders P. 28 of PowerCLI Admin Guide @josh_atwell - @rtpsug
  14. 14. Browse Folders - Easy • vmstore: • vmstores: • cd vmstore: • dir (get-childitem) • dir –recurse | Select Name, ItemType P. 28 of PowerCLI Admin Guide @josh_atwell - @rtpsug
  15. 15. Wider Management • • • • • VMware Update Manager vCloud Director View AutoDeploy Distributed Virtual Switch @josh_atwell - @rtpsug
  16. 16. Update Manager (VUM) NOTE: VUM Snap-in is version specific. V5 snap-in does not manage vSphere 4 Update Manager • Locate Commands Quickly – Get-VICommand *patch* – Get-VICommand *baseline* – Get-VICommand –PSSnapin VMware.VumAutomation @josh_atwell - @rtpsug
  17. 17. Project Onyx Now supporting vSphere 5.5!! @josh_atwell - @rtpsug
  18. 18. PowerCLI Community Get-PowerCLICommunity http://www.vbrownbag.com/ http://www.virtu-al.net/ http://www.lucd.info/ http://geekafterfive.com/ http://vnugglets.com/ (Get-View) @josh_atwell - @rtpsug
  19. 19. Published Resources VMware vSphere PowerCLI Reference Alan Renouf, Luc Dekens, Glenn Sizemore, Jonathan Medd, Arnim van Lieshout Managing VMware Infrastructure with Windows PowerShell Hal Rottenberg VMware vSphere PowerCLI Hal Rottenberg PluralSight @josh_atwell - @rtpsug
  20. 20. Published Resources Mastering vSphere 5.5 Scott Lowe, Nick Marshall, Forbes Guthrie, Matt Liebowitz, Josh Atwell Learning PowerCLI Robert van den Nieuwendijk @josh_atwell - @rtpsug

×