vmworld 2013: powercli what’s new? administrating with the cli was never easier

34
PowerCLI What’s New? Administrating with the CLI Was Never Easier Alan Renouf, VMware VSVC5931 #VSVC5931

Upload: vmworld

Post on 22-Jan-2015

160 views

Category:

Technology


0 download

DESCRIPTION

VMworld 2013 Alan Renouf, VMware Learn more about VMworld and register at http://www.vmworld.com/index.jspa?src=socmed-vmworld-slideshare

TRANSCRIPT

  • 1. PowerCLI Whats New? Administrating with the CLI Was Never Easier Alan Renouf, VMware VSVC5931 #VSVC5931

2. 2 Agenda PowerCLI Overview Introducing PowerCLI 5.5 R1 Tag Cmdlets VDS Cmdlets Open VM Console Cmdlet Something Special! 3. 3 Introduction Alan Renouf - Sr. Technical Marketing Architect, VMware Automation: PowerCLI VMware Blog: http://blogs.vmware.com/vipowershell/ Personal Blog: http://virtu-al.net/ Twitter: @alanrenouf 4. 4 PowerCLI Overview 5. 5 PowerCLI Overview PowerCLI Overview A free product containing over 370+ cmdlets (PowerShell Commands) to use Manage every aspect of: VMware vSphere VMware vCenter Server VMware vCloud Director VMware View VMware Update Manager Integrated into Windows PowerShell Designed towards system administrators not developers Installed by default from Windows 2008/Windows 7 (XP/2003 requires download) Extending the existing PowerShell knowledge of Windows Admin Easily integrated with other Microsoft, VMware and 3rd Party Snapins PowerCLI is backward compatible all the way to ESX 4.0/ Virtual Center 4.0 6. 6 PowerCLI Snap-ins Core Managing vSphere Image Builder Working with Image Profiles Auto Deploy Deploying ESXi via PXE License Working with vSphere Licensing VDS Working with vSphere Distributed Switch Cloud vCloud Director Providers Tenant vCloud Director Tenants Core Image Builder Auto Deploy License Cloud Tenant VDS 7. 7 PowerCLI Cmdlet syntax All cmdlets use a Verb-Noun syntax, examples are: PowerCLI Overview Get-VM (Lists all VMs) Get-Datastore (Lists all Datastores) New-VM (Creates new VMs) Start-VM (Powers on VMs) New-VMHost (Adds Hosts) Stop-VM (Powers off a VMs) Set-Snapshot (alters snapshot information) Remove-VMHost (Removes Hosts) New-Datatsore (Creates new Datastores) Remove-Cluster (Removes Clusters) Built-in cmdlet help and examples Available from the PowerCLI prompt via Get-Help and online Examples of common tasks by using Get-Help cmdletname Examples Piping Allows the output of one cmdlet to be used by another Powerful one-line code solutions Get-Cluster Cluster1 | Get-VM 8. 8 Getting Started Demo DEMO 9. 9 Introducing PowerCLI 5.5 R1 10. 10 PowerCLI 5.5 R1 Overview New Cmdlets to manage vSphere Tags Manage Tags in the vSphere environment Assign Tags to vSphere Objects Remove Tag assignments from vSphere Objects VDS Easy VDS Migration Manage Private VLANs Manage VDS Policies Manage VDS Ports VM Console Open a console for vSphere/vCloud VM Open multiple consoles at once Output the URL to open VM Consoles vCloud Director 5.5 Support Support for vCD 5.5 Host Licensing Assign Host Licensing 11. 11 Tag Cmdlets Deeper Dive 12. 12 What are Tags? 13. 13 Inventory Object Tagging Ability to create custom tags on inventory objects Associate an arbitrary set of objects of the same type using a tag Search for objects by that tag Enables the business case where customers want to create arbitrary groups of VMS, Clusters, Datastores for ease of management Storage PBM uses tagging to make placement decisions Inventory objects can have multiple tags associated with it Assists Folder limitations of one folder per inventory object Ability to assign permissions based on tags to come later 14. 14 Tags vs Folders VM NYC VMs Finance VMs VM VM VM VM VM VM VM VM VM VM VM Cannot do this with folders Tag: NYC_VM Tag: Finance_VM Assign multiple tags to same VM Search VM inventory using tags 15. 15 Currently the Only Programmatic Way to Manipulate Tags Get-VM/VMHost/Datastore/VirtualPortGroup/VDPortGroup have tag parameter Return all VMs with a tag of Gold". Get-VM Tag Gold Get-Tag Return all tags named "MyTag". Get-Tag -Name MyTag Return all tags from the "MyCategory1" and "" categories, named "MyTag". MyCategory2 Get-Tag -Category MyCategory1, MyCategory2 -Name MyTag Get-TagAssignment Retrieve all tag assignments for the $datastore entity that have tags from the "MyCategory" category. $myDatastore = Get-DataStore MyDatastore Get-TagAssignment -Entity $datastore -Category MyCategory 16. 16 Manipulating Tags New-TagAssignment Assign the "MyTag" tag to all virtual machines whose name contains the "*myvm*" wildcard pattern. $myTag = Get-Tag MyTag $myVM = Get-VM '*myvm*' New-TagAssignment -Tag $myTag -Entity $myVM Remove-TagAssignment Remove all connections to tags from the specified virtual machine entity. $myVM = Get-VM myvm $myTagAssignment = Get-TagAssignment $myVM Remove-TagAssignment $myTagAssignment 17. 17 Tag Demo DEMO 18. 18 VDS Cmdlets Deeper Dive 19. 19 What's New in the VDS Snap-in? Introduced basic cmdlets in PowerCLI 5.1 R2 VDS snap-in now includes over 30 Cmdlets for managing vSphere Distributed Switches In 5.5 R1 we have new additions for: VDS Migration VDS Private VLANs VDS Policys VD VLAN Configuration VD Port 20. 20 VDS Migration VDS Migration Add-VDSwitchPhysicalNetworkAdatper Modified to accept virtual nics to be migrated together with the physical nics Add-VirtualSwitchPhysicalNetworkAdapter Added to allow attaching/migrating physical and virtual nics to virtual standard switch 21. 21 VDS Configuration VDSwitchPrivateVlan Get/New/Remove-VDSwitchPrivateVlan Added for managing private VLANs VDS Policy Get and Set cmdlets added for managing VDS Policies VDUplinkTeamingPolicy VDBlockedPolicy VDPortGroupOverridePolicy VDSecurityPolicy VDTrafficShapingPolicy VDUplinkLacpPolicy 22. 22 VDS Configuration VDVlanConfiguration Set-VLanConfiguration Added for managing VLAN configuration VDPort Get/Set-VDPort Added for managing VDPorts 23. 23 New VDS Cmdlets Demo DEMO 24. 24 Open-VMConsoleWindow 25. 25 Open VM Console Window New Cmdlet to work with VM Consoles Opens a VM Console in a web browser Default browser used Configure different browser via Set-PowerCLIConfiguration Works with vSphere and vCloud Director VMs -URLOnly parameter Returns a URL to the screen as a string The URL is valid for 30 seconds. After 30 seconds, the screen authentication ticket contained in the URL expires Open the console of the specified virtual machine in full screen mode Get-VM myVM | Open-VMConsoleWindow -FullScreen 26. 26 Open-VMConsoleWindow Demo DEMO 27. 27 Something Special 28. 28 PowerCLI Summary Additional Resources PowerCLI Blog - http://blogs.vmware.com/vipowershell/ PowerCLI Download - http://vmware.com/go/PowerCLI PowerCLI Documentation - http://vmware.com/support/developer/PowerCLI/ Detailed PowerCLI cmdlet reference with examples - http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/index.html PowerCLI Community - http://communities.vmware.com/community/vmtn/server/vsphere/automationto ols/powercli?view=discussions vSphere Automation Blog - http://blogs.vmware.com/vsphere/automation/ Luc Dekens Blog http://Lucd.info Alan Renoufs Blog http://virtu-al.net Google PowerCLI 29. 29 Further Reading 30. 30 QA Thank You for Attending Tweet a comment about this session to win @alanrenouf and #VSVC5931 Winners will be tweeted back by me during VMworld 31. 31 Other VMware Activities Related to This Session HOL: HOL-SDC-1307 vCloud Automation Solutions Group Discussions: VSVC1005-GD PowerCLI and Automation with Alan Renouf 32. THANK YOU 33. PowerCLI Whats New? Administrating with the CLI Was Never Easier Alan Renouf, VMware VSVC5931 #VSVC5931