PowerCLI Workshop


Published on

v1 of my PowerCLI Workshop. Download the scripts at http://communities.vmware.com/docs/DOC-12014

Published in: Technology
  • Hello Carter, you have published good stuff! THANKS!
    Though i would like to use the 'Demo' but am not able to do so. Can you please advise me in this so that i can use the 'Demo's'?

    Thanks so far,
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi Carter, thanks for the document. Very useful stuff!!
    I am not able to click on the demo? Can you please advise me in this?

    Thanks in advance,
    Are you sure you want to  Yes  No
    Your message goes here
  • This is the ultimate in vSphere PowerCLI Training ! For folks that prefer an instructor led course
    VMware provides a new course for new PowerCLI users;

    Course Title: VMware vSphere Automation available in the VMware Training Catalog.
    2 Day instructor led training, organizations can also use their PSO credits for course.

    Links to course are on the PowrCLI Home Page vmware.com/go/powercli
    Are you sure you want to  Yes  No
    Your message goes here
  • Download the scripts at http://communities.vmware.com/docs/DOC-12014
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • This picture is an old time accounting department. Used to be tens or hundreds of mathematicians or statisticians would sit around doing calculations and double-checking figures.
  • These days spreadsheets do the work of hundreds of calculators, and nobody thinks twice about it. Technology enabled a shift. A fundamental change in the way people did things.
  • Demo Script: MostUsedCmdlets.ps1
  • Demo Script: ImportCSV.ps1
  • Demo Script: 5Minute.ps1
  • Demo Script: LargeProvisioning.ps1
  • Demo Script: LargeUpdate.ps1
  • Demo Script: Snapshots.ps1
  • Demo Script: HostProfiles.ps1
  • Demo Script: Clusters.ps1
  • Demo Script: VMotionStorageVMotion.ps1
  • Demo Script: ThinProvision.ps1
  • Demo Script: NFS.ps1
  • Demo Script: MoveVMNetwork.ps1
  • Demo Script: VirtualSwitch.ps1
  • Demo Script: GuestDisk.ps1
  • Demo Script: Waste.ps1
  • Demo Script: CustomAttributes.ps1
  • Demo Script: RolesPermissions.ps1
  • Demo Script: StatsIntro.ps1
  • Demo Script: TopVMHost.ps1
  • Demo Script: EventReports.ps1
  • Demo Script: VMLastPoweron.ps1
  • Demo Script: ReadableCode.ps1
  • Demo Script: MaxSpeed.ps1
  • Demo Script: ObjectExtensions.ps1
  • Demo Script: GetViewGetMember.ps1
  • No script for this demo.
  • Demo Script: GuestManagement.ps1
  • Demo Script: ChangeSwap.ps1
  • Demo Script: iSCSI.ps1
  • Demo Script: RDM.ps1
  • Demo Script: UnsharedVMs.ps1
  • Demo Script: RDM.ps1
  • Demo Script: QueueDepth.ps1
  • Demo Script: AdvancedSwitch.ps1
  • Demo Script: ESXAdvancedConfig.ps1
  • Demo Script: Licensing.ps1
  • Demo Script: FindBottlenecks.ps1
  • Demo Script: ArchiveLogfiles.ps1
  • Demo Script: Alarms.ps1
  • Demo Script: RegisterVMs.ps1
  • Demo Script: RDMReport.ps1
  • Demo Script: ESXDNS.ps1
  • PowerCLI Workshop

    1. 1. vSphere PowerCLI<br />The best tool for automating vSphere<br />http://vmware.com/go/powercli<br />
    2. 2. Introduction.<br />About me.<br />Product Manager – APIs and platform.<br />twitter.com/cshanklin (@cshanklin)<br />Did you know?<br />Most of the world’s top virtualization experts use twitter?<br />http://vmware.com/go/powercli<br />
    3. 3. The Purpose of PowerCLI.<br />PowerCLI is a tool for automating all aspects of vSphere management and administration.<br />But PowerCLI is different because it’s purpose-built for use by administrators, not developers.<br />“Any knowledgeable vSphere administrator can look at PowerCLI code and immediately understand what it does.”<br />http://vmware.com/go/powercli<br />
    4. 4. You need automation to survive the virtual world.<br />Virtual assets are extremely easy to create.<br />Some people call it “virtual sprawl”.<br />But virtualization lets us do so much more – more complexity is inevitable.<br />Tools and skill sets must be upgraded to match this rise in complexity.<br />http://vmware.com/go/powercli<br />
    5. 5. Financial analysis – then.<br />
    6. 6. Financial analysis – now.<br />
    7. 7. PowerCLI changes the nature of your work.<br />In a lot of ways the current state of virtual management is like the accounting department from the 50s. A lot of manual labor.<br />Complex automation used to be only accessible to dedicated development teams.<br />But PowerCLI empowers you to do complex automation yourself.<br />http://vmware.com/go/powercli<br />
    8. 8. How to get the most out of PowerCLI.<br />Remember that PowerCLI can automate anything in vSphere.<br />Think about how these possibilities can change the nature of the things you do every day.<br />Focus on increasing your productivity.<br />Stop doing things manually.<br />Start focusing on building automation tools<br />you can use again and again.<br />http://vmware.com/go/powercli<br />
    9. 9. Overview / Agenda.<br />Getting to know you.<br />Introduction to PowerShell.<br />Introduction to PowerCLI.<br />Managing VMs with PowerCLI.<br />Managing ESX with PowerCLI.<br />Managing Storage with PowerCLI.<br />Managing Network with PowerCLI.<br />http://vmware.com/go/powercli<br />
    10. 10. Overview / Agenda (cont).<br />Other PowerCLI topics.<br />Advanced: Intro to the API.<br />Advanced Storage.<br />Advanced Network.<br />Advanced ESX.<br />Other Advanced Topics.<br />http://vmware.com/go/powercli<br />
    11. 11. Getting to know you.<br />How are you using PowerCLI today?<br />Would you say you’re a beginner? Expert?<br />How does PowerCLI integrate into your other management practices?<br />What things do you wish PowerCLI could do for you?<br />How do you manage physical + virtual? What is lacking here?<br />What key things did you hope to learn?<br />http://vmware.com/go/powercli<br />
    12. 12. Getting to know you.<br />Where are you wasting your time?<br />Provisioning?<br />Change management?<br />Troubleshooting?<br />What business pressures do you face?<br />Supporting a wider variety of applications?<br />Improving availability?<br />Other things?<br />http://vmware.com/go/powercli<br />
    13. 13. Intro To PowerShell<br />http://vmware.com/go/powercli<br />
    14. 14. Top 5 things to know about PowerShell.<br />The purpose.<br />The cmdlets.<br />The pipeline.<br />The platforms.<br />The products.<br />http://vmware.com/go/powercli<br />
    15. 15. PowerShell: The Purpose.<br />IT systems are getting more complex and inter-connected.<br />Virtualization leads to explosive growth in the number of assets (network, app, etc) to manage.<br />Automation is becoming a valuable and needed skill for IT administrators.<br />PowerShell allows non-programmers<br /> to automate.<br />http://vmware.com/go/powercli<br />
    16. 16. PowerShell: The cmdlets.<br />PowerShell provides almost 200 commands, called cmdlets, natively.<br />Close to 1,000 more commands are available through various “snap-ins” (e.g. PowerCLI).<br />Within PowerShell, type “Get-Command” to see a listing of commands.<br />http://vmware.com/go/powercli<br />
    17. 17. PowerShell: The Pipeline.<br />The pipeline is how you compose commands in PowerShell.<br />Outputs of one command are automatically made inputs of the next, based on type.<br />Example:<br />Get-Process notepad | Stop-Process<br />Get-VM myvm | Start-VM<br />http://vmware.com/go/powercli<br />
    18. 18. PowerShell: The Platforms.<br />PowerShell runs on all versions of Windows since XP and up.<br />Requires .NET 2.0.<br />PowerShell is installed by default in Windows 7 and Windows 2008 R2.<br />All future versions of Windows will pre-install it.<br />http://vmware.com/go/powercli<br />
    19. 19. PowerShell: The Products.<br />PowerShell support is required for all Microsoft server applications.<br />Exchange.<br />Sharepoint.<br />IIS.<br />Many more.<br />And, of course, VMware.<br />http://vmware.com/go/powercli<br />
    20. 20. The top 9 most used cmdlets.<br />
    21. 21. The top 9 most used operators.<br />
    22. 22. How well do you know PowerShell?<br />Would you say you’re more novice or expert?<br />Are you using PowerShell to manage other things such as exchange?<br />Do you view PowerShell as a strategic direction for your IT OPS?<br />Are the people picking up PowerShell more “Windows people” or “UNIX people”?<br />http://vmware.com/go/powercli<br />
    23. 23. Most Used PowerShell Cmdlets and Operators.<br />Demo<br />http://vmware.com/go/powercli<br />
    24. 24. 3 Takeaways: Most used cmdlets.<br />PowerShell provides hundreds of commands that interoperate with VMware commands.<br />Microsoft continues to invest and expand PowerShell’s reach.<br />PowerShell + PowerCLI makes it possible to manage everything from virtual infrastructure to guest.<br />http://vmware.com/go/powercli<br />
    25. 25. One bonus cmdlet you will need to automate!<br />Import-CSV.<br />Imports a spreadsheet.<br />Great for doing anything at large scale.<br />Learn this pattern and technique you won’t regret it!<br />http://vmware.com/go/powercli<br />
    26. 26. Using Import-CSV.<br />Key cmdlets:<br /><ul><li>Import-CSV
    27. 27. Export-CSV
    28. 28. Get-Content</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    29. 29. 3 Takeaways: Import-CSV.<br />Get familiar with Import-CSV!<br />Two types of automation:<br />Make the same change to every object in a large set.<br />Make a different change to each object in a large set.<br />Import-CSV is an ideal choice for solving the second problem.<br />http://vmware.com/go/powercli<br />
    30. 30. 5 PowerShell tools you should use.<br />VESI (Virtualization EcoShell).<br />PowerGUI.<br />Virtu-Al.Net vSphere PowerPack.<br />PowerShell WMI Explorer.<br />PowerShell Plus.<br />http://vmware.com/go/powercli<br />
    31. 31. Intro To PowerCLI<br />http://vmware.com/go/powercli<br />
    32. 32. Top 5 things to know about PowerCLI.<br />The purpose.<br />The cmdlets.<br />Cmdlet Tetris.<br />The products.<br />The future.<br />http://vmware.com/go/powercli<br />
    33. 33. PowerCLI: The Purpose.<br />You need automation.<br />Because it’s so easy to create virtual assets.<br />Because you need to keep up with the other guy.<br />PowerCLI is automation for everyone.<br />Reduce the distance between person who understands the problem and person who solves it.<br />PowerCLI is comprehensive. Everything<br /> vCenter can do.<br />http://vmware.com/go/powercli<br />
    34. 34. PowerCLI: The Cmdlets.<br />229 cmdlets in version 4.0 U1.<br />Built on the vSphere Web Services API.<br />Two ways to automate:<br />Simplified cmdlet approach.<br />Advanced approach using Get-View (API).<br />More coming every 6 months or so.<br />PowerCLI release philosophy is to release twice a year and be very responsive to user feedback.<br />Long-term goal to make Get-View<br /> unnecessary.<br />http://vmware.com/go/powercli<br />
    35. 35. PowerCLI: Cmdlet Tetris.<br />PowerShell commands follow the pattern Verb-Noun or Verb-Object.<br />For a given Object you will commonly see these four commands:<br />New-Object, Get-Object, Set-Object, Remove-Object<br />Look for this pattern to manage the full lifecycle of a virtual object.<br />http://vmware.com/go/powercli<br />
    36. 36. PowerCLI: The Products.<br />vCenter:<br />2.5, 4.0<br />ESX / ESXi<br />3.0, 3.5, 4.0<br />VMware Update Manager (preview)<br />http://vmware.com/go/powercli<br />
    37. 37. PowerCLI: The Future.<br />Continue to simplify automation until it is truly accessible to everyone.<br />Broaden the product portfolio to other solutions such as SRM, vCloud, etc.<br />Provide a more structured experience (i.e. not “just a bunch of scripts on some network share”)<br />http://vmware.com/go/powercli<br />
    38. 38. Making sense of it all.<br />
    39. 39. Where do you feel the most pain?<br />Configuring and maintaining ESX hosts?<br />VMs?<br />Reporting?<br />Performance analysis?<br />Troubleshooting?<br />http://vmware.com/go/powercli<br />
    40. 40. Use Cases and Demos<br />http://vmware.com/go/powercli<br />
    41. 41. PowerCLI Support Matrix (4.0 U1) (Latest)<br />Tips<br />Windows Vista (32 and 64 bit)<br />Windows 2003 (32 and 64 bit)<br />Windows XP<br />http://vmware.com/go/powercli<br />
    42. 42. PowerCLI Support Matrix (4.1) (Future!)<br />Tips<br />Windows 7 (32 and 64 bit)<br />Windows 2008 (32 and 64 bit)<br />Windows Vista (32 and 64 bit)<br />Windows 2003 (32 and 64 bit)<br />Windows XP<br />http://vmware.com/go/powercli<br />
    43. 43. 3 ways to connect.<br />Tips<br />Use your username and password.<br />Warning: don’t do this except interactively.<br />Use SSPI / Active Directory if you have it.<br />Use Import-PSCredential if you don’t.<br />See http://poshcode.org/501<br />http://vmware.com/go/powercli<br />
    44. 44. Tips<br />A 5-minute introduction to PowerCLI.<br />Key cmdlets:<br /><ul><li>Connect-VIServer
    45. 45. Get-VMHost
    46. 46. Get-VM</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    47. 47. 3 Takeaways: 5 minute intro.<br />Tips<br />PowerCLI provides more than 200 commands and it’s growing all the time.<br />PowerCLI manages everything that vCenter manages and more.<br />PowerCLI makes automation easy enough that anyone can do it.<br />http://vmware.com/go/powercli<br />
    48. 48. Get-TheMost out of “Help”<br />Tips<br />Help is PowerShell’s built-in help system.<br />Everything you need to know is documented in the cmdlet itself.<br />Supports wildcards “Help *VM*”<br />All PowerCLI cmdlets have examples.<br />“Help &lt;cmdlet&gt; -examples”<br />“Help &lt;cmdlet&gt; -full”<br />http://vmware.com/go/powercli<br />
    49. 49. Get-TheMost out of “Get” cmdlets.<br />Tips<br />Learn how to string Get-Cmdlets together.<br />Example: Get-Cluster X | Get-VMHost | Get-VM to select all VMs in a cluster.<br />PowerCLI cmdlets are designed to navigate similar to the vSphere Client hierarchy.<br />But PowerCLI can do things vSphere Client can’t.<br />You can learn this from them help but easier<br /> to just try it out.<br />Demo.<br />http://vmware.com/go/powercli<br />
    50. 50. PowerCLI supports multiple connections.<br />Tips<br />Starting in PowerCLI 4.0 U1 you can connect to multiple vCenter or ESX servers at the same time.<br />Now you can automate across multiple vCenters or across multiple ESX even if vCenter is unavailable.<br />Demo.<br />http://vmware.com/go/powercli<br />
    51. 51. The top 9 VM-related cmdlets.<br />VMs<br />
    52. 52. Managing VMs with PowerCLI.<br />VMs<br />Provisioning.<br />Change / Update.<br />Change its resource allocation (e.g. memory).<br />Change its networking.<br />Add/remove storage.<br />VMware Tools.<br />http://vmware.com/go/powercli<br />
    53. 53. What challenges do you face around VMs?<br />VMs<br />Do you tend to provision VMs in bunches or one-at-a-time?<br />What software do you use to provision?<br />How do you provision lots of VMs? How often?<br />Do you use templates or PXE-based builds?<br />How are you increasing your VM management ratios?<br />How do you detect wasted VM resources?<br />http://vmware.com/go/powercli<br />
    54. 54. 3 ways to provision your VMs.<br />VMs<br />Creating blank VMs and PXE booting them.<br />Clone a template.<br />Clone a VM while running.<br />http://vmware.com/go/powercli<br />
    55. 55. VMs<br />Provisioning at large scales.<br />Key cmdlets:<br /><ul><li>New-VM
    56. 56. Get-Template
    57. 57. Get-OSCustomizationSpec</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    58. 58. 3 Takeaways: Large-scale provisioning.<br />VMs<br />Whether you use templates or not, PowerCLI makes it easy to provision.<br />Even if you use static IP addresses PowerCLI can automate it.<br />Large-scale provisioning and Import-CSV were virtually made for each other.<br />http://vmware.com/go/powercli<br />
    59. 59. VMs<br />Large-scale VM Updates.<br />Key cmdlets:<br /><ul><li>Get-VM
    60. 60. Set-VM</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    61. 61. 3 Takeaways: VM Updates.<br />VMs<br />Large-scale updates are easy with Set-VM.<br />Master Get-* and Where cmdlets to target exactly the VMs you want.<br />If you’re worried about the impact, use –whatif.<br />http://vmware.com/go/powercli<br />
    62. 62. VMs<br />Dealing with snapshots.<br />Key cmdlets:<br /><ul><li>Get-Snapshot
    63. 63. Remove-Snapshot
    64. 64. Where-Object</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    65. 65. 3 Takeaways: Snapshots.<br />VMs<br />Snapshots are the “silent datastore killer”.<br />Track their age and size with PowerCLI.<br />Deleting lots of snapshots is a snap (sorry).<br />http://vmware.com/go/powercli<br />
    66. 66. The top 8 ESX-related cmdlets.<br />ESX<br />
    67. 67. Managing ESX with PowerCLI.<br />ESX<br />Provisioning (Host profiles or scripted)<br />Change / Update.<br />Storage.<br />Network.<br />Security, etc.<br />Managing power and connection state.<br />http://vmware.com/go/powercli<br />
    68. 68. What challenges do you face deploying ESX?<br />ESX<br />What software do you use to deploy?<br />How do you track inventory and monitor ESX?<br />How do you manage the ESX / vCenter relationship?<br />How do you manage storage and network to your ESX systems?<br />How are you planning to deal with ESXi?<br />http://vmware.com/go/powercli<br />
    69. 69. 2 ways to provision your ESX hosts.<br />ESX<br />Host Profiles.<br />Provision one server just the way you like it.<br />“Stamp out” the configuration to other servers.<br />Home-grown scripts (covered later).<br />Run a custom script to do complete configuration of a server.<br />http://vmware.com/go/powercli<br />
    70. 70. ESX<br />Dealing with Host Profiles.<br />Key cmdlets:<br /><ul><li>Get-VMHostProfile
    71. 71. Apply-VMHostProfile
    72. 72. Test-VMHostProfileCompliance</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    73. 73. 3 Takeaways: Host Profiles.<br />ESX<br />Host Profiles simplify the process of creating identically configured ESX hosts.<br />The purpose of profiles is avoiding cost and complexity “I don’t have to worry about a million things.”<br />Host Profiles are a strategic direction for VMware and will continue to improve.<br />http://vmware.com/go/powercli<br />
    74. 74. Why we cluster.<br />ESX<br />Clustering is the heart of VMware’s real value.<br />High availability.<br />Automated resource management and balancing.<br />PowerCLI gives complete and granular control over cluster configuration.<br />http://vmware.com/go/powercli<br />
    75. 75. ESX<br />Clustering your hosts for max availability.<br />Key cmdlets:<br /><ul><li>New-Cluster
    76. 76. Set-Cluster
    77. 77. Move-VMHost</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    78. 78. 2 Takeaways: Clustering.<br />ESX<br />In the past all interesting VMware functionality happened at the host level. Recently this has been moving to cluster (eventually to datacenter).<br />PowerCLI gives you the tools you need to configure, monitor and audit your clusters.<br />http://vmware.com/go/powercli<br />
    79. 79. You can also automate DRS rules.<br />ESX<br />Key cmdlets:<br />New-DrsRule<br />Get-DrsRule<br />Set-DrsRule<br />Remove-DrsRule<br />http://vmware.com/go/powercli<br />
    80. 80. The top 9 storage-related cmdlets.<br />Storage<br />
    81. 81. Managing Storage with PowerCLI.<br />Storage<br />Adding existing datastores or formatting new.<br />Rescanning storage.<br />Capacity and utilization reports.<br />Identifying datastores that are not visible to the entire cluster.<br />http://vmware.com/go/powercli<br />
    82. 82. What challenges do you face around storage?<br />Storage<br />Do you have a dedicated storage team? How well do storage and virtualization interact?<br />Do you have separate storage management tools?<br />How do you identify and resolve storage bottlenecks?<br />When users complain about slow applications, what do you do?<br />http://vmware.com/go/powercli<br />
    83. 83. Storage VMotion is a snap.<br />Storage<br />Move-VM is a versatile command.<br />If you use –Datastore you will Storage VMotion.<br />http://vmware.com/go/powercli<br />
    84. 84. Storage<br />VMotion and Storage VMotion with Move-VM.<br />Key cmdlets:<br /><ul><li>Move-VM
    85. 85. Get-VMHost
    86. 86. Get-Datastore</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    87. 87. 3 Takeaways: Storage VMotion.<br />Storage<br />Performing a Storage VMotion can take a really long time.<br />Perfect reason to script it.<br />Try to beat this simplicity:<br />Get-VM –Datastore ds1 | Move-VM –Datastore ds2<br />http://vmware.com/go/powercli<br />
    88. 88. Save money with thin provisioning.<br />Storage<br />Allocate space as it is used rather than all at once.<br />Huge space savings at the cost of some performance.<br />You can provision new VMs thin or convert existing with PowerCLI.<br />http://vmware.com/go/powercli<br />
    89. 89. Storage<br />Thin Provisioning.<br />Key cmdlets:<br /><ul><li>New-VM
    90. 90. New-Harddisk
    91. 91. Set-Harddisk</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    92. 92. 3 Takeaways: Thin Provisioning.<br />Storage<br />Storage is expensive! Why pay for the parts you’re not using?<br />With simple PowerCLI scripts you can change existing VMs to use thin provisioning.<br />Or just build an easy report to see how much you’re using or how much you could save.<br />http://vmware.com/go/powercli<br />
    93. 93. Storage<br />Adding NFS Datastores to ESX.<br />Key cmdlets:<br /><ul><li>New-Datastore</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    94. 94. 2 Takeaways: NFS Datastores.<br />Storage<br />Adding and auditing NFS datastores is simple with PowerCLI.<br />Warning: NFS performance statistics are not available (coming in a future version of vSphere).<br />http://vmware.com/go/powercli<br />
    95. 95. The top 9 network-related cmdlets.<br />Network<br />
    96. 96. Managing Networking with PowerCLI.<br />Network<br />Adding or configuring VMKernel.<br />Moving VMs between virtual switches.<br />Configuring virtual switch policies.<br />http://vmware.com/go/powercli<br />
    97. 97. What challenges do you face around network?<br />Network<br />How do you manage the interaction between virtual and physical switch? Example: VLAN, CDP.<br />How do you ensure consistent network configuration across ESX hosts?<br />Do you use trunking for max performance? Have you encountered problems doing this?<br />http://vmware.com/go/powercli<br />
    98. 98. Network<br />Moving VMs between networks.<br />Key cmdlets:<br /><ul><li>Get-NetworkAdapter
    99. 99. Set-NetworkAdapter</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    100. 100. 2 Takeaways: Changing VM Networks.<br />Network<br />Moving VMs from one network to another is quick and easy.<br />If a virtual switch is re-created, on purpose or by accident, your VMs will all be disconnected. You can solve that with one line of PowerCLI.<br />http://vmware.com/go/powercli<br />
    101. 101. Network<br />Configuring Consistent Virtual Switches.<br />Key cmdlets:<br /><ul><li>New-VirtualSwitch
    102. 102. Get-VirtualSwitch</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    103. 103. 3 Takeaways: Virtual Switches.<br />Network<br />Creating consistent virtual switches is key for many VMware features such as DRS.<br />Creating switches manually is insane, especially considering the simplicity of PowerCLI.<br />You can also set policy items like failover and load balancing (covered later).<br />http://vmware.com/go/powercli<br />
    104. 104. The top 5 reporting cmdlets.<br />Reports<br />
    105. 105. Reporting with PowerCLI.<br />Reports<br />Three major categories of PowerCLI reports.<br />Inventory-based reporting.<br />Statistic-based reporting (i.e. performance)<br />Event-based reporting.<br />http://vmware.com/go/powercli<br />
    106. 106. Reporting with PowerCLI.<br />Reports<br />What reporting tools do you use today? Do you think they are good?<br />Do you use reports more for planning or more for reacting to problems?<br />Where do you feel you are “in the dark”?<br />http://vmware.com/go/powercli<br />
    107. 107. Inventory-based reporting.<br />Reports<br />Relies on Get-* cmdlets as a starting point.<br />Generally combined with Export-CSV or ConvertTo-Html.<br />http://vmware.com/go/powercli<br />
    108. 108. Report on your guest disk capacity.<br />Reports<br />Basic report.<br />Sort by least % free space.<br />Show all guests with &lt;10% free space.<br />http://vmware.com/go/powercli<br />
    109. 109. Reports<br />Reporting on Guest Disk Capacity.<br />Key cmdlets:<br /><ul><li>Get-VM
    110. 110. Get-Harddisk</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    111. 111. 3 Takeaways: Guest Disks.<br />Reports<br />Relies on VMware Tools!<br />Avoid a disaster by identifying disks that are about to overflow.<br />Also makes it easy to understand how much thin provisioning would save you.<br />http://vmware.com/go/powercli<br />
    112. 112. 3 ways to report on wasted resources.<br />Reports<br />Orphaned VMDKs. – script not working now<br />Unused VMs.<br />???<br />http://vmware.com/go/powercli<br />
    113. 113. Reports<br />Reporting on Wasted Resources.<br />Key cmdlets:<br /><ul><li>Get-ChildItem
    114. 114. ??</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    115. 115. 3 Takeaways: Wasted Resources.<br />Reports<br />X1<br />X2<br />X3<br />http://vmware.com/go/powercli<br />
    116. 116. Reporting with custom attributes.<br />Reports<br />Custom attributes are extremely useful for tracking things unique to your deployment.<br />Example: VM owner, app owner, etc.<br />Get-CustomAttribute.<br />http://vmware.com/go/powercli<br />
    117. 117. Reports<br />Reporting with Custom Attributes.<br />Key cmdlets:<br /><ul><li>Get-CustomAttribute
    118. 118. Get-Inventory</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    119. 119. 3 Takeaways: Custom Attributes.<br />Reports<br />If you’re not using custom attributes – start!<br />Audit your custom attributes to determine compliance (all the data is there and accurate)<br />You should set attributes as part of your provisioning process.<br />http://vmware.com/go/powercli<br />
    120. 120. Reports<br />Security reporting using roles and permissions.<br />Key cmdlets:<br /><ul><li>Get-VIUser
    121. 121. Get-VIRole</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    122. 122. 3 Takeaways: Roles and Permissions.<br />Reports<br />PowerCLI gives you all the tools you need to audit roles and permissions.<br />With Quest’s ActiveRoles you can load Active Directory information for more useful reports.<br />With PowerCLI you can easily duplicate roles and permissions between vCenter instances.<br />http://vmware.com/go/powercli<br />
    123. 123. Statistic-based reporting.<br />Reports<br />Relies on Get-Stat as a starting point.<br />Commonly you will rank the results.<br />This can feed into other script logic or be exported like an inventory report would be exported.<br />http://vmware.com/go/powercli<br />
    124. 124. Get-TheMost out of Get-Stat.<br />Reports<br />Get-StatType identifies available statistics.<br />Understanding instances is critical.<br />Note: vCenter and ESX may report different types of statistics.<br />http://vmware.com/go/powercli<br />
    125. 125. Reports<br />Introduction to statistic-based reporting.<br />Key cmdlets:<br /><ul><li>Get-Stat</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    126. 126. 3 Takeaways: Reporting with Statistics.<br />Reports<br />Querying statistics help you identify and solve performance problems.<br />Stats on vCenter are determined by stat level. The higher the level the more stats you have.<br />If you query ESX directly all stats are available but for short periods (5 mins on 3.5, 1hr on 4.0)<br />http://vmware.com/go/powercli<br />
    127. 127. Top 8 Most Interesting Statistics.<br />Reports<br />
    128. 128. Reports<br />Most and least busy VMs and Hosts.<br />Key cmdlets:<br /><ul><li>Get-Stat</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    129. 129. 2 Takeaways: Host and VM Usage.<br />Reports<br />Identifying overused resources it the first step to effective rebalancing.<br />With PowerCLI you get a complete picture all at once no matter how many hosts or VMs you have.<br />http://vmware.com/go/powercli<br />
    130. 130. Event-based reporting.<br />Reports<br />Relies on Get-VIEvent as a starting point.<br />Most vSphere actions create events in order to generate an audit trail.<br />This audit trail can be followed and inspected for a large number of uses.<br />http://vmware.com/go/powercli<br />
    131. 131. Reports<br />Introduction to event-based reporting.<br />Key cmdlets:<br /><ul><li>Get-VIEvent</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    132. 132. 3 Takeaways: Event-based reporting.<br />Reports<br />Events tell you who did what when.<br />ESX retains a fixed number of events, vCenter retains all events since a given date.<br />Before you report events be sure to understand your vCenter’s event retention policy.<br />http://vmware.com/go/powercli<br />
    133. 133. Reports<br />When was that VM powered on?<br />Key cmdlets:<br /><ul><li>Get-VIEvent</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    134. 134. 3 Takeaways: Determining VM Poweron Date.<br />Reports<br />Just one of many reports you can do with events.<br />Others:<br />If an outage occurs you can find which modifications may have contributed to the outage using –Start and –Finish.<br />Track who logged in and when.<br />http://vmware.com/go/powercli<br />
    135. 135. You can get your VM’s log file too.<br />Reports<br />Get to know vmstore:<br />Use Copy-DatastoreItem to bridge the gap between local and remote.<br />http://vmware.com/go/powercli<br />
    136. 136. This report will make your manager love you (in a completely legal way).<br />Reports<br />Alan Renouf’s Daily Report.<br />Reports:<br />Numbers of objects in inventory (VMs, hosts, etc)<br />Datastores running out of space.<br />Snapshots over X days old.<br />Disconnected hosts.<br />Lots more!<br />All emailed to you every morning!<br />http://www.virtu-al.net/2009/11/04/vcheck-daily-report-v3/<br />http://vmware.com/go/powercli<br />
    137. 137. Stuff Alan’s Daily Report Will Tell You.<br />Reports<br />Number of Hosts<br />Number of VMs<br />Number of Datastores<br />Number of DRS Migrations for the last days<br />Snapshots over x Days old<br />Datastores with less than x% free space<br />VMs created over the last x days<br />VMs with No Tools<br />VMs with CD-Roms connected<br />VMs with CPU ready over x%<br />Hosts in Maintenance Mode<br />VC Error Events over the last x days<br />VC Windows Event Log Errors for the last x days with VMware in the details<br />VM active alerts<br />Cluster Active Alerts<br />vSphere check: Outdated VM Hardware (Less than V7)<br />VMs in Inconsistent folders (the name of the folder is not the same as the name)<br />http://vmware.com/go/powercli<br />
    138. 138. Sample Daily Report Output.<br />Reports<br />
    139. 139. The top 9 other cmdlets.<br />Tips<br />
    140. 140. Top 5 PowerCLI FAQs (With answers!)<br />Tips<br />How to upgrade VMware Tools with no reboot?<br />How to move only one disk during Storage VMotion?<br />How to change the ESX host’s root password?<br />How do I take lots of actions simultaneously?<br />How to get the VM’s UUID?<br />http://vmware.com/go/powercli<br />
    141. 141. Top 5 PowerCLI FAQs (With answers!)<br />Tips<br />How to upgrade VMware Tools with no reboot?<br />New in PowerCLI 4.0 U1, Update-Tools –NoReboot<br />How to move only one disk during Storage VMotion?<br />Use Set-HardDisk –Datastore.<br />Bug: Requires the VM to be powered off. This is fixed in 4.1.<br />http://vmware.com/go/powercli<br />
    142. 142. Top 5 PowerCLI FAQs (With answers!)<br />Tips<br />How to change the ESX host’s root password?<br />Connect directly to the ESX host.<br />Use Get-VMHostAccount / Set-VMHostAccount.<br />How do I take lots of actions simultaneously?<br />Most PowerCLI commands support the –Runasync flag, which causes jobs to run in the background.<br />Use this along with Wait-Task.<br />Demo.<br />http://vmware.com/go/powercli<br />
    143. 143. Top 5 PowerCLI FAQs (With answers!)<br />Tips<br />How to get the VM’s UUID?<br />Inside the view property config.uuid<br />Get-VM | Select Name, { ($_ | Get-View).config.uuid }<br />Or using object extensions (upcoming feature).<br />Demo.<br />http://vmware.com/go/powercli<br />
    144. 144. Secure your scripts with these tips.<br />Tips<br />You can configure PowerShell to not run unsigned scripts.<br />Set-ExecutionPolicyAllSigned<br />PowerShell Plus has built-in script signing.<br />http://vmware.com/go/powercli<br />
    145. 145. 3 mistakes you need to avoid!<br />Tips<br />Careful when using New-Snapshot!<br />Use –Memory if you want to revert to the snapshot without powering the VM off.<br />Careful when deleting that VM!<br />If you don’t use –DeleteFromDisk it will simply be unregistered.<br />Don’t use Write-Host!<br />Except as debugging, instead use<br /> Write-Output.<br />http://vmware.com/go/powercli<br />
    146. 146. 4 tips to make your scripts more readable<br />Tips<br />Use object names rather than separate cmdlet calls.<br />Use line continuation (backticks) when necessary.<br />Factor code into functions.<br />Use PowerGUI, VESI, or PowerShell Plus for syntax highlighting.<br />http://vmware.com/go/powercli<br />
    147. 147. Tips<br />Maximizing readability and maintainability.<br />Demo<br />http://vmware.com/go/powercli<br />
    148. 148. 3 Takeaways: Readability.<br />Tips<br />Readable code is maintainable code.<br />Take maximum advantage of Object-By-Name.<br />The pipeline separates PowerShell from other languages. Use it a lot and your readability will greatly improve.<br />http://vmware.com/go/powercli<br />
    149. 149. Tips<br />Speeding up your scripts.<br />Demo<br />http://vmware.com/go/powercli<br />
    150. 150. 3 Takeaways: Speeding up your scripts.<br />Tips<br />PowerShell does not optimize scripts. Factor variables out manually.<br />Be aware of the performance penalties OBN introduces. If you have the object handy, don’t use its name.<br />If your scripts are slow, consider caching more objects client-side.<br />http://vmware.com/go/powercli<br />
    151. 151. 1 feature you absolutely need to know.<br />Tips<br />Object Extensions.<br />Is your favorite object missing a property? Add it yourself!<br />This will fundamentally change the way you script and report.<br />“PowerCLI 2.0”<br />Demo.<br />http://vmware.com/go/powercli<br />
    152. 152. Tips<br />Simplifying Reporting With Object Extensions.<br />Key cmdlets:<br /><ul><li>New-VIObjectExtensionProperty
    153. 153. (Name subject to change)</li></ul>Demo (Future Features)<br />http://vmware.com/go/powercli<br />
    154. 154. 3 Takeaways: Object Extensions.<br />Tips<br />Object Extensions will radically simplify your scripts and reports.<br />If you ever wished an object had a certain property or field, find it in the API and you will soon be able to add it yourself.<br />Coming soon in PowerCLI 4.1.<br />http://vmware.com/go/powercli<br />
    155. 155. Learn to write a PowerShell Advanced Function<br />Tips<br />PowerShell Advanced Functions function almost exactly like PowerShell cmdlets.<br />You can write scripts that:<br />Sit in the PowerShell pipeline.<br />Interoperate with all PowerCLI cmdlets.<br />Demo.<br />“help about_functions_advanced”.<br />See “VI Toolkit Extensions” for samples.<br />http://vmware.com/go/powercli<br />
    156. 156. Learn to write a PowerShell Advanced Function<br />Tips<br />PowerShell Advanced Functions function almost exactly like PowerShell cmdlets.<br />You can write scripts that:<br />Sit in the PowerShell pipeline.<br />Interoperate with all PowerCLI cmdlets.<br />Demo.<br />“help about_functions_advanced”.<br />See “VI Toolkit Extensions” for samples.<br />http://vmware.com/go/powercli<br />
    157. 157. Anatomy of an advanced function.<br />Tips<br />functionAdvanced-Function {<br />param(<br /> [Parameter(Mandatory=$true,...]<br /> [VMware.VimAutomation.Client20.VMHostImpl]<br />$VMHost<br /> )<br />Begin {<br /> ...<br /> }<br />Process {<br /> ...<br /> }<br />End {<br /> ...<br /> }<br />}<br />Initialize at the start of the pipeline (opt)<br />Process each object in the pipeline.<br />Called at the end of the pipeline (opt)<br />
    158. 158. Sample advanced function: ESX Host Routes.<br />Tips<br />Demo.<br />http://vmware.com/go/powercli<br />
    159. 159. Resources<br />http://vmware.com/go/powercli<br />
    160. 160. 3 must-own resources:<br />Tips<br />Managing VMware Infrastructure with Windows PowerShell.<br />vSphere 4.0 Quick Start Guide.<br />VMware vSphere Pro Series Training.<br />http://vmware.com/go/powercli<br />
    161. 161. The “PowerCLI Bible”<br />Tips<br />http://vmware.com/go/powercli<br />
    162. 162. Lots of PowerCLI Samples.<br />Tips<br />http://vmware.com/go/powercli<br />
    163. 163. New training from TrainSignal!<br />Tips<br />
    164. 164. 6 Amazing Blogs to Follow:<br />Tips<br />
    165. 165. The most important resource of all:<br />Tips<br />The PowerCLI Community.<br />http://vmware.com/go/powercli<br />More than 500 scripts.<br />Search a huge and growing knowledgebase.<br />Ask questions and get answers.<br />http://vmware.com/go/powercli<br />
    166. 166. By Sheer Coincidence.<br />Tips<br />PowerShell Master Class [3 dagar]<br />Instructor: Thomas Lee, PowerShell MVP<br />Begins 2010-03-09<br />http://www.labcenter.se/Lab/2056<br />http://vmware.com/go/powercli<br />
    167. 167. Advanced Stuff!<br />http://vmware.com/go/powercli<br />
    168. 168. The vSphere API Stack.<br />API<br />
    169. 169. Managed objects and automation objects.<br />API<br />PowerCLI uses two object models.<br />Automation objects: Small objects containing only the most critical data. Returned by Get-* cmdlets (example Get-VM).<br />View objects: Full objects with no properties missing. Not optimized for usability.<br />You can easily transition between the two.<br />Get-View: Automation to view object.<br />Get-VIObjectByVIView: View to automation.<br />http://vmware.com/go/powercli<br />
    170. 170. Explore the vSphere API with PowerCLI.<br />API<br />Get-View is your gateway to the API.<br />You can pipe most objects to Get-View.<br />Some objects have hard-coded names and can must be loaded directly.<br />E.g. Get-View ServiceContent<br />http://vmware.com/go/powercli<br />
    171. 171. You can do anything with Get-View.<br />API<br />When you load a view with Get-View all its properties and methods are available to you.<br />You can see all this with PowerShell’s Get-Member cmdlet.<br />http://vmware.com/go/powercli<br />
    172. 172. API<br />Use Get-View and Get-Member to explore the API.<br />Key cmdlets:<br /><ul><li>Get-View
    173. 173. Get-Member</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    174. 174. 4 Takeaways: Get-View.<br />API<br />Get-View opens the full power of the API to you.<br />You can do anything vCenter can do using this API.<br />But: you have to use the vSphere API, which can be quite challenging.<br />Refer to the docs:<br />http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/index.html<br />http://vmware.com/go/powercli<br />
    175. 175. Surviving the vSphere API Documentation.<br />API<br />Most useful starting points: Search within:<br />All managed objects – OR –<br />All methods.<br />API has managed objects and data objects.<br />Managed objects define methods, data objects do not.<br />http://vmware.com/go/powercli<br />
    176. 176. Surviving the vSphere API Documentation (cont)<br />API<br />When calling managed object methods you will generally need to supply some data objects.<br />Managed objects are returned by PowerCLI’s Get-View cmdlet.<br />Data objects are constructed by PowerShell’s New-Object cmdlet.<br />New-Object VMware.Vim.VirtualMachineConfigSpec<br />
    177. 177. Using “Project Onyx”.<br />API<br />Onyx is a code generator.<br />Sits between vSphere Client and vCenter.<br />Any UI click is automatically turned to code.<br />http://vmware.com/go/powercli<br />
    178. 178. “Project Onyx” Architecture.<br />API<br />ESX or vCenter<br />
    179. 179. API<br />Using Onyx.<br />Demo<br />http://vmware.com/go/powercli<br />
    180. 180. 3 Takeaways: Onyx.<br />API<br />Onyx makes it simple to understand what calls vSphere Client makes and when.<br />From this you can understand the best practices and tested code paths VMware uses.<br />Warning: You will need to re-factor code generated by Onyx.<br />http://vmware.com/go/powercli<br />
    181. 181. Advanced VM management topics.<br />VMs<br />PowerCLI can run commands inside your guests.<br />You can granularly control the placement of memory and snapshot files.<br />Using View? PowerCLI gives you granular control over VM video memory.<br />http://vmware.com/go/powercli<br />
    182. 182. 2 ways to manage your guests.<br />VMs<br />With PowerShell / PowerCLI you can manage inside your guest too.<br />Option 1: WMI over the network.<br />Option 2: Invoke-VMScript and related cmdlets via VMware Tools.<br />http://vmware.com/go/powercli<br />
    183. 183. VMs<br />Guest management.<br />Key cmdlets:<br /><ul><li>Invoke-VMScript
    184. 184. Copy-GuestFile</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    185. 185. 3 Takeaways: Guest Management.<br />VMs<br />Run programs in your guest or copy files there.<br />You could combine these to install software agents, etc.<br />Supports Windows or Linux.<br />Works even if your VM’s network is down or disconnected.<br />http://vmware.com/go/powercli<br />
    186. 186. More advanced guest management: Customizing the scripts.<br />VMs<br />Certain guest cmdlets can be completely re-wired by substituting their scripts.<br />Script sources located at $env:PROGRAMFILESVMwareInfrastructurevSphere PowerCLIScripts<br />http://vmware.com/go/powercli<br />
    187. 187. VMs<br />Changing swap and memory location.<br />Key cmdlets:<br /><ul><li>Get-View</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    188. 188. 4 Takeaways: Changing swap location.<br />VMs<br />Take advantage of cheaper storage for less critical data.<br />Controllable on a per-cluster, per-host, or per-vm basis.<br />Changes location for both snapshot and virtual memory.<br />Warning: Decreases average reliability.<br />http://vmware.com/go/powercli<br />
    189. 189. Advanced storage management topics.<br />Storage<br />All about iSCSI.<br />Storage path reporting and management.<br />Telling the difference between shared and unshared storage.<br />Reporting on LUN performance.<br />Configuring queue depth.<br />http://vmware.com/go/powercli<br />
    190. 190. Adding iSCSI datastores.<br />Storage<br />Adding iSCSI to ESX is a good deal more complex.<br />But it offers more options and security features.<br />PowerCLI can add the storage with or without authentication.<br />http://vmware.com/go/powercli<br />
    191. 191. Storage<br />Adding iSCSI to your hosts.<br />Key cmdlets:<br /><ul><li>Get-VMHostStorage
    192. 192. Get-ScsiLun
    193. 193. New-Datastore</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    194. 194. 3 Takeaways: Using iSCSI.<br />Storage<br />iSCSI comes in two flavors, software and hardware.<br />To use software iSCSI you must enable the virtual iSCSI adapter.<br />iSCSI has richer security capabilities than NFS. This leads to higher complexity.<br />PowerCLI has very rich support for iSCSI.<br />http://vmware.com/go/powercli<br />
    195. 195. Two types of storage for your VMs.<br />Storage<br />VMDK-based virtual hard disks.<br />Raw devices (RDM).<br />Warning: Think hard before using RDM!<br />Won’t overcome size limitations!<br />Won’t necessarily give you better performance!<br />http://vmware.com/go/powercli<br />
    196. 196. Storage<br />Finding and mounting raw devices.<br />Key cmdlets:<br /><ul><li>Get-ScsiLun
    197. 197. New-Harddisk</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    198. 198. 3 Takeaways: Raw Devices.<br />Storage<br />Raw devices are necessary in some applications such as MSCS.<br />PowerCLI makes it easy to mount, unmount and report on raw devices.<br />Warning: If you don’t need raw devices you probably shouldn’t use them.<br />http://vmware.com/go/powercli<br />
    199. 199. Storage<br />Find VMs on unshared storage.<br />Key cmdlets:<br /><ul><li>Get-View
    200. 200. Get-Datastore
    201. 201. Get-VM</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    202. 202. 3 Takeaways: Unshared VMs.<br />Storage<br />VMs on unshared storage can’t participate in many advanced vSphere features such as DRS.<br />If you’ve got hundreds or thousands of VMs you have to automate finding unshared VMs.<br />PowerCLI also makes it easy to solve the problem: with Move-VM.<br />http://vmware.com/go/powercli<br />
    203. 203. Storage<br />Determining LUN Performance.<br />Key cmdlets:<br /><ul><li>Get-Stat
    204. 204. Warning: Doesn’t work with NFS storage.</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    205. 205. 3 Takeaways: LUN Performance.<br />Storage<br />LUN latency is a key statistic to watch. If it gets too high, workloads will be affected.<br />There are no real standards but a pretty good suggestion is:<br />Virtual desktops: Users will start complaining at about 20ms latency.<br />Non-interactive, workloads: will be impacted around 40ms latency.<br />Once you identify the problem, solve it<br /> with PowerCLI’s Move-VM.<br />http://vmware.com/go/powercli<br />
    206. 206. Configuring adapter queue depth.<br />Storage<br />By default your adapter’s queue depth is 32.<br />This can be adjusted.<br />Warning: adjustments require host reboots.<br />Warning: May increasing queue depth may worsen performance depending on your storage network and storage.<br />http://frankdenneman.wordpress.com/2009/03/04/increasing-the-queue-depth/<br />http://vmware.com/go/powercli<br />
    207. 207. Storage<br />Configuring adapter queue depth.<br />Key cmdlets:<br /><ul><li>Set-VMHostModule</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    208. 208. 3 Takeaways: Queue Depth.<br />Storage<br />Increasing queue depth can improve your storage performance.<br />It can also harm it, especially on LUNs shared by lots of hosts.<br />Be sure to read and understand all factors in play before making any changes.<br />http://vmware.com/go/powercli<br />
    209. 209. Advanced network management.<br />Network<br />Advanced switch and portgroup policies.<br />Creating and updating your service consoles.<br />http://vmware.com/go/powercli<br />
    210. 210. Network<br />Advanced Network Management.<br />Key cmdlets XXX need demo copied to desktop:<br /><ul><li>Get-NicTeamingPolicy
    211. 211. Set-NicTeamingPolicy</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    212. 212. 3 Takeaways: Advanced Network Management.<br />Network<br />Policies can be set on a per-switch or per-portgroup basis.<br />Switch policies are inherited by portgroups unless they are explicitly overridden.<br />The right policy is critical to effective operation and high availability of your ESX hosts. PowerCLI helps you be consistent.<br />http://vmware.com/go/powercli<br />
    213. 213. Advanced ESX management.<br />ESX<br />ESX build scripts.<br />Setting advanced configuration parameters.<br />Licensing.<br />http://vmware.com/go/powercli<br />
    214. 214. ESX build scripts you can use.<br />ESX<br />Lance Berc’s “How To Configure Freshly Booted ESX with PowerShell”<br />http://communities.vmware.com/thread/161304<br />Stephen’s Campbell’s “Not Another ESX Provisioning Script”<br />http://communities.vmware.com/docs/DOC-8170<br />http://vmware.com/go/powercli<br />
    215. 215. ESX<br />Advanced Host Options.<br />Key cmdlets:<br /><ul><li>Set-VMHostAdvancedConfiguration</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    216. 216. 3 Takeaways: Advanced Host Options.<br />ESX<br />There are hundreds of advanced host options.<br />Some vendors (example NetApp) recommend specific settings for some options. PowerCLI ensures you can set and audit these consistently.<br />Warning: advanced options regularly change between releases.<br />http://vmware.com/go/powercli<br />
    217. 217. ESX<br />Licensing.<br />Key cmdlets:<br /><ul><li>Get-View</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    218. 218. 3 Takeaways: Licensing.<br />ESX<br />Applying a license is a necessary step in any ESX build script.<br />Licensing changed a lot for vSphere.<br />Different calls are needed depending on if you are connected to ESX or vCenter.<br />http://vmware.com/go/powercli<br />
    219. 219. Advanced Reporting.<br />Reports<br />Identifying performance bottlenecks.<br />Searching and archiving log files.<br />Mixing vSphere and Active Directory.<br />http://vmware.com/go/powercli<br />
    220. 220. Reports<br />Identifying performance bottlenecks.<br />Key cmdlets:<br /><ul><li>Get-Stat</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    221. 221. 3 Takeaways: Performance Bottlenecks.<br />Reports<br />Bottlenecks occur when too many things compete for too few things.<br />PowerCLI can identify resources that have too many competitors.<br />PowerCLI can also easily move these around to balance workloads.<br />http://vmware.com/go/powercli<br />
    222. 222. Reports<br />Archiving Log Files.<br />Key cmdlets:<br /><ul><li>Copy-DatastoreItem</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    223. 223. 3 Takeaways: Archiving Log Files.<br />Reports<br />Retaining log files is critical for audit and compliance.<br />Log files are rotated (a.k.a. deleted) regularly.<br />The number of log files retained is customizable through PowerCLI.<br />http://vmware.com/go/powercli<br />
    224. 224. 6 Advanced FAQs (with answers!)<br />Tips<br />How can I reconfigure all my alarms to send SNMP traps?<br />How to find and register missing VMs?<br />How to report on RDM?<br />How to change DNS servers for ESX?<br />How do I schedule a PowerCLI script?<br />How about a script to respond to an<br /> alarm?<br />http://vmware.com/go/powercli<br />
    225. 225. Tips<br />Updating vCenter alarms.<br />Key cmdlets:<br /><ul><li>Get-View</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    226. 226. 2 Takeaways: vCenter Alarms.<br />Tips<br />If you’re deploying a lot of vCenter instances, PowerCLI will consistently reconfigure alarms just the way you want them.<br />LucD has a great script to move alarms from one container to another.<br />http://lucd.info/?p=1799<br />http://vmware.com/go/powercli<br />
    227. 227. Tips<br />Find and register missing VMs.<br />Key cmdlets:<br /><ul><li>Get-VM
    228. 228. Get-View
    229. 229. Get-Childitem</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    230. 230. 2 Takeaways: Registering VMs.<br />Tips<br />Unregistering a VM rather than deleting it is a very common problem. This leads to wasted resources.<br />Warning: If you have two vCenters sharing the same storage, you will get false positives!<br />http://vmware.com/go/powercli<br />
    231. 231. Tips<br />Reporting on RDM.<br />Key cmdlets:<br /><ul><li>Get-VM
    232. 232. Get-ScsiLun</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    233. 233. 1 Takeaway: RDM Reporting.<br />Tips<br />This simple report will help you ensure RDM is only being used by VMs that need it.<br />http://vmware.com/go/powercli<br />
    234. 234. Tips<br />Changing ESX IP address and DNS server.<br />Key cmdlets:<br /><ul><li>Set-VMHostNetwork
    235. 235. Set-VMHostNetworkAdapter</li></ul>Demo<br />http://vmware.com/go/powercli<br />
    236. 236. 2 Takeaways: Changing ESX IP and DNS.<br />Tips<br />Setting IP and DNS is another essential component of deploying ESX.<br />The same PowerCLI command lets you set IP and DNS attributes.<br />http://vmware.com/go/powercli<br />
    237. 237. How to schedule PowerCLI scripts.<br />Tips<br />Alan Renouf has a great writeup.<br />http://www.virtu-al.net/2009/07/10/running-a-powercli-scheduled-task/<br />http://vmware.com/go/powercli<br />
    238. 238. 3 vSphere killers to regularly check.<br />Tips<br />Are any VMs waiting for answers?<br />Automatically scanning for configuration issues.<br />DRS clusters with configuration problems.<br />http://vmware.com/go/powercli<br />
    239. 239. Running scripts in response to alarms.<br />Tips<br />Fully documented 5 step process on the PowerCLI blog.<br />http://blogs.vmware.com/vipowershell/2009/09/how-to-run-powercli-scripts-from-vcenter-alarms.html<br />http://vmware.com/go/powercli<br />
    240. 240. Questions?<br />Download today: http://vmware.com/go/powercli<br />http://vmware.com/go/powercli<br />
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.