Your SlideShare is downloading. ×
Managing VMware With PowerShell
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Managing VMware With PowerShell

9,438
views

Published on

Slide deck from a webinar I gave on managing VMware Virtual Infrastructure using PowerShell.

Slide deck from a webinar I gave on managing VMware Virtual Infrastructure using PowerShell.

Published in: Technology

1 Comment
6 Likes
Statistics
Notes
No Downloads
Views
Total Views
9,438
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
425
Comments
1
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Transcript

    • 1. Managing VMware Infrastructure with VI Toolkit (for Windows) Carter Shanklin VMware Infrastructure Product Manager VMware
    • 2. Overview
        • What is the VI Toolkit (for Windows)
        • The top 3 ways your life gets easier with the toolkit
        • Interactive demos
        • Resources to help you use the toolkit
        • How to get the toolkit
    • 3. What is the VI Toolkit (for Windows)?
        • The VI Toolkit is a platform for the automation of administrative tasks.
          • Remotely manage and automate VI.
        • The VI Toolkit is easy to use.
          • The commands are designed from the ground for ease of use.
          • You don’t have to be a developer.
          • Many useful tasks can be accomplished with only a couple of commands.
        • Based on PowerShell.
          • If you are a Windows admin, you either know some PowerShell or plan to learn it.
    • 4. What is PowerShell?
        • PowerShell is Microsoft’s foundation for automation.
          • Starting in 2008, all Microsoft enterprise software must enable automation through PowerShell.
          • Other vendors are adopting the same approach.
          • PowerShell lets you manage different applications in a consistent way.
    • 5. Top 3 Ways Your Life is Easier with the Toolkit
        • Save time by automating repetitive tasks. 100 is just as easy as 1.
        • Automate time consuming tasks for greater productivity. Let your scripts do the waiting.
        • Turn questions into answers with our large and growing set of online resources.
    • 6.
      • Disconnect CD-ROM and floppy drives to enable VMotion.
      Automate Repetitive Tasks PowerShell: 2 Commands Full Automation Manually: 1 Minute / VM BORING!
    • 7. Automate Lengthy Tasks For Greater Productivity Manually: 10 Minutes per VM PowerShell: 1 Command Full Automation
    • 8. You’ve Got Questions, We’ve Got Answers
        • With the help of our forums, our users have:
          • Deployed more than 200 VMs from a template.
          • Configured VMware tools to automatically upgrade on all VMs.
          • Load balance from their ESX systems to their storage arrays.
          • Changed the video memory on 2,000 virtual desktops.
          • Created custom reports.
          • And much more!
    • 9. A Tour Of Windows PowerShell
        • PowerShell comes with over 100 commands called cmdlets, and extensive documentation.
        • PowerShell has syntax conventions.
          • Verb-Noun.
          • Fosters a common look and feel across applications.
        • PowerShell supports discoverability.
          • The Get-Member cmdlets lets you see what is possible with objects.
        • PowerShell also provides access to all of .NET, COM and WMI.
    • 10. A Tour of The VI Toolkit (for Windows)
        • get-vicommand – shows all 125 commands.
        • VM Lifecycle:
          • New-VM, Start-VM, Set-VM
        • Snapshots:
          • Get-Snapshot, New-Snapshot, Set-VM
        • Templates and Customization Specs:
          • New-Template, New-OSCustomizationSpec, New-VM
        • Virtual Switches:
          • New-VirtualSwitch, New-VirtualPortGroup, Set-VirtualSwitch
        • Performance Statistics and Monitoring:
          • Get-Stat
    • 11. More than Just Virtual Infrastructure
        • The VI Toolkit (for Windows) provides 125 cmdlets for VI.
        • VMware Update Manager provides 13 cmdlets to help you automate keeping your VI up-to-date.
        • Features:
          • Download updates.
          • Manipulate baselines.
          • Remediate.
          • Even more!
    • 12. Demos
    • 13. Demos: Snapshots
        • Snapshot every powered-on VM:
        • Get-VM | Where { $_.PowerState –eq “PoweredOn” } |
        • New-Snapshot –Name “New Snapshot”
        • Delete all of those snapshots:
        • Get-VM | Get-Snapshot |
        • Where { $_.Name –eq “New Snapshot” } |
        • Remove-Snapshot
        • Find all snapshots older than 1 month:
        • Get-VM | Get-Snapshot |
        • Where { $_.Created –lt (Get-Date).addMonths(-1) }
    • 14. Demos: Networking
        • Move every VM on Network “Provisioning” to Network “Production”
        • Get-VM | Get-NetworkAdapter |
        • Where { $_.NetworkName –eq “Provisioning” } |
        • Set-NetworkAdapter –NetworkName “Production”
        • Create a virtual switch on interface vmnic1
        • Get-VMHost | New-VirtualSwitch –name “Second Switch” `
        • -nic vmnic1
        • Configure a new VMKernel on these new switches for management and VMotion.
        • Get-VMHost | New-VMHostNetworkAdapter `
        • -virtualswitch (get-virtualswitch -name “Second Switch”) `
        • -vmotionenabled:$true -portgroup blah2 -ip 10.24.0.1 `
        • – subnetmask 255.0.0.0
    • 15. Demos: Configuration Management
        • Ensure all your VMs have at least 1GB of RAM:
        • Get-VM | Where { $_.MemoryMB –lt 1024 } |
        • Set-VM –MemoryMB 1024
        • Update VMware Tools in every VM in the “Americas 1” datacenter:
        • Get-Datacenter “Americas 1” | Get-VM | Update-Tools
    • 16. Demos: Storage
        • Rescan every HBA on all hosts:
        • Get-VMHost | Get-VMHostStorage -RescanAllHba
        • Create new datastores:
          • NFS:
            • Get-VMHost |
            • New-Datastore –Nfs –NfsHost myserver –name “New Datastore”
          • FC / iSCSI:
            • Note: In the 1.0 toolkit you’ll need to retreive SCSI Luns using the Host’s StorageSystem.
            • Get-VMHost |
            • New-Datastore -Vmfs -Path $lunpath.LunPath `
            • – Name “New Datastore”
    • 17. Demos: Reporting
        • Determine statistics about VM disk usage:
          • ( get-vm | foreach { ($_ | get-harddisk | measure-object -property CapacityKB -sum).Sum } ) | measure-object -average -sum -maximum –minimum
        • Sort hosts by number of VMs hosted:
          • get-vm | select name, @{ Name="Host"; Expression={$_.host.name} } | group Host | select name, count | sort count
        • Sort hosts by CPU utilized in the past 45 minutes:
          • get-vmhost | select Name, @{Name="Average CPU Usage (%)"; Expression={ ($_ | get-stat | where { $_.MetricId -eq "cpu.usage.average" } | measure-object -property Value -average | select average).average } } | sort
    • 18. A Tour of Available Resources
        • Many resources are available to support automation and give you ideas about what can be done.
          • The PowerShell forum.
          • The FAQ.
          • The PowerShell blog.
    • 19. The PowerShell Forum
        • http://communities.vmware.com/community/developer/windows_toolkit
        • People in the forum have found support for things like:
          • Clone templates.
          • Mask CPU features to enable VMotion.
          • Make firewall configuration changes.
          • Configure HA and DRS.
          • Much, much more.
    • 20. From the Forum
        • Changing the boot order of VMs.
          • Sometimes the BIOS boot order of a VM needs to be changed.
          • The solution (from LucD in the PowerShell Forum):
      $spec = New-Object VMware.Vim.VirtualMachineConfigSpec $spec.extraConfig += New-Object VMware.Vim.OptionValue $spec.extraConfig[0].key = "bios.bootDeviceClasses" $spec.extraConfig[0].value = "allow:cd,hd" get-vm | % { (get-view $_.ID).ReconfigVM_Task($spec) }
    • 21. The PowerShell FAQ
        • http://communities.vmware.com/docs/DOC-4210 .
        • Contains 25 frequently asked questions about using PowerShell to manage VI.
        • Examples:
          • Creating VMs on particular datastores.
          • Setting resource levels on all VMs.
          • Snapshotting multiple VMs.
    • 22. From the FAQ
        • Setting resource levels on VMs.
          • VC upgrades may reset custom resource levels.
          • The solution:
      Get-VM | % { $view = Get-View $_.ID $spec = new-object VMware.Vim.VirtualMachineConfigSpec $spec.CPUAllocation = New-Object VMware.Vim.ResourceAllocationInfo $spec.CpuAllocation.Shares = New-Object VMware.Vim.SharesInfo $spec.CpuAllocation.Shares.Level = "normal" $spec.CpuAllocation.Limit = -1 $view.ReconfigVM_Task($spec) }
    • 23. The PowerShell Blog
        • http:// blogs.vmware.com/vipowershell /
        • Contains periodic ideas and resources for making VI management easier and more effective.
      Jonathan Walz and Hal Rottenberg have an excellent podcast that is devoted to Windows PowerShell, if you haven’t listened you should definitely give it a try.
    • 24. From the Blog
        • Configuring storage paths.
          • Configuring storage paths is an important step for performance optimization.
          • Configuring this manually is usually not practical.
          • The blog gives examples of how to do it.
          • Example: Enabling round-robin multipathing on all hosts.
    • 25. That’s Not All!
        • PowerShell has an extensive set of 3 rd party tools to help you do your own integrations.
      Tool Name Features Offered PowerGUI Graphical PowerShell frontend PowerGadgets Visual dashboards and reports NetCmdlets Provides network access (e.g. ssh) Quest AD Cmdlets Manage Microsoft Active Directory SpecOps Software Execute PowerShell using group policy
    • 26. 3 rd Party Tools: PowerGUI
        • PowerGUI is a graphical interface to PowerShell.
          • Easy administration using the MMC-like PowerGUI Admin Editor.
          • Easy script editing with the PowerGUI Script Editor.
          • Automatically generate PowerShell code with the PowerGUI Admin Editor.
    • 27. 3 rd Party Tools: PowerGadgets
    • 28. Are You a PowerShell Scripting Guru?
      • Enter PowerShell Scripting Contest
        • Win great prizes, show off your scripting skills
        • First Prize: Free Trip to VMworld – Las Vegas or $5,000
        • Second Prize: Mac Air w/ Fusion or $2500
        • Third Prize: Xbox Elite or $500 Cash
        • Contest Ends August 30 th , 2008
        • Winner Announced September 7, 2008
        • For more information:
        • http:// vmware.com/go/powershellcontest
    • 29. Questions? Please use the Q&A panel of your WebEx console For more Webcast information, please visit www.vmware.com/go/webcasts This Webcast has been recorded, and the slides will be ready for download within 48 hours. Once the presentation is available, an e-mail will be sent to you with directions on how to access the recorded version.
    • 30.