powercli & onyx

Post on 19-Jun-2015

1.390 Views

Category:

Technology

11 Downloads

Preview:

Click to see full reader

DESCRIPTION

A slide deck presented on the 8th October to a select audiance in London, visit Virtu-al.net for more information

TRANSCRIPT

© 2009 VMware Inc. All rights reserved

PowerCLI & Onyx

Vladimir Goranov, Manager R&D, Resource & Policy Management

Yavor Boychev, Manager R&D, VIM Platform and Solutions QA

2

Agenda

� VMware vSphere ТМ PowerCLI

� Tips and tricks

� VMware Project Onyx

� Q&A

3

Disclaimer

�This session may contain product features that are currently under development.

�This session/overview of the new technology represent s no commitment from VMware to deliver these features in any generally available product.

�Features are subject to change, and must not be inclu ded in contracts, purchase orders, or sales agreements of any k ind.

�Technical feasibility and market demand will affect final delivery.

�Pricing and packaging for any new technologies or feat ures discussed or presented have not been determined.

“THESE FEATURES ARE REPRESENTATIVE OF FEATURE AREAS UNDER DEVELOPMENT. FEATURE COMMITMENTS ARE SUBJECT TO CHA NGE, AND MUST NOT BE INCLUDED IN CONTRACTS, PURCHASE ORDERS, OR SALES

AGREEMENTS OF ANY KIND. TECHNICAL FEASIBILITY AND M ARKET DEMAND WILL AFFECT FINAL.”

4

VMware vSphere ТМ PowerCLIWindows PowerShell interface for managing vSphereTM

5

VMware vSphere ТМ PowerCLI

PowerCLI will save you a ton of time.

PowerCLI is the easiest way to automate.

PowerCLI will help you identify problemsbefore they become crises.

PowerCLI can automate anything you careabout in your virtual environment.

PowerCLI lets you make large scale changesin a consistent and auditable way.

6

VMware vSphere ТМ PowerCLI

� Official communityhttp://vmware.com/go/powershell

• Registered users - 1 382

• Discussions - 2 481

• Documents - 48

� Official bloghttp://blogs.vmware.com/vipowershell/

• Blog posts - 125

• Comments - 177

� Extensions projecthttp://vitoolkitextensions.codeplex.com/

• More than 100 functions

• Page views - 118 577

• Visits - 15 261

• Downloads - 3 638

7

VMware vSphere ТМ PowerCLI

� Blog ecosystem

• http://blogs.vmware.com/vipowershell

• http://www.van-lieshout.com/powercli

• http://get-admin.com/blog

• http://ict-freak.nl

• http://www.lucd.info

• http://www.ntpro.nl/blog

• http://poshoholic.com

• http://professionalvmware.com

8

VMware vSphere ТМ PowerCLI

� Software ecosystem

• PowerGUI - http://powergui.org

• PowerShell Plus - http://www.idera.com

• PowerWF for VMware - http://powerwf.com

• VI PowerScripter - http://www.icomasoft.com

• vEcoShell -http://vcommunity.vizioncore.com/administration/vec oshell/default.aspx

9

VMware vSphere ТМ PowerCLI

� Books

…and more coming

10

Resources

Developer Support

• Dedicated support for your organization when building solutions using vSphere APIs, PowerCLI, vSphere Web Services SDKs and many more VMware SDKs

• http://vmware.com/go/sdksupport

PowerCLI Training

• 2 day instructor led training, 40% lecture, 60% lab

• http://vmware.com/go/vsphereautomation

VMware Developer Community

• SDK Downloads, Documentation, Sample Code, Forums, Blogs

• http://developer.vmware.com

Technology Alliance Partner (TAP) Program

• Updated partner benefits

• http://www.vmware.com/partners/alliances/programs/

11

VMware vSphere ТМ PowerCLI

� Large and Small customers around the world in differen t industry areas

• Education

• Energy

• Finance

• Government

• Health Care

• Manufacturing

• Retail

• Transportation

� Roadmap and solutions exposure

