Tag Archives: VMware

Altering VMKernel NIC MTU with PowerCLI

I was asked if it was possible to set the VMKernel Nic MTU in PowerCLI, after looking on the internet there were several people showing how to do this but some of them were very complicated, maybe this has got easier over time as with each release of PowerCLI one of the things the PowerCLI Dev team looks at is how to make things easier for the end user?

Anyway, I thought I would show my one line solutions for listing and setting the MTU for the VMKernel Nics for multiple hosts,

Listing the MTU for each VMKernel Nic

image

Setting the MTU to 9000 for each VMKernel Nic

image

The Code

Listing the MTU for each VMKernel Nic

Get-VMHost | Get-VMHostNetworkAdapter | Where { $_.GetType().Name -eq "HostVMKernelVirtualNicImpl" } | Select VMHost, Name, MTU

Or an even easier way of doing this (but you cant expand it to change the MTU easily is:

Get-VMHost | Get-VMHostNetwork | Select -ExpandProperty VirtualNic | Select VMHost, Name, MTU

Setting the MTU to 9000 for each VMKernel Nic

Get-VMHost | Get-VMHostNetworkAdapter | Where { $_.GetType().Name -eq "HostVMKernelVirtualNicImpl" } | Foreach { $_ | Set-VMHostNetworkAdapter -Mtu 9000 -Confirm:$false }

PowerShell Summit–My recorded sessions

imageRecently I was lucky enough to attend the PowerShell Summit at Microsoft HQ in Redmond, this was an awesome event which was focused on PowerShell, it included not only people who are using PowerShell but also some of the people who wrote and designed it.

There were a bunch of great sessions, all of which can be reviewed and slides downloaded here.  I was also asked to present two sessions.  I have included the recordings for these sessions below.  Thanks to Aaron Hoover for recording these.

A couple of comments which I took away from the PowerShell Summit which really surprised me where:

  • A number of people told me they had started out with PowerCLI and then worked back into PowerShell (much like myself).
  • I was surprised that 2/3 of the room when I presented were using VMware, after all this was a Microsoft Conference!

Continue reading

My VMworld 2013 Sessions

image_thumb1This year there are some awesome sessions at VMworld, I think people are starting to realize the benefits of automation and how these can be achieved with VMware products.  I am looking forward to attending and hopefully presenting some great sessions at VMworld 2013.

Today is the last day of voting so if you are still looking through the session list and wondered what I had put forward this year then please find a list below, if these looks interesting to you then please feel free to vote for it here!

Continue reading

Gathering simple pool information from VMware View

Recently I was asked if we could list some basic information from VMware View using the cmdlets which come installed on the View Administrator server, the request was specifically a list of VMs and the pool they were in, this was easily achieved with the Get-DesktopVM cmdlet as below:

Get-DesktopVM | Select Name, Pool_id | Sort Pool_id

Continue reading

Automating storage with NetApp Workflow Automation

Do you wish you could automate your NetApp Storage infrastructure?

Do you wish your storage admins could give an easy to use custom interface to other areas of the business allowing them to provision or use storage however they need whilst still applying best practice and corporate policies to the configuration?

Continue reading

Relating vCloud Director to vCenter in PowerCLI

I was listening to episode 216 of the PowerScripting Podcast recently, Hal and Jonathan were talking to vCloud Director (vCD) expert Jake Robinson and “meeting expert” (listen it will make sense) Damian Karlson, it was a great show, very funny and I highly recommend you listen here: http://powerscripting.wordpress.com/2013/02/26/episode-216-jake-robinson-and-damian-karlson-talk-powercli/

Anyway, they were talking about relating vCD objects to vCenter objects, on the show they said it couldn’t be done without matching an ID and writing a custom function, this used to be the case but now I wanted to show a few cool things from PowerCLI which allows us to use a parameter called –RelatedObject to take away all the hard work from the matching IDs, Datastore IDs, Network IDs etc. Continue reading

PowerCLI 5.1 R2 Released

PowerCLIVersionVMware have just released PowerCLI 5.1 R2 and with it are the long awaiting cmdlets to work with VDS!

I worked with these a little and although VDS are not 100% fully covered in this release the cmdlets are certainly useful for most of the things I needed to do and they opened up VDS with the .extensiondata property for the rest of the things I wanted to play with.

Two of the cooler cmdlets where the Export-VDSwitch and New-VDSwitch –backupfile which can be used with 5.1 and the new VDS features to backup the VDS into a simple zip file and re-import it when needed.

I have included the new cmdlets and some examples from the help file below.

As well as the VDS cmdlets I am also happy that VMware now supports PowerShell v3 and vCloud Director 5.1 in both their admin version of PowerCLI and their Tenant version, this opens up vCD to automate some of the cooler new features of VCD and also enable the enhancements made by Microsoft in PowerShell v3.

Download it now. Continue reading

Learning PowerCLI–What does it take ?

One of the most asked questions to me at VMworld this year was “what does it take to learn PowerCLI”, lots of people have seen the fantastic things you can do with PowerCLI, where it is drawing your infrastructure out into Visio or checking your VMware environment for potential issues.

I always tell people that if I can learn PowerCLI then anyone can, one of the great strengths of PowerCLI and PowerShell is that it was written for System Administrators, for the people who need to get the job done, get it done fast and move on to the next thing.

With that in mind it is not only easy to understand what something like New-VM does but also very easy to learn as all the information you need is often very easy to read, easy to work out what’s going on and also right there in the PowerCLI console.

One of my favorite learning resources is the help built in to PowerCLI.

From within the console you can easily access not only the full help for each cmdlet but also examples of how you might use this cmdlet, these are great because they not only show examples of how to use the cmdlets but also cover some of the top use cases for that cmdlet.  A great deal of thought goes into the help files and these examples to make them relevant and useful.

To access the help and the examples for a cmdlet there are multiple ways, firstly you can see the help as part of the online documentation for PowerCLI here, secondly you can run the Get-Help cmdlet and also use the –examples parameter to gain more information, see below for an example:

PowerCLI Example

I still don’t understand what it takes to learn PowerCLI ?!

If you still don’t get it and need a full on action video with cool music and stunts to get this simple feature then check out the below:

What does it take to learn PowerCLI ? from Alan Renouf on Vimeo.

Updated VMware Knowledge Portal iPad App

Following my recent post showing the VMware Knowledge Portal iPad App, I just wanted to add a quick note to say firstly, If you do not have this then download it straight away.  The information on here is very useful and includes videos as well as documentation for the vCloud Suite of products.

Secondly, the app was updated at the start of this week to include yet more information, as you can see from the below screenshot. So head over to the App store and download this FREE app now and start learning about the new 5.1 features.

Click here to download the app.

vMKP

Using PowerShell v3.0 CIM cmdlets with VMware ESXi Hosts

I noticed that in PowerShell V3.0 some CIM cmdlets were introduced which allowed PowerShell to be able to interact with CIM providers and gather information, when importing the CIM Cmdlets into my session you can see we have a number of new cmdlets to work with:

image

Even though I know PowerCLI 5.1 R1 (Current release on 29th Oct 2012) does not support PowerShell v3.0 I thought I would check out what I could do with these and what information I could receive using the CIM cmdlets.

As a reminder, Carter Shanklin did some work in this area a long time ago and he ended up writing a function to be able to pull CIM information from ESX hosts, this can be found here, he also includes some links to documentation on the CIM providers the VMware hosts can provide: http://blogs.vmware.com/vipowershell/2009/03/monitoring-esx-hardware-with-powershell.html

As you will see from the video below the new cmdlets cut out most of the hard work Carter had to do and allow us to pull CIM information from the ESXi hosts with ease.

Using PowerShell v3.0 CIM Cmdlets with VMware ESXi Hosts from Alan Renouf on Vimeo.

For your reference, here is the code I used during this demo:

import-module CimCmdlets
$ipaddress = "10.20.177.15"
$HostUsername = "root"
$CIOpt = New-CimSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -Encoding Utf8 -UseSsl
$Session = New-CimSession -Authentication Basic -Credential $HostUsername -ComputerName $Ipaddress -port 443 -SessionOption $CIOpt
Get-CimInstance -CimSession $Session -ClassName CIM_Fan