Managing VMware with PowerShell - VMworld 2008
-
Upload
carter-shanklin -
Category
Technology
-
view
5.964 -
download
2
description
Transcript of Managing VMware with PowerShell - VMworld 2008
Disclaimer
This session may contain product features that are currently under development.
This session/overview of the new technology represents no commitment from VMware to deliver these features in any generally available product.
Features are subject to change, and must not be included in contracts, purchase orders, or sales agreements of any kind.
Technical feasibility and market demand will affect final delivery.
Pricing and packaging for any new technologies or features discussed or presented have not been determined.
“These features are representative of feature areas under development. Feature commitments are subject to change, and must not be included in contracts, purchase orders, or sales agreements of any kind. Technical feasibility and market demand will affect final delivery.”
Managing VMware With PowerShell
Carter Shanklin – Product Manager, VMware
Andrey Anastasov – PowerShell Architect, VMware
Dmitry Sotnikov – Manager and Microsoft MVP,
Quest Software
My goal today is simple.
Convince you that
any serious VMware admin
MUST knowthe VI Toolkit for Windows.
Not convinced?
To prove this I will:
Introduce The VI Toolkit for Windows.
Show you the top 3 ways the Toolkit makes your life easier.
Show you lots of samples as well as the resources available.
Demonstrate how PowerGUI can help you get started.
Tell you how to get the toolkit so you can get started today.
Introducing The VI Toolkit (for Windows).
The VI Toolkit for Windows simplifies large-scale management.
Get a handle on VM sprawl or out-of-control snapshots through automation.
It’s a scripting tool, based on PowerShell.
It’s easy to use.
Many useful actions require 0 scripting.
It provides 125 powerful cmdlets.
Covers all aspects of Virtual Infrastructure management.
It’s completely FREE!
What is PowerShell?
PowerShell is Microsoft’s new foundation for management.
PowerShell support is required for all Microsoft Server apps.
Manages different applications in a consistent way.
Chances are, you are learning it or planning to learn it.
What does PowerShell look like?
PowerShell is centered around cmdlets. Cmdlets are provided to do all sorts of tasks. More cmdlets can be added with 3rd party snapins. Cmdlets can be strung together using pipelines.
PowerShell cmdlets use common conventions. Cmdlets follow the Verb-Noun convention.
Example: Get-Process.
This tends to lead to commands that follow our thinking. Example: Get-Process notepad | Stop-Process
PowerShell is object-oriented. No more text parsing!
Top 3 ways your life gets better 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.
Disconnect CD-ROM and floppy drives to enable VMotion.
PowerShell:
2 Commands
Full Automation
Manually:
1 Minute / VM
BORING!
Automate Repetitive Tasks.
Cloning a VM many times can take forever.
PowerShell:
As little as 1 command
Full Automation
Manually:
10 Min+ / VM
BORING!
Save time: Attack of the clones.
A customer needed to create secondary service consoles on 400+ hosts.
PowerShell:
Automated, with
forum support.
Manually:
400 Hosts
20+ Hours
The story you are about to witness is real.
A tour of the toolkit.
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
125 cmdlets in total.
VI Toolkit types tag cloud.
The focus is on VM and ESX Management,
But you can manage all aspects of VI with the toolkit.
Incredibly Powerful Examples:
Snapshot every VM you have:
Get-VM | New-Snapshot –Name “New Snapshot”
Find all snapshots older than 1 month:
Get-VM | Get-Snapshot |
Where { $_.Created –lt (Get-Date).addMonths(-1) }
Change every VM on Network A to Network B:
Get-VM | Get-NetworkAdapter |
where { $_.NetworkName –eq “Network A” } |
Set-NetworkAdapter –NetworkName B
More Incredibly Powerful Examples:
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
Restart an unresponsive VirtualCenter agent:
Get-VMHost badhost | Get-VMHostService |
Where { $_.key –eq “vmware-vpxa” } |
Restart-VMHostService
As if that weren’t enough!
Rescan every HBA on all hosts:
Get-VMHost | Get-VMHostStorage -RescanAllHba
Ensure your VMs will all start after ESX is restarted:
Get-VMHostStartPolicy |Set-VMHostStartPolicy -enabled:$true
Get-VM | Get-VMStartPolicy |
Set-VMStartPolicy -StartAction poweron
Move every VM on host A to host B:
Get-VMHost A | Get-VM |
Move-VM –destination (Get-VMHost B)
A Tour of Available Resources.
The VI Toolkit (for Windows) Community.
A very active community with lots of very smart people.
Over 300 examples to guide you.
The VI Toolkit (for Windows) FAQ.
40 frequently asked questions with answers.
Plenty of sample code.
The VI Toolkit (for Windows) Blog.
Lots of examples and ideas.
Updated regularly.
All available from http://vmware.com/go/powershell
Announcing The VI Toolkit Community Extensions.
The VI Toolkit Community Extensions:
A module that can be loaded into your scripts.
Open source.
A way for us to make all of the good ideas in our forums more accessible.
Uses scripts so everyone can contribute.
A “first line” for new functionality.
Download it at http://codeplex.com/vitoolkitextensions
What can you learn through these resources?
Among other things you can learn to:
Change the VMware tools upgrade policy.
List all storage world wide names.
Register unregistered VMs.
Create reports.
Customize VM hardware.
Remotely power ESX hosts on and off.
Configure NTP.
Execute scripts in response to VirtualCenter alarms.
Much, much more!
What to expect in the future.
Even better VI management.
We’ll continue to make the VI admin’s life easy.
Support for more VMware products.
Products that complement and extend VMware VI.
Improved VMware PowerShell Community Extensions.
This will hold a large library of cmdlets of all different types.
Share your own ideas and help us build this community.
Don’t be a script-o-phobe!
PowerGUI Script Editor makes writing scripts easy.
Syntax highlighting.
Name completion.
PowerGUI Admin Console generates code for you!
No more “I’ve been meaning to get around to it”.
DEMO
Convinced? Get the toolkit today!
http://vmware.com/go/powershell
Q&A
Breakout Session #AD2764
Carter Shanklin Additional InformationProduct Manager, VMware Inc. http://vmware.com/go/powershell9/16/2008