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.
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
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