PowerCLI for the PowerShell Inclined

  • 462 views
Uploaded 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. …

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.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
462
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
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. PowerCLI for the PowerShell Inclined Josh Atwell vtesseract.com #vBrownBag Podcast @Josh_Atwell #RTPSUG / @RTPSUG
  • 2. @josh_atwell - @rtpsug
  • 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. What is PowerCLI www.vmware.com/go/powercli Windows PowerShell for VMware Virtual Infrastructure and components PowerCLI Admin Guide @josh_atwell - @rtpsug
  • 5. PowerCLI Capabilities @josh_atwell - @rtpsug
  • 6. First Commands Get-PowerCLIConfiguration Set-PowerCLIConfiguration –DefaultVIServerMode „multiple‟ Get-PowerCLIVersion @josh_atwell - @rtpsug
  • 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. Get-View • Returns the vSphere .Net view objects • Filters! • Methods • Check out vNugglets.com @josh_atwell - @rtpsug
  • 9. Get-View Filters $filter = @{“Name” = “VMName”} Get-View –ViewType “VirtualMachine” –Filter $filter @josh_atwell - @rtpsug
  • 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. .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. 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. 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. 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. Wider Management • • • • • VMware Update Manager vCloud Director View AutoDeploy Distributed Virtual Switch @josh_atwell - @rtpsug
  • 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. Project Onyx Now supporting vSphere 5.5!! @josh_atwell - @rtpsug
  • 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. 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. 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