A Powershell Script to notify you on the vSphere 5.1 Release

vSphere 5.1 will most probably be released by the end of September 10th (that is 2 minutes from now in my timezone).

Of course nothing is 100% certain but I will explain on what this assumption is based.

  1. From this Press release 

    Press Release 1

  2. From the VMware Unveils Industry’s Most Comprehensive Cloud Infrastructure and Management Solution press release

    Press Release 2

  3. September 11, 9-11. This is a sensitive date for especially for Americans. I doubt that anyone, let alone VMware, would go all out with the release multiple new versions of their software on this day. I assume it will be before that.

  4. vCAT 3.0 release end of day September 10, 2012


  5. vSphere 5.0 is available for download from here – but 5.1 is not – yet…

    Not yet

So instead of pushing F5 the whole day I wrote a very simple Powershell script to do it for me.



The basic function was taken from this post Using PowerShell to Query Web Site Information

Then the rest was easy.

Get the page. Parse the HTML and see if it still contains the Unable to Complete Your Request text.

If it does – that means the 5.1 site has not gone live. Sleep for 5 minutes, and check again.

If the text is no longer there – then probably the 5.1 bits are available. In that case – do something (like send me an email)

function Get-WebPage {
   Downloads web page from site.
   Downloads web page from site and displays source code or displays total bytes of webpage downloaded
    URL of the website to test access to.
.PARAMETER UseDefaultCredentials
    Use the currently authenticated user's credentials  
    Used to connect via a proxy
.PARAMETER Credential
    Provide alternate credentials 
    Displays the size of the downloaded page in bytes                 
    Name: Get-WebPage
    Author: Boe Prox
    DateCreated: 08Feb2011        
    Get-WebPage -url "https://www.bing.com"
Returns information about Bing.Com to include StatusCode and type of web server being used to host the site.

	DefaultParameterSetName = 'url',
	ConfirmImpact = 'low'
            Mandatory = $True,
            Position = 0,
            ParameterSetName = '',
            ValueFromPipeline = $True)]
            Position = 1,
            Mandatory = $False,
            ParameterSetName = 'defaultcred')]
            Mandatory = $False,
            ParameterSetName = '')]
            Mandatory = $False,
            ParameterSetName = 'altcred')]
            Mandatory = $False,
            ParameterSetName = '')]
Begin {     
    $psBoundParameters.GetEnumerator() | % { 
        Write-Verbose "Parameter: $_" 
    #Create the initial WebClient object
    Write-Verbose "Creating web client object"
    $wc = New-Object Net.WebClient 
    #Use Proxy address if specified
    If ($PSBoundParameters.ContainsKey('Proxy')) {
        #Create Proxy Address for Web Request
        Write-Verbose "Creating proxy address and adding into Web Request"
        $wc.Proxy = New-Object -TypeName Net.WebProxy($proxy,$True)
    #Determine if using Default Credentials
    If ($PSBoundParameters.ContainsKey('UseDefaultCredentials')) {
        #Set to True, otherwise remains False
        Write-Verbose "Using Default Credentials"
        $wc.UseDefaultCredentials = $True
    #Determine if using Alternate Credentials
    If ($PSBoundParameters.ContainsKey('Credentials')) {
        #Prompt for alternate credentals
        Write-Verbose "Prompt for alternate credentials"
        $wc.Credential = (Get-Credential).GetNetworkCredential()
Process {    
    Try {
        If ($ShowSize) {
            #Get the size of the webpage
            Write-Verbose "Downloading web page and determining size"
            "{0:N0}" -f ($wr.DownloadString($url) | Out-String).length -as [INT]
        Else {
            #Get the contents of the webpage
            Write-Verbose "Downloading web page and displaying source code" 
    Catch {
        Write-Warning "$($Error[0])"

$SMTP = "smtp.maishsk.local"

do {

	$a = Get-WebPage https://my.vmware.com/web/vmware/info/slug/datacenter_cloud_infrastructure/vmware_vsphere/5_1
	$test = $a -match "Unable to Complete Your Request"
	sleep 300
while ($test)

Send-MailMessage -From "Maish<[email protected]>" -To "Maish<[email protected]>" -Subject "vSphere 5.1 page has changed" -SmtpServer $SMTP

The script is not perfect, clean or optimized – but actually this shows you how to check for a change on a web page – which can be used in a large number of scenarios.

I will probably be asleep when vSphere 5.1 is released – but it will be interesting to see how accurate my script was – and at what time I received the notification from the script.