TA6944 PowerCLI is for Administrators!

3,574 views

Published on

The presentation given at VMworld San Francisco and Copenhagen by Alan Renouf and Luc Dekens

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,574
On SlideShare
0
From Embeds
0
Number of Embeds
536
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • I propose we introduce each other. Then they can’t accuse us of bragging ;-)
  • This is where we start the actual scenario.One of us says he was tasked by his mgmt to provision X-number of machines for a new project.The other remarks, that meant overtime, clicking away in the vSphere client.Answer is that it was a piece of cake with the help of PowerCLI.This is where we could use some audience participation!Mgmt remarked if that PowerCLI would be easy.You tell them that it is so simple that it’s nearly as if your reading an English text.Some examples on screen and ask the audience if they know what the line is supposed to do ?Even mgmt could read it.Do we dare ask if there are managers in the audience (?)Then we show a video with the baby-maker:Specs for the new machines in a spreadsheetDeploy the new machinesShow the option of scheduling the deployment by a max number of parallel tasks.
  • This is where we start the actual scenario.One of us says he was tasked by his mgmt to provision X-number of machines for a new project.The other remarks, that meant overtime, clicking away in the vSphere client.Answer is that it was a piece of cake with the help of PowerCLI.This is where we could use some audience participation!Mgmt remarked if that PowerCLI would be easy.You tell them that it is so simple that it’s nearly as if your reading an English text.Some examples on screen and ask the audience if they know what the line is supposed to do ?Even mgmt could read it.Do we dare ask if there are managers in the audience (?)Then we show a video with the baby-maker:Specs for the new machines in a spreadsheetDeploy the new machinesShow the option of scheduling the deployment by a max number of parallel tasks.
  • Changes in the project, new HW is introduced.Part of the guests has to be moved to new clusters/new datastores.It’s easy to ‘motion’ guests with PowerCLIVideo:Complex selection criteriaPart of the guests are already running, we show vMotionPart of the guests have to go to other storage, we show svMotion
  • Changes in the project, new HW is introduced.Part of the guests has to be moved to new clusters/new datastores.It’s easy to ‘motion’ guests with PowerCLIVideo:Complex selection criteriaPart of the guests are already running, we show vMotionPart of the guests have to go to other storage, we show svMotion
  • One remarks, this is all very well, but there is still quite a console work involved (starting scripts, opening the resulting logs/reports).The other one answers, that why I used a Gui to do all this.Video:How to add the scripts to the GuiHow to run themHow to see the resultsThe Europe branch needs to do something similar.Avoid sending all the scripts and instructions, create a PowerPack.Video:How to create a PowerPackHow you can update a PowerPack
  • Project requires PVLANs.Not yet available in PowerCLI, but that’s where we show how to use the SDK APIsVideo:- Where is the SDK information and how to use itCreate functions for working with dvSwitches and PVLANs (can you use a module in a PowerPack ?)Perhaps we can also include some New-VIProperty stuff in here ?
  • Project requires PVLANs.Not yet available in PowerCLI, but that’s where we show how to use the SDK APIsVideo:- Where is the SDK information and how to use itHow to go from PowerCLI objects to SDK objectsCreate functions for working with dvSwitches and PVLANs (can you use a module in a PowerPack ?)Perhaps we can also include some New-VIProperty stuff in here ?
  • Mgmt wants to know where the project’s at. That means reports need to be produced.Video:Show how to find what is available (Get-Member)Different ways the reports can be scheduledPerhaps show the strength of PowerShell by using my Export-Xls function in here. Show how simple it is to interface with other products.
  • Mgmt wants to know if there is a need for new HW. This means capacity reports.Solution is the Get-Stat cmdletVideo:We show how CPU usage increased over a period of time on a cluster. From there we can make predictions.Similar thing for storage (add a joke that you want to sell storage since you’re a vExpert)What network traffic is the project generating ?
  • The audit team wants to know how secured/hardened the environment is.We show how we automated the hardening of the ESX(i) host through scripts.The auditors want to know if we can show any changes to the environment.We can produce a report that shows the permissions (principals and roles).We show a report that lists for example all portgroup changes to a specific set of guests over a specific period.
  • The project nears completion, the operators need to monitor the environment.PowerShell is present in SCOM 2007 R2. It’s simple to integrate (agentless, based on SNMP traps)Video:We show how to configure SNMP on the ESX(i) hostsWe show how to monitor the hosts in SCOMWe also show how vCenter can be integrated.We show a sample how generate a SCOM mgmt pack with the help of PowerWF Studio
  • TA6944 PowerCLI is for Administrators!

    1. 1. VMworld 2010 - San Francisco - TA6944PowerCLI is for Administrators!<br />Alan Renouf & Luc Dekens<br />
    2. 2. Who Are we ?<br />Alan<br /><ul><li>vExpert 2009 & 2010
    3. 3. EMC vSpecialist
    4. 4. Blog http://www.virtu-al.net/
    5. 5. Podcast http://get-scripting.blogspot.com/</li></ul>Luc<br /><ul><li>vExpert 2009 & 2010
    6. 6. Eurocontrol Maastricht
    7. 7. Blog http://lucd.info/
    8. 8. LucD on the VMTN PowerCLI community</li></li></ul><li>Agenda<br /><ul><li>Introduction
    9. 9. Request 1: Deploy guests
    10. 10. Request 2: Move the guests around
    11. 11. Request 3: Simplify through GUI
    12. 12. Request 4: Network update
    13. 13. Request 5: Report on what is there
    14. 14. Request 6: Capacity planning
    15. 15. Request 7: Visit of the auditors
    16. 16. Request 8: Single-pane-of-glass</li></li></ul><li>Introduction<br /><ul><li>PowerCLI is for all your vSphere administration tasks
    17. 17. PowerCLI is extended with each release
    18. 18. PowerCLI is build on the vSphere APIs
    19. 19. Easy to call other public APIs
    20. 20. PowerShell is the ‘lingua franca’ for Windows datacenters
    21. 21. Active Community: PowerShell and PowerCLI</li></li></ul><li>Agenda<br /><ul><li>Introduction
    22. 22. Request 1: Deploy guests
    23. 23. Request 2: Move the guests around
    24. 24. Request 3: Simplify through GUI
    25. 25. Request 4: Network update
    26. 26. Request 5: Report on what is there
    27. 27. Request 6: Capacity planning
    28. 28. Request 7: Visit of the auditors
    29. 29. Request 8: Single-pane-of-glass</li></li></ul><li>Deploy guests 1<br /><ul><li>First step in life-cycle management
    30. 30. New or from a template
    31. 31. Number of clicks in the vSPhere client
    32. 32. PowerCLI helps to automate this process</li></ul>DEMO<br />
    33. 33. Deploy guests 2<br />Import-Csv C:TempServers.csv | Foreach {<br />New-VM –Name $_.Name `<br />-VMHost (Get-VMHost virtuesx1*) `<br />-Datastore (Get-Datastore ix2*) `<br />-DiskMB $_.OSDisk `<br />-MemoryMB $_.Mem `<br />-NumCpu $_.NumCPU `<br />-Location (Get-Folder $_.Project) `<br />-RunAsync<br />}<br />
    34. 34. Agenda<br /><ul><li>Introduction
    35. 35. Request 1: Deploy guests
    36. 36. Request 2: Move the guests around
    37. 37. Request 3: Simplify through GUI
    38. 38. Request 4: Network update
    39. 39. Request 5: Report on what is there
    40. 40. Request 6: Capacity planning
    41. 41. Request 7: Visit of the auditors
    42. 42. Request 8: Single-pane-of-glass</li></li></ul><li>Move guests 1<br /><ul><li>Selecting guests
    43. 43. Complicated selection criteria
    44. 44. vMotion
    45. 45. svMotion</li></li></ul><li>Move guests 2<br /># vMotion<br />Move-VM –Name ACME-DC01 `<br />-Destination (Get-Cluster Cluster01)<br /># svMotion<br />Move-VM –Name ACME-DC01 `<br /> -Datastore (Get-Datastore DS1)<br />
    46. 46. Agenda<br /><ul><li>Introduction
    47. 47. Request 1: Deploy guests
    48. 48. Request 2: Move the guests around
    49. 49. Request 3: Simplify through GUI
    50. 50. Request 4: Network update
    51. 51. Request 5: Report on what is there
    52. 52. Request 6: Capacity planning
    53. 53. Request 7: Visit of the auditors
    54. 54. Request 8: Single-pane-of-glass</li></li></ul><li>GUI<br /><ul><li>Still a lot of typing involved
    55. 55. vEcoShell/PowerGUI
    56. 56. PowerPacks: collection of actions</li></li></ul><li>Agenda<br /><ul><li>Introduction
    57. 57. Request 1: Deploy guests
    58. 58. Request 2: Move the guests around
    59. 59. Request 3: Simplify through GUI
    60. 60. Request 4: Network update
    61. 61. Request 5: Report on what is there
    62. 62. Request 6: Capacity planning
    63. 63. Request 7: Visit of the auditors
    64. 64. Request 8: Single-pane-of-glass</li></li></ul><li>Network update 1<br /><ul><li>Change portgroups and VLAN
    65. 65. Distributed switches: not yet available
    66. 66. Use vSphere APIs to extend your options
    67. 67. vSphere API Referenceis indispensable!
    68. 68. And Onyx can guide you!</li></li></ul><li>Network update 2<br />
    69. 69. Network update 3<br />
    70. 70. Network update 4<br />
    71. 71. Network update 5<br />function New-dvSwPVLAN{<br />param($dvSw, $primaryNr, [int[]] $secondaryNr, [string[]] $secondaryType)<br /> $spec = New-Object VMware.Vim.VMwareDVSConfigSpec<br /># Primary<br /> $pvlan = New-Object VMware.Vim.VMwareDVSPvlanConfigSpec<br /> $pvlan.operation = "add"<br /> $pvlan.pvlanEntry = New-Object VMware.Vim.VMwareDVSPvlanMapEntry<br /> $pvlan.pvlanEntry.primaryVlanId = $primaryNr<br />…<br /> $taskMoRef = $dvSw.ReconfigureDvs_Task($spec)<br />… <br />}<br />Full script on http://lucd.info<br />
    72. 72. Agenda<br /><ul><li>Introduction
    73. 73. Request 1: Deploy guests
    74. 74. Request 2: Move the guests around
    75. 75. Request 3: Simplify through GUI
    76. 76. Request 4: Network update
    77. 77. Request 5: Report on what is there
    78. 78. Request 6: Capacity planning
    79. 79. Request 7: Visit of the auditors
    80. 80. Request 8: Single-pane-of-glass</li></li></ul><li>reporting<br /><ul><li>First encounter with PowerCLI for most
    81. 81. The information is out there
    82. 82. Know what is available
    83. 83. PowerCLI 4.1 introduced new features:
    84. 84. the ExtensionDataproperty
    85. 85. The New-VIPropertycmdlet
    86. 86. Use the PowerShell to create different types of files
    87. 87. Builtin: CSV, Html, text…
    88. 88. COM interface: Office documents (Visio, Word, Excel)</li></li></ul><li>Agenda<br /><ul><li>Introduction
    89. 89. Request 1: Deploy guests
    90. 90. Request 2: Move the guests around
    91. 91. Request 3: Simplify through GUI
    92. 92. Request 4: Network update
    93. 93. Request 5: Report on what is there
    94. 94. Request 6: Capacity planning
    95. 95. Request 7: Visit of the auditors
    96. 96. Request 8: Single-pane-of-glass</li></li></ul><li>Capacity planning 1<br /><ul><li>vSPhere has historical statistical data
    97. 97. Get-Stat is your friend!
    98. 98. Know what is available
    99. 99. How to get the data in the format you want
    100. 100. Create Office documents from PS through COM objects</li></li></ul><li>Statistical intervals<br />Full article on http://lucd.info<br />
    101. 101. Find the metrics 1<br />
    102. 102. Find the metrics 2<br />
    103. 103. Capacity planning 2<br /><ul><li>Think before you write the script
    104. 104. Use PowerShell to your advantage
    105. 105. Group-Object is your friend!
    106. 106. Use COM to produce Office documents</li></li></ul><li>Capacity planning 3<br />
    107. 107. Capacity planning 4<br />Export-Xls -Path $fileName -WorksheetName "Memory" -ChartType "xlLine"<br />
    108. 108. Agenda<br /><ul><li>Introduction
    109. 109. Request 1: Deploy guests
    110. 110. Request 2: Move the guests around
    111. 111. Request 3: Simplify through GUI
    112. 112. Request 4: Network update
    113. 113. Request 5: Report on what is there
    114. 114. Request 6: Capacity planning
    115. 115. Request 7: Visit of the auditors
    116. 116. Request 8: Single-pane-of-glass</li></li></ul><li>Audit 1<br /><ul><li>vSPhere keeps track of tasks and events
    117. 117. Know what is available
    118. 118. How to get at the information?</li></li></ul><li>Audit 2<br />Script to CSV<br />vSphere API Reference<br />
    119. 119. Audit 3<br />
    120. 120. Audit 4<br />
    121. 121. Agenda<br /><ul><li>Introduction
    122. 122. Request 1: Deploy guests
    123. 123. Request 2: Move the guests around
    124. 124. Request 3: Simplify through GUI
    125. 125. Request 4: Network update
    126. 126. Request 5: Report on what is there
    127. 127. Request 6: Capacity planning
    128. 128. Request 7: Visit of the auditors
    129. 129. Request 8: Single-pane-of-glass</li></li></ul><li>Single pane of glass<br /><ul><li>Integrate with your monitoring tool
    130. 130. PowerShell is in SCOM 2007 R2
    131. 131. Roll your own scripts
    132. 132. Use PowerWF Studio to create a Management Pack</li></li></ul><li>Conclusion<br /><ul><li>PowerCLI covers all your vSphere administration tasks
    133. 133. Easy access to the Web Services
    134. 134. PowerShell is omnipresent
    135. 135. Easily integrates with your Windows environment
    136. 136. Access .Net, Office, Back-Office… features/components</li></li></ul><li>Book<br /><ul><li>We are writing a PowerCLI book
    137. 137. A ‘practical’ book
    138. 138. 4 vExperts and a MVP !
    139. 139. Available: 2011 Q1</li></li></ul><li>Links & references<br /><ul><li>PowerCLI
    140. 140. Update Manager
    141. 141. Onyx
    142. 142. PowerCLI Community
    143. 143. PowerCLI Blog
    144. 144. vEcoShell
    145. 145. PowerWFStudio
    146. 146. Podcasts: Get-Scripting & PowerScripting</li></li></ul><li>PowerCLI Poster<br /><ul><li> They are big !
    147. 147. Easy to fold
    148. 148. Plenty for everyone !</li></li></ul><li>SUPPORT AND TRAINING<br />VMware vSphere Automation <br />2 day instructor led course, 40% Lecture, 60% hands on lab<br />Available worldwide, use PSO credits<br />http://vmware.com/go/vsphereautomation<br />VMware Scripting and SDK Support<br />Dedicated help when developing scripts / applications<br />Expert API engineers happy to help <br />http://vmware.com/go/sdksupport<br />
    149. 149. PowerCLI is for admins!<br />

    ×