Author Archives: Alan

About Alan

Alan Renouf has a role of Automation Frameworks Product Manager at VMware responsible for providing the architects and operators of the cloud infrastructure with the toolkits/frameworks and command-line interfaces they require to build a fully automated software-defined datacenter. Alan is a frequent blogger at http://blogs.vmware.com/vipowershell and has a personal blog at https://virtu-al.net. You can follow Alan on twitter as @alanrenouf.

vCheck Updated to 6.15

A quick update this time, mainly bug fixes but please see the change log below for more details.

[wpdm_file id=17]

As always you can find more information about vCheck and how to use this by visiting this page.

Change log

There are now over 70 plugins, some fantastic stuff, below is a list of items which have changed or been fixed since 6.0:

# v 6.15 – Added Category to all plugins and features to vCheckUtils script for Categorys.
# v 6.14 – Fixed a bug where a plugin was resetting the $VM variable so later plugins were not working 🙁
# v 6.13 – Fixed issue with plugins 63 and 65 not using the days
# v 6.12 – Changed Version to PluginVersion in each Plugin as the word Version is very hard to isolate!
# v 6.11 – Fixed a copy and paste mistake and plugin issues.

Reminder

If a plugin is not needed in your environment remove it from the plugins folder as it will speed up the execution of your script.

vCheck updated to 6.10

Thanks to all the people who sent me a plugin for vCheck 6.0, these have now been published as part of vCheck 6.10 and zipped into a single download file which can be downloaded from below.  I also love the enhancements which have been sent to me for the core vCheck script, these include a script which times and reports on how long the plugins take – great for troubleshooting !

[wpdm_file id=17]

As always you can find more information about vCheck and how to use this by visiting this page.

Change log

There are now over 70 plugins, some fantastic stuff, below is a list of items which have changed or been fixed since 6.0:

# v 6.10 – Fixed multiple spelling mistakes and small plugin issues
# v 6.9 – Fixed VMKernel logs but had to remove date/Time parser due to inconsistent VMKernel Log entries
# v 6.8 – Added Creator of snapshots back in due to popular demand
# v 6.7 – Added Multiple plugins from contributors – Thanks!
# V 6.6 – Tech Support Mode Plugin fixed to work with 5.0 hosts
# V 6.5 – HW Version plugin fixed due to string output
# V 6.4 – Added a 00 plugin and VeryLastPlugin for vCenter connection info to separate the report entirely from VMware if needed.
# V 6.3 – Changed the format of each Plugin so you can include a count for each header and altered plugin layout for each plugin.
# V 6.2 – Added Time to Run section based on TimeToBuild by Frederic Martin
# V 6.1 – Bug fixes, filter for ps1 files only in the plugins folder so other files can be kept in the plugins folder.

Reminder

If a plugin is not needed in your environment remove it from the plugins folder as it will speed up the execution of your script.

Space Adventure by Olivia Renouf (Aged 6)

imageA little off topic for my blog but hey…. its my blog Smile

The other day my 6 year old daughter was at home with her Grandma and started writing some words onto a piece of paper, Grandma asked her if she was writing a book ?  From then on she was.

Once she had finished she drew some pictures and showed us all, she did a fantastic job.

Being the proud father that I am, I decided to make my daughter an author and used “iBook Author” to re-create her story, scanning in and using her original pictures.

So if you have children and an iPad make sure you go download my daughters book and let us know what you think.

Personally her mother and I think its amazing and my daughter is proud to be an author at the age of 6.

I wonder what the youngest ever author’s age is ?

Download

Download it for free here:: Make sure you hold it sideways to see it all –  http://itunes.apple.com/gb/book/space-adventure/id499968729?mt=11

Example page

 

image

Number 1 Scripting blog & Number 7 Virtualization Blog

imageEvery year Eric Siebert from vSphere-Land.com holds a public vote to find the best VMware/Virtualization blog. In previous years I have been creeping up the table last year making it into the top 10 and reaching number 9.

This year I took a leap and hit number 7 !

As well as this fantastic news, Eric also started some sub categories this year and I could not believe it when I saw that I was #1 in the scripting blog list.  Personally I think superstars Luc Dekens or William Lam should have been number 1 but hey, I guess that was just my vote !

 

I just wanted to thank everyone who voted for me, this kind of appreciation really shows that firstly, I am not the only person who reads my blog and secondly that my scripts make a difference.

I would also like to pass on my Congratulations to firstly my fellow team mates in VMware Technical Marketing:

  • Duncan Epping – Number 1
  • Frank Denneman – Number 5
  • William Lam – Number 8

My fellow scripting buddies:

  • Luc Dekens – Number 14
  • Arnim van Lieshout – 61
  • Raphael Schitz – Number 63
  • Josh Atwell – Number 73
  • Arne Fokkema – Number 76
  • Jonathan Medd – Number 91
  • Kirk Munro – Number 116
  • Hal Rottenberg – Number 127
  • Clint Kitson – Number 130

And anyone else who made it on the list, if your on the list then you are part of this wonderful community and you help make everyone’s life that little bit easier.

Removing the vCD Agent from hosts

When re-installing my vCD home lab I had an issue when I went to re-add some hosts which had already been used in a vCD environment, this was because the hosts had already been “prepared” by vCD and therefore had the “vcloud-agent” vib installed.  Of course you would normally unprepare these from the vCD web interface before deleting your vCD instance but I forgot to do this.

I was then pointed to Chris Colotti’s post here which showed how to manually remove the vCD agent from hosts in this situation.

As I had a few of them to do I didn’t want to repeat myself and therefore wrote a quick PowerCLI Script to remove the agents for me.

Another thing I couldn’t see in Chris’s post which I had to do before it was fully removed was reboot the host so I added that into the script too.

Checking for hosts with the vCD Agent installed

We can easily see the hosts which have the vCD agent installed by running the following PowerCLI code:

Connect-VIServer MyVIServer -User Administrator –Password “Pa$$word”
Get-VMHost | Sort Name | Foreach {
    $ESXCLI = Get-EsxCli -VMHost $_ -ErrorAction SilentlyContinue
    $ESXCLI.software.vib.list() | Where { $_.Name -like "*vCloud*"} | Select @{N="VMHost";E={$ESXCLI.VMHost}}, Name, Version
}

We would receive the following output:

image

Removing the vCD Agents

Due to an issue with the way PowerCLI calls ESXCLI I have had to make the script slightly more complicated than it needs to be but it still does the job.  It will go through each host and remove the “vcloud-agent” vib and then reboot them ready to be added into the new vCD instance.

# The following two variables are used to define the esx hosts local login details
$HostUser = "root"
$HostPass = "localpa$$"

$vCenter = Connect-VIServer MyviServer -User Administrator –Password “Pa$$word”
Get-Cluster | Get-VMHost | Sort Name | Foreach {
    $ESXCLI = Get-EsxCli -VMHost $_ -ErrorAction SilentlyContinue
     $vCDHosts = $ESXCLI.software.vib.list() | Where { $_.Name -like "*vCloud*"} | Select @{N="VMHost";E={$ESXCLI.VMHost}}, Name, Version
    $vCDHosts
}

$vCenter | Disconnect-VIServer -Force -Confirm:$false

# Because of a bug in PowerCLI with ESXCLI we need to connect to each host individually and not through vCenter
$vCDHosts | Foreach {
    $VMHCon = Connect-VIServer ($_.VmHost) -User $HostUser -Password $HostPass
    Write-Host "Removing vCloud Agent for $($_.VMHost)"
    $ESXCLI = Get-EsxCli -ErrorAction SilentlyContinue
    $ESXCLI.software.vib.remove($false, $true, $false, $true, $_.Name)
    # During testing I found a reboot was needed
    Write-Host "Rebooting host $($_.VMHost)"
    Restart-VMHost -VMHost $_.VmHost -Confirm:$false
    $VMHCon | Disconnect-VIServer -Confirm:$false
}

vCheck 6.0 released

One of the most popular scripts on my site with 26,966 downloads of v5 has been the vCheck script, for those of you who haven’t seen this yet here is a quick summary of this script:

Summary

vCheck is a vCenter checking script, the script is designed to run as a scheduled task before you get into the office to present you with key information via an email directly to your inbox in a nice easily readable format.

This script picks on the key known issues and potential issues of the virtual infrastructure and reports it all in one place so all you do in the morning is check your email.

One of they key things about this report is if there is no issue in a particular place you will not receive that section in the email, for example if there are no datastores with less than 5% free space (configurable) then the disk space section will not show in the email, this ensures that you have only the information you need in front of you when you get into the office.

This script is not to be confused with an Audit script, I don’t want to remind you that you have 5 hosts and what there names are and how many CPU’s they have each and every day as you don’t want to read that kind of information unless you need it, this script will only tell you about problem areas with your infrastructure.

Continue reading →

Using PowerShell with Internet Explorer

PowerShell is a great language, I am often amazed at how far it can actually reach and what you can gather data, write data or use data from.

Mainly I use PowerShell to manage my VMware environment but last night I broke from my comfort zone and took some time to see what I was able to do with Internet Explorer – Did you know you can programmatically browse the web with PowerShell ?  Well you can!

The Reason

First thing I needed was a reason, at the moment there is a poll for top virtualization blogs, last year I surprisingly did very well in this and would like to thank anyone who voted for me.  This year as I was filling it out and selecting some of my favorite blogs from the list.  People like Duncan Epping, Eric Sloof, William Lam, Luc Dekens, Jonathan Medd, Frank Denneman the list goes on and on and then I found my blog tucked away near the bottom amongst the other blogs beginning with V… as this is a virtualization top list you can imagine there were a few beginning with V!

Anyway, I thought there must be an easier way to allow people to vote for me than to hope they find me amongst the V’s and don’t get bored along the way and choose others so here it is:

The below script is not a cheating script, it will not make you vote for me 1000 times it will simply start internet explorer, browse to the survey and select my site for you, one this has done you are free to deselect me if you wish and also select the other 9 participants you would like to vote for.  After this just follow on through the survey and click Submit to finish.

Obviously with PowerShell I could have just added my favorite bloggers to this script and completed the survey for you but that would be cheating and I believe in the freedom to vote!

So if you have not yet voted then simply paste the following code into a PowerShell window and watch it control internet explorer and automatically select Virtu-Al from the list, the other choices are up to you!

$URL = "http://www.surveygizmo.com/s3/786135/Top-VMware-virtualization-blogs-2012"
$ie = New-Object -com InternetExplorer.Application
$ie.visible=$true
$ie.navigate($URL) 
while($ie.ReadyState -ne 4) {start-sleep -m 100}
$ie.Document.getElementById("sg_NextButton").click()
$ie.Document.getElementById("sgE-786135-1-27-10906").Click() # Click Virtu-Al

PowerCLI Android and iPhone App

A while back I found an iPhone and iPad app which allowed you to reference the PowerCLI Cmdlets, this is quite useful when you are on the move and need a quick reference.

Today I came across a similar app for the android and also iPhone and wanted to share it.

vPowerCLI5 Reference is an app for Android which can be downloaded from here:

Android: http://droidmill.com/vpowercli5-reference-405917.html#.Txgq7ZiE6-8

iPhone: http://itunes.apple.com/us/app/vpowercli5-reference/id489731144?mt=8

This tool is to be used for referencing the VMware vSphere PowerCLI cmdlets. vSphere PowerCLI is a command-line and scripting tool built on Windows PowerShell, and is used for managing and automating vSphere.

It looks like this is a Android/iPhone friendly version of the online PowerCLI help which can be found here:

http://www.vmware.com/support/developer/PowerCLI/PowerCLI501/html/index.html

image

image

 

 

 

 

 

 

 

 

 

 

This post was updated to include iPhone app.

Using Console2 with PowerShell and PowerCLI

I may be a late comer to this app but there is a cool free app here called Console2.  I am now using it for the quick work I need to do in PowerCLI and PowerShell, the stuff I dont need to save or need an editor for.

Its great as a portable app, I have it in my DropBox folder and its syncd between my PC’s as well as being on a USB key so I can use it from anywhere.

I like the way you can resize the window and it resizes the buffer and the copy and paste is also enhanced from the normal console.

I have packaged my settings and logos up so you too can see what I see, just download the settings file from below and Console2 from here and extract them into the same folder.

{filelink=15}

Eye Candy

Console2

Console2PS