1 / 25

VI Toolkit/ PowerShell for VMware

VI Toolkit/ PowerShell for VMware. Randy Snyder. Microsoft PowerShell. Command line shell and scripting language Download Windows PowerShell 1.0 and install http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx Open a command prompt .

jerome
Download Presentation

VI Toolkit/ PowerShell for VMware

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. VI Toolkit/PowerShell for VMware Randy Snyder

  2. Microsoft PowerShell • Command line shell and scripting language • Download Windows PowerShell 1.0 and install • http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx • Open a command prompt

  3. Microsoft PowerShell

  4. Next steps • Get-Help • Can use tabbing to finish commands • Commands like ls, pwd, dir etc… work • Files are saved as a .PS1 • Not only for Windows, (VMware, Quest, F5, Full Armor etc..)

  5. Microsoft PowerShell

  6. VMware VI Toolkit • New version release January 28, 2009 • Quick Reference Guide • VMware forum • VMware Europe Lab • http://www.vmwarescripting.com/ • http://www.peetersonline.nl/ • http://www.ntpro.nl/blog/categories/10-VMware-PowerShell

  7. Get-Help “command” -detailed

  8. Getting Started

  9. What can I do?

  10. PowerGUI

  11. Connecting

  12. Viewing information

  13. Viewing the Source

  14. The Problem • Need to get data from a number of servers • Data is not in a script that I could find • Field is not somewhere I would normally look

  15. Finding Data • Get-VM vm_name | get-view | format-custom >c:\out.txt •   Summary = •     class VirtualMachineSummary •     { • Vm = •         class ManagedObjectReference •         { •           Type = VirtualMachine •           Value = vm-149535 •         }

  16. ($vm | get-view) | get-member

  17. ($vm | get-view).summary | get-member

  18. ($vm | get-view).summary.vm | get-member

  19. ($vm | get-view).summary.vm

  20. Writing the Script

  21. Step 1 Connect • #Set variables • $vcserver = “insert VC Server Name“ • #Connect to VC • $VC = Connect-VIServer $VCServer

  22. Loop the command • #Tell it to loop through the names • foreach ($object in $vmname){ • #Provide the command to increase the RAM • $vm = Get-VM $object • ($vm | Get-View).summary.vm.value + " " + $vm.name • }

  23. Results

  24. Vmotion IP’s

  25. Additional Resources • VMware Administrator’s guide for VI Toolkit 1.5 • Undocumented Features • Real Time Publishers • VI-Toolkit.com • PowerScripting Podcast • Power of Shell

More Related