12

Tips and TricksThe art of being efficient

13

It’s a fact: PowerCLI does cover the entire vSphere API !

� PowerCLI introduces over 225 cmdlets

and 170 automation objects

•Designed to be fast and easy to use

•vSphere API has close to 500 operations and over 2000 objects

� .Net toolkit expose the entire vSphereAPI

•Client side .Net library distributed with PowerCLI

•Could be used in .Net applications and Powershell scripts

•Powershell interface – Get-View cmdlet

� Get started with .Net toolkit

14

Retrieving views in PowerCLI

� Get-View – the entry point to the .Net toolkit

� View – static copy of a server side managed object

15

Retrieving views in PowerCLI – performance impact

# Retrieve views for several vms filtered by PowerState

Get-VM | Where {$_.PowerState -eq "PoweredOn"} | Get-View

VS

Get-View -ViewType "VirtualMachine" `

-Filter @{"Runtime.PowerState" = "PoweredOn"} √

16

# Interested only in few of the view properties?

Get-View -ViewType “VirtualMachine”

VS

Get-View -ViewType “VirtualMachine” `

-Property “Name” , “Runtime.PowerState” √

Increase performance when retrieving view objects

WOW !

Specifying property parameter is ~2000% faster on 100 vms

17

� MoRef - Managed Object Reference

� Most API method invocations require MoRef as a parameter

MoRefs made easier in PowerCLI 4.1 !

# Retrieve MoRef from the view object

$vm = Get-VM “MyVm”

$vmView = $vm | Get-View

$_this = Get-View -Id ‘ScheduledTaskManager’

$_this.CreateScheduledTask($vmView.MoRef, $spec)

# Using object’s Id where MoRef is needed

$vm = Get-VM “MyVm”

$_this = Get-View -Id ‘ScheduledTaskManager’

$_this.CreateScheduledTask($vm.Id, $spec)

18

Increase your scripts performance by reducing OBN c alls

� Object By Name selection (OBN)

Start-VM "PsDemo"

Start-VM -VM (Get-VM -Name "PsDemo")

19

� Object By Name selection (OBN)

Start-VM "PsDemo"

...

Update-Tools "PsDemo"

...

New-Snapshot -Name "UpdatedTools" -VM "PsDemo"

...

Stop-VM "PsDemo"

Increase your scripts performance by reducing OBN c alls

20

� Object By Name selection (OBN)

Start-VM -VM (Get-VM -Name "PsDemo")

...

Update-Tools -VM (Get-VM -Name "PsDemo")

...

New-Snapshot -Name "UpdatedTools" -VM `

(Get-VM -Name "PsDemo")

...

Stop-VM (Get-VM -Name "PsDemo")

Increase your scripts performance by reducing OBN c alls

21

� Object By Name selection (OBN)

$psDemo = Get-VM -Name "PsDemo"

Start-VM $psDemo

...

Update-Tools -VM $psDemo

...

New-Snapshot -Name "UpdatedTools" -VM $psDemo

...

Stop-VM $psDemo

Increase your scripts performance by reducing OBN c alls

22

VMware Project OnyxWhat is happening behind the covers

23

What is Project Onyx?

� Serves as a proxy between vSphere Client and vCenter Server

� Monitors the network communication and translates it into a reusable Powershell code

vSphere Client vCenter ServerOnyx

24

Onyx history

� VMWorld 2009 San Francisco - Onyx announced as a prototype

� November 2009 – Onyx available for download as Technology preview on blogs.vmware.com

� January 2010 – Official launch of Onyx community forum: vmware.com/go/onyx

� Vmworld 2010 San Francisco Onyx 2.0 released

• C# 2.0 and raw SOAP messaging code generation

• Connection usability enhancements

• Configurable obfuscation of methods with sensitive data

25

Demo scenario

a

Create Scheduled Task

26

Demo scenario

a

Modify code

PowerCLI

27

Demo scenario

� Execute script

a

Scheduled Tasks created

28

Q&AIts your time

top related