<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>vCloudscape</title>
	<atom:link href="http://vcloudscape.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vcloudscape.com</link>
	<description>The art of virtual clouds</description>
	<lastBuildDate>Fri, 14 Jun 2013 15:50:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.8.10</generator>
<site xmlns="com-wordpress:feed-additions:1">49382124</site>	<item>
		<title>Install Software in Isolated Virtual Machines</title>
		<link>http://vcloudscape.com/2013/05/01/install-software-in-isolated-virtual-machines/</link>
					<comments>http://vcloudscape.com/2013/05/01/install-software-in-isolated-virtual-machines/#respond</comments>
		
		<dc:creator><![CDATA[Aidan Dalgleish]]></dc:creator>
		<pubDate>Wed, 01 May 2013 12:38:35 +0000</pubDate>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[vCenter Server]]></category>
		<category><![CDATA[vCloud Director]]></category>
		<category><![CDATA[vSphere]]></category>
		<guid isPermaLink="false">http://vcloudscape.com/?p=440</guid>

					<description><![CDATA[During the back-end of 2012 and earlier this year, I was involved in a fairly substantial VMware vCloud Plan and Design engagement that required integration of a number of different VMware and 3rd Party products.  In particular a level of integration was required between VMware vCloud Director (vCD), vCloud Automation Center (vCAC) and consumer virtual [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>During the back-end of 2012 and earlier this year, I was involved in a fairly substantial VMware vCloud Plan and Design engagement that required integration of a number of different VMware and 3rd Party products.  In particular a level of integration was required between <a title="VMware vCloud Director" href="http://www.vmware.com/uk/products/datacenter-virtualization/vcloud-director/overview.htmlhttp://" target="_blank">VMware vCloud Director</a> (vCD), <a title="vCloud Automation Center" href="http://www.vmware.com/uk/products/datacenter-virtualization/vcloud-automation-center/overview.html" target="_blank">vCloud Automation Center</a> (vCAC) and consumer virtual machine workloads.  This was required in order to offer advanced management capabilities.</p>
<p>One of the challenges that came to light during my involvement with this project was that the vCAC design depended upon the use of vCAC agents for installing software packages in virtual machine workloads.  In effect it was assumed TCP/IP connectivity was available between the management infrastructure and consumer virtual machines – not common practice in a multi-tenant environment.  Without going in to specific details of the project, what was needed was a mechanism to install software in consumer virtual machines without compromising security between the provider and the consumer(s).  A number of options were considered, including:</p>
<ul>
<li>Multiple options around the concept of secured networking (using tools such as Private VLANs, vShield Edge, vShield App etc…)</li>
</ul>
<ul>
<li>Leveraging the <a title="VIX API" href="http://www.vmware.com/support/developer/vix-api/" target="_blank">VIX API</a></li>
</ul>
<p>I was personally an advocate of the second option as it involved not TCP/IP connectivity between consumer’s and/or the provider infrastructure.  Furthermore it would work for virtual machines running on isolated networks too.  During the various design discussions that ensued I produced a quick example script to prove the concept of connecting to vCloud Director, identifying a specific vApp and its constituent virtual machines, and then locating the same virtual machines in vSphere and installing the required software.  The following video and script is an updated version of that initial test, which I enhanced with the ability to cope with multiple virtual machines, Powered Off virtual machines and packaged as an advanced function.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/3d875409-2a64-489a-af93-91a8b623315c/embed" height="400" width="625" allowfullscreen="" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function Install-WinPkgInvCloudVM {
&lt;#
.SYNOPSIS
    Install a software package in vCloud Director managed virtual machine.
.DESCRIPTION
    Identify virtual machine(s) within a vCloud Director vApp and install a package in the guest operating system
.PARAMETER CIServer
    The hostname of a vCloud Director Server managing the vApp(s).
.PARAMETER CIUser
    The username of a valid user to connect to the vCloud Director Server managing the vApp(s).
.PARAMETER CIPassword
    The password for the user CIUser to connect to the vCloud Director Server managing the vApp(s).
.PARAMETER VApp
    The name or object or collection of objects of a vApp in which to search for virtual machines.
.PARAMETER Package
    The full path to a software package to be installed in the windows guest.
.PARAMETER Command
    The command required to install the software package.
.PARAMETER VIUser
    The username of a valid user to connect to the vCenter Server managing ESXi Server hosts on which to search for volumes.
.PARAMETER VIPassword
    The password for the user VIUser to connect to the vCenter Server managing ESXi Server hosts on which to search for volumes.
.PARAMETER GuestUser
    The username of a valid user to connect to the vCenter Server managing ESXi Server hosts on which to search for volumes.
.PARAMETER GuestPassword
    The password for the user VIUser to connect to the vCenter Server managing ESXi Server hosts on which to search for volumes.
.EXAMPLE
    PS C:\ Install-WinPkgInvCloudVM -CIServer &quot;mycloud.myurl.com&quot; -CIUser &quot;MyvCDUser&quot; -CIPassword &quot;MyvCDPassword&quot; -CIVApp &quot;MyVApp&quot; `
    -Org &quot;MyOrg&quot; -SrcPath &quot;C:\Users\myuser\mypackage.msi&quot; -DstPath &quot;C:\Users\myuser\&quot; -Command &quot;C:\Users\myuser\mypackage.msi /S&quot; `
    -VIUser &quot;MyVCUser&quot; -VIPassword &quot;MyVCPassword&quot; -GuestUser &quot;MyGuestUser&quot; -GuestPassword &quot;MyGuestPassword&quot;
#&gt;
[CmdletBinding()]
param(
    [parameter(Mandatory=$true,
        HelpMessage=&quot;Supply the hostname of the vCloud Director Server managing the vApp(s).&quot;,
        ValueFromPipeline=$false)]
    [String]
    $CIServer
    ,
    [parameter(Mandatory=$true,
        HelpMessage=&quot;Supply a valid username for the supplied CIServer.&quot;,
        ValueFromPipeline=$false)]
    [String]
    $CIUser
    ,
    [parameter(Mandatory=$true,
        HelpMessage=&quot;Supply a valid password for the supplied CIServer.&quot;,
        ValueFromPipeline=$false)]
    [String]
    $CIPassword
    ,
    [parameter(Mandatory=$true,
        HelpMessage=&quot;Supply a vApp name.&quot;,
        ValueFromPipeline=$true,
        ValueFromPipelineByPropertyName=$true)]
    [String[]]
    $CIVapp
    ,
    [parameter(Mandatory=$true,
        HelpMessage=&quot;Supply an Org name to narrow search&quot;,
        ValueFromPipeline=$false,
        ValueFromPipelineByPropertyName=$true)]
    [String]
    $Org
    ,
    [parameter(Position=0,
        Mandatory=$false,
        HelpMessage=&quot;Supply a OrgVdc name to narrow search.&quot;,
        ValueFromPipeline=$false,
        ValueFromPipelineByPropertyName=$true)]
    [String]
    $OrgVdc
    ,
    [parameter(Mandatory=$false,
        HelpMessage=&quot;Supply a the full path to a local software package to be copied to the vApp.&quot;,
        ValueFromPipeline=$false)]
    [String]
    $SrcPath
    ,
    [parameter(Mandatory=$false,
        HelpMessage=&quot;Supply a the full path to a destination folder for the software package.&quot;,
        ValueFromPipeline=$false)]
    [String]
    $DstPath
    ,
    [parameter(Mandatory=$false,
        HelpMessage=&quot;Supply a command to start the installation of the software package.&quot;,
        ValueFromPipeline=$false)]
    [String]
    $Command
    ,
    [parameter(Mandatory=$true,
        HelpMessage=&quot;Supply a valid username for the supplied VIServer.&quot;,
        ValueFromPipeline=$false)]
    [String]
    $VIUser
    ,
    [parameter(Mandatory=$true,
        HelpMessage=&quot;Supply a valid password for the supplied VIServer.&quot;,
        ValueFromPipeline=$false)]
    [String]
    $VIPassword
    ,
    [parameter(Position=3,
        Mandatory=$false,
        HelpMessage=&quot;Supply a user for guest operating system.&quot;,
        ValueFromPipeline=$false)]
        [ValidateNotNull()]
    $GuestUser
    ,
    [parameter(Position=4,
        Mandatory=$false,
        HelpMessage=&quot;Supply a password for the guest operating system.&quot;,
        ValueFromPipeline=$false)]
    [ValidateNotNull()]
    $GuestPassword
    ,
    [parameter(Mandatory=$false,
        HelpMessage=&quot;Specify if installation should continue in supported VMs, when other un-supported guest operating systems are detected.&quot;,
        ValueFromPipeline=$false)]
    [Switch]
    $NonSupportedGuestOveride = $false
)
Begin {
    # Define supported virtual machines guest operating systems for this function
    $SuppOSFullNames = &quot;Microsoft Windows XP Professional (32-bit)&quot;,
    &quot;Microsoft Windows Server 2003 (64-bit)&quot;,
    &quot;Microsoft Windows Server 2003 (32-bit)&quot;,
    &quot;Microsoft Windows 7 (64-bit)&quot;,
    &quot;Microsoft Windows Server 2008 R2 (64-bit)&quot;,
    &quot;Microsoft Windows Server 2008 (64-bit)&quot;,
    &quot;Microsoft Windows Server 2008 (32-bit)&quot;
}
Process {
    # Connect to the vCloud Director Server
    Write-Host Connecting to vCloud Director Server $CIServer
    Connect-CIServer -Server $CIServer -User $CIUser -Password $CIPassword | Out-Null

    # Locate the vApp within vCloud Director (assumes no duplicate names can existing within a given Organisation)
    Write-Host &quot;Searching for the vApp&quot; $CIVapp
    if ($OrgVdc){
        $vCDvApp = Get-CIVApp -Name $CIVApp -Org $Org -OrgVdc $OrgVdc
    }else{
        $vCDvApp = Get-CIVApp -Name $CIVApp -Org $Org
    }

    if (!$vCDvApp){
        Write-Host -ForegroundColor Red &quot;The vApp&quot; $CIVApp &quot;could not be found&quot;
    }

    # Identify the virtual machine(s) located within the vApp
    Write-Host Identifying vCloud virtual machines within vApp $CIVapp
    $vCDVms = Get-CIVM -VApp $vCDvApp
    if (!$vCDVms){
        Write-Host -ForegroundColor Yellow &quot;vApp&quot; $CIVapp &quot;does not contain any virtual machines&quot;
        Write-Host -ForegroundColor Yellow &quot;Package will not be copied and installed - skipping vApp&quot;
    }
    Write-Host $CIVapp &quot;contains&quot; ($vCDVms | Measure-Object).Count &quot;virtual machines:&quot;
    $vCDVms | Select Name, Status, GuestOSFullName, Href | Format-Table -AutoSize | Out-String

    # Identify the vCenter Server, MoRef and other useful properties of the virtual machine(s) located within the vApp
    Write-Host &quot;Retrieving vSphere properties for vCloud virtual machines:
    $vSphereMaps = @()
    $vCDVms | foreach {
        # Retrieve CIVm ExtensionData
        $vCloudExtData = $_.ExtensionData.VCloudExtension

        # Start building a custom object containing useful vSphere VM information
        $vSphereMap = New-Object System.Object
        $vSphereMap | Add-Member -MemberType NoteProperty -Name VmName -Value $_.Name
        $vSphereMap | Add-Member -MemberType NoteProperty -Name Status -Value $_.Status
        $vSphereMap | Add-Member -MemberType NoteProperty -Name Href -Value $_.Href
        $vSphereMap | Add-Member -MemberType NoteProperty -Name vCenterServer -Value
        $vCloudExtData.SyncRoot[0].Any.SyncRoot[0].VmVimObjectRef.VimServerRef.name
        $vSphereMap | Add-Member -MemberType NoteProperty -Name VmMoRef -Value
        $vCloudExtData.SyncRoot[0].Any.SyncRoot[0].VmVimObjectRef.MoRef
        Write-Host vCloud virtual machine $vSphereMap.VmName is managed by vCenter Server $vSphereMap.vCenterServer and has the MoRef
        $vSphereMap.VmMoRef

        # Check if the identified Guest OS is supported for this function and flag if not supported
        $SuppCount = 0
        $GuestOsSupported = &quot;Yes&quot;
        foreach ($SuppOSFullName in $SuppOSFullNames) {
            if ($_.GuestOsFullName -eq $SuppOSFullName) {
                $SuppCount ++
            }
        }
        if ($SuppCount -lt 1) {
            Write-Host -ForegroundColor Red &quot;Unsupported guest operating system detected in virtual machine&quot; $_.Name
            Write-Host -ForegroundColor Red &quot;OSFullName must be one of:&quot; ($SuppOSFullNames | Format-Table | Out-String)
            $GuestOsSupported = &quot;No&quot;
            if (!$NonSupportedGuestOveride){
                Write-Host -ForegroundColor Red &quot;unction aborted. Use the 'NonSupportedGuestOveride' switch in order to overide and install packages in any supported virtual machines&quot;
                exit 1
            }
        }

        # Add VM Guest OS information to the custom object
        $vSphereMap | Add-Member -MemberType NoteProperty -Name GuestOsFullName -Value $_.GuestOsFullName # May add multiple OS support later.
        $vSphereMap | Add-Member -MemberType NoteProperty -Name GuestOsSupported -Value $GuestOsSupported # May add multiple OS support later.

        # Add custom object to an array
        $vSphereMaps += $vSphereMap
    }

    # Summarise the mapping information rerieved
    Write-Host vCloud Director Server to vCenter Server mapping information is as follows
    $vSphereMaps | Format-Table @{Expression={$_.VmName};Label=&quot;Name&quot;},Href, Status,@{Expression={$_.vCenterServer};Label=&quot;vCenter Server&quot;},@{Expression={$_.VmMoRef};Label=&quot;MoRef&quot;},@{Expression={$_.GuestOsFullName};Label=&quot;Guest OS&quot;},@{Expression={$_.GuestOsSupported};Label=&quot;Supported&quot;}  | Out-String

    # Disconnect from the vCloud Director Server
    Write-Host Disconnecting from vCloud Director Server $CIServer
    Disconnect-CIServer -Server $CIServer -Force -Confirm:$false

    # Connect to the first identified vCenter Server (assume all VMs in a vApp are managed by a common vCenter Server)
    $VIServer = $vSphereMaps[0].vCenterServer
    Write-Host Connecting to vCenter Server $VIServer
    Connect-VIServer -Server $VIServer -User $VIUser -Password $VIPassword | Out-Null

    # Loop through each discovered VM in the vApp
    $vSphereMaps | foreach {
        Write-Host &quot;Processing virtual machine&quot; $_.VmName

        # Verify the VM has a supported Guest OS
        if (($_.GuestOsSupported -eq &quot;Yes&quot;) -and ($_.Status -eq &quot;PoweredOn&quot;)){
            Write-Host &quot;Virtual machine Guest OS is supported for package copy and install&quot;

            # Identify the vSphere VM
            Write-Host Locating vSphere virtual machine object using MoRef $_.VmMoRef
            $VIVm = Get-VM -id (&quot;VirtualMachine-&quot; + $_.VmMoRef)
            Write-Host &quot;Located vSphere virtual machine&quot; $VIVm.Name &quot;in $VIServer &quot;inventory&quot;

            # Copy install package to the virtual machine
            Write-Host Copying install package to vSphere virtual machine $VIVm.Name
            Write-Host &quot;Transfering local package&quot; $SrcPath &quot;to virtual machine destination&quot; $DstPath
            Copy-VMGuestFile -VM $VIVm -GuestUser $GuestUser -GuestPassword $GuestPassword -Source $SrcPath -Destination $DstPath -LocalToGuest -Force

            # Execute install package in the virtual machine
            $FileName = $SrcPath.Split(&quot;\&quot;)[(($SrcPath.Split(&quot;\&quot;)).Length -1)]
            Write-Host Executing package $DstPath within guest operating system of vSphere virtual machine $VIVm.Name
            $Result = Invoke-VMScript -VM $VIVm -GuestUser $GuestUser -GuestPassword $GuestPassword -ScriptText $Command
            $ExitCode = $Result.ExitCode
            Write-Host vSphere virtual machine $VIVm.Name returned exit code $ExitCode
        }elseif ($_.Status -eq &quot;PoweredOff&quot;){
            Write-Host -ForegroundColor Yellow &quot;Virtual machine is powered off&quot;
            Write-Host -ForegroundColor Yellow &quot;Package cannot be copied and installed - skipping virtual machine&quot; $_.VmName
        }else{
            Write-Host -ForegroundColor Yellow &quot;Virtual machine Guest OS not supported for package copy and install&quot;
            Write-Host -ForegroundColor Yellow &quot;Package will not be copied and installed - skipping virtual machine&quot; $_.VmName
        }
    }

    # Disonnect from the identified vCenter Server
    Write-Host Disconnecting from vCenter Server $VIServer
    Disconnect-VIServer -Server $VIServer -Force -Confirm:$false
}
End{}
}
</pre>
<p>When I get some more free time, I might take a look at adding some enhancements, such as support for both Windows and Linux based virtual machine guest operating systems and/or enhanced support for handling virtual machines in different power states.  Feel free to leave comments and provide some suggestions.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://vcloudscape.com/2013/05/01/install-software-in-isolated-virtual-machines/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">440</post-id>	</item>
		<item>
		<title>VMworld 2013 Public Voting Open</title>
		<link>http://vcloudscape.com/2013/04/26/vmworld-2013-public-voting-open/</link>
					<comments>http://vcloudscape.com/2013/04/26/vmworld-2013-public-voting-open/#respond</comments>
		
		<dc:creator><![CDATA[Aidan Dalgleish]]></dc:creator>
		<pubDate>Fri, 26 Apr 2013 10:11:08 +0000</pubDate>
				<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[Site Recovery Manager]]></category>
		<category><![CDATA[vCloud Director]]></category>
		<category><![CDATA[VMworld 2013]]></category>
		<guid isPermaLink="false">http://vcloudscape.com/?p=434</guid>

					<description><![CDATA[It seems like only yesterday I was getting ready for VMworld 2012, but here we are again for 2013.  VMworld 2013 public voting is now open and can be accessed here.  The sessions I have submitted this year are listed below.  If you think they are interesting and of interest for you personally then feel [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>It seems like only yesterday I was getting ready for VMworld 2012, but here we are again for 2013.  VMworld 2013 public voting is now open and can be accessed <a title="http://www.vmworld.com/index.jspa" href="http://www.vmworld.com/index.jspa">here.</a>  The sessions I have submitted this year are listed below.  If you think they are interesting and of interest for you personally then feel free to give them your vote.</p>
<h4>4503 &#8211; Architecting a UK Government-assured Multi-site vCloud</h4>
<p><strong>Abstract:</strong>  Resiliency is a key aspect of any infrastructure—it is especially important in infrastructure-as-a-service solutions, such as a vCloud assured for use by the UK Government and Public Sector. This session will include a tour of a real world solution deployed by Skyscape. Throughout the session there will be detailed guidance on how the solution achieves high-availability and disaster recovery capabilities using VCE hardware with EMC VNX and VPLEX, whilst achieving accreditation by the UK Government up to Restricted level and compliance with ISO27001 standards.</p>
<p><strong>Presenters:</strong>  <a href="https://twitter.com/AidersD">Aidan Dalgleish</a> and <a href="https://twitter.com/vstinto">Richard Stinton</a></p>
<h4>4667 &#8211; Monitoring your vCloud Infrastructure with vCenter Operations</h4>
<p><strong>Abstract:  </strong>In this session we will cover the requirements needed to monitor your vCloud Infrastructure. Multiple real world scenarios will be demonstrated with recommendations on best practice and potential pitfalls, how to integrate vCenter Operations with vCloud Director and vFabric Hyperic.</p>
<p><strong>Presenters:</strong>  <a href="https://twitter.com/davehill99">David Hill</a> and <a href="https://twitter.com/AidersD">Aidan Dalgleish</a></p>
<h4>4804 &#8211; Addressing your DR IP ails without the need for ale</h4>
<p><strong>Abstract:  </strong>Recovery of virtual machines in a disaster recovery situation is always complicated, and without the luxury of stretched physical layer 2 networks, the inflexibility of IP addressing can be a significant challenge. We find ourselves jumping through hoops to accommodate the location specific requirements of IP addressing and routing. This session will walk you through how to setup VMware Infrastructure IP addressing in order to simplify DR failover by removing the requirement to reconfigure your virtual machines to match the new address space. During the session we will cover the infrastructure requirements of this including but not limited to vShield Manager, vShield Edges, VXLAN and network overlay technologies. At the conclusion of the session you will be able to articulate the benefits of overlay networks and how they offer the potential to help simplify disaster recovery processes for your infrastructure.</p>
<p><strong>Presenters: </strong> <a href="https://twitter.com/Borgcube_">Kamau Wanguhu</a> and <a href="https://twitter.com/AidersD">Aidan Dalgleish</a></p>
]]></content:encoded>
					
					<wfw:commentRss>http://vcloudscape.com/2013/04/26/vmworld-2013-public-voting-open/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">434</post-id>	</item>
		<item>
		<title>VMware vCloud Director Infrastructure Resiliency Case Study</title>
		<link>http://vcloudscape.com/2013/03/27/vmware-vcloud-director-infrastructure-resiliency-case-study/</link>
					<comments>http://vcloudscape.com/2013/03/27/vmware-vcloud-director-infrastructure-resiliency-case-study/#comments</comments>
		
		<dc:creator><![CDATA[Aidan Dalgleish]]></dc:creator>
		<pubDate>Wed, 27 Mar 2013 22:55:23 +0000</pubDate>
				<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[vCloud Director]]></category>
		<category><![CDATA[VMworld 2012]]></category>
		<guid isPermaLink="false">http://vcloudscape.com/?p=394</guid>

					<description><![CDATA[This afternoon I just received confirmation that the paper Alan Renouf and I have been working on, has finally been published.  The paper is titled &#8220;VMware vCloud Director Infrastructure Resiliency Case Study &#8211; Automation with Microsoft Windows PowerShell and VMware vSphere PowerCLI&#8220;. This paper is intended to compliment the VMware vCloud Director Infrastructure Resiliency Case [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This afternoon I just received confirmation that the paper <a title="Alan Renouf" href="www.virtu-al.net">Alan Renouf</a> and I have been working on, has finally been published.  The paper is titled &#8220;<a href="http://www.vmware.com/files/pdf/techpaper/VMware-vCloud-Directore-Infrastructure-resiliency-whitepaper.pdf">VMware vCloud Director Infrastructure Resiliency Case Study &#8211; Automation with Microsoft Windows PowerShell and VMware vSphere PowerCLI</a>&#8220;.</p>
<p>This paper is intended to compliment the <a href="http://www.vmware.com/files/pdf/techpaper/vcloud-director-infrastructure-resiliency.pdf">VMware vCloud Director Infrastructure Resiliency Case Study</a> paper published previously by <a href="http://www.yellow-bricks.com">Duncan Epping</a> and <a href="http://www.chriscolotti.us/">Chris Colotti</a>.  The original paper provides a great explanation of the concepts and principles behind how vCloud Director disaster recovery solutions can be implemented, whilst this new paper describes how the solution can be automated with <a href="www.vmware.com/go/powercli">VMware vSphere PowerCLI</a>.</p>
<p>The content of this paper is derived from work carried out at Oxford University, which was built upon the principles detailed in the original paper but complimented with some automation courtesy of vSphere PowerCLI.  Additional information is available in the VMworld sessions <a href="http://www.vmworld.com/docs/DOC-6223">INF-BCO2155</a> &#8220;vCloud DR for Oxford University Computing Services &#8211; Real World Example&#8221; and <a href="http://www.vmworld.com/docs/DOC-6295">INF-VSP2164</a> &#8220;Automation of vCloud Director Disaster Recovery&#8221;.</p>
<p>I would like to thank Alan for his support in getting this paper published and <a href="http://vmland.blogspot.co.uk/">Gary Blake</a> for helping build the Oxford University vCloud DR solution.  Last but not I need to thank Adrian Parks and Jon Hutchings from Oxford University Computing Services, for working with us on this project and trusting us with their vCloud.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://vcloudscape.com/2013/03/27/vmware-vcloud-director-infrastructure-resiliency-case-study/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">394</post-id>	</item>
		<item>
		<title>INF-BCO2155 vCloud Disaster Recovery for Oxford University &#8211; Real Example</title>
		<link>http://vcloudscape.com/2013/03/27/inf-bco2155-vcloud-disaster-recovery-for-oxford-university-real-example/</link>
					<comments>http://vcloudscape.com/2013/03/27/inf-bco2155-vcloud-disaster-recovery-for-oxford-university-real-example/#respond</comments>
		
		<dc:creator><![CDATA[Aidan Dalgleish]]></dc:creator>
		<pubDate>Wed, 27 Mar 2013 22:51:17 +0000</pubDate>
				<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[vCloud Director]]></category>
		<guid isPermaLink="false">http://vcloudscape.com/?p=405</guid>

					<description><![CDATA[Abstract Resiliency is a key aspect of any infrastructure—it is even more important in infrastructure-as-a-service solutions. This session will include a tour of a real world vCloud DR solution deployed at Oxford University Computing Services (OUCS). Throughout the session there will be detailed guidance on how both the management and resource clusters were designed, deployed [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Abstract</h1>
<p>Resiliency is a key aspect of any infrastructure—it is even more important in infrastructure-as-a-service solutions. This session will include a tour of a real world vCloud DR solution deployed at Oxford University Computing Services (OUCS). Throughout the session there will be detailed guidance on how both the management and resource clusters were designed, deployed and automated. Furthermore the details of how SRM in conjunction with VMware vSphereTM PowerCLI (PowerCLI) was used to automate the end-to-end recovery of a vCloud Director–based infrastructure. This session will offer a perfect complimentary follow on from the whitepaper regarding the high-level process produced by Duncan Epping and Chris Colotti and the Automation session by Alan Renouf and Aidan Dalgleish. The paper combined with the Automation session will describe the process and the automation principles whereas this session will describe a complete real world implementation.</p>
<h1>Presentation Materials</h1>
<p>The presentation materials for this session are available from the <a href="http://www.vmworld.com/docs/DOC-6223">VMworld 2012 Virtual Pavilion.</a></p>
<h1>Feedback</h1>
<p>Thank you to those of you that provided feedback. In the most part it seems like people enjoyed the sessions and found the content useful.  I wanted to take the opportunity to thank people for their feedback and make it clear I have read all of the comments provided and will take this in to consideration for future versions of this presentation or anything similar in nature.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://vcloudscape.com/2013/03/27/inf-bco2155-vcloud-disaster-recovery-for-oxford-university-real-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">405</post-id>	</item>
		<item>
		<title>INF-VSP2164 Automation of vCloud Director Disaster Recovery</title>
		<link>http://vcloudscape.com/2012/11/20/inf-vsp2164-automation-of-vcloud-dr/</link>
					<comments>http://vcloudscape.com/2012/11/20/inf-vsp2164-automation-of-vcloud-dr/#respond</comments>
		
		<dc:creator><![CDATA[Aidan Dalgleish]]></dc:creator>
		<pubDate>Tue, 20 Nov 2012 13:11:37 +0000</pubDate>
				<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VMworld 2012]]></category>
		<guid isPermaLink="false">http://vcloudscape.com/?p=354</guid>

					<description><![CDATA[Abstract Resiliency is a key aspect of any infrastructure—it is even more important in infrastructure-as-a-service solutions. This session will include guidance, examples and demonstrations of the use of VMware vSphereTM PowerCLI (PowerCLI) to automate the recovery of a vCloud Director–based infrastructure. In particular the session will focus on the automation of the recovery steps for [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Abstract</h1>
<p>Resiliency is a key aspect of any infrastructure—it is even more important in infrastructure-as-a-service solutions. This session will include guidance, examples and demonstrations of the use of VMware vSphere<sup>TM</sup> PowerCLI (PowerCLI) to automate the recovery of a vCloud Director–based infrastructure. In particular the session will focus on the automation of the recovery steps for vCloud Director managed vApp workloads, that cannot be recovered with vSphere Site Recovery Manager (SRM). This session will offer a perfect complimentary follow on from the whitepaper regarding the high-level process released by Duncan Epping and Chris Colotti. The paper discussed the process and this session will describe the automation.</p>
<h1>Presentation Materials</h1>
<p>Whilst the presentation materials for this session should have already been released, I’m conscious that this is in the form of a .pdf and hence does not include the recorded demonstration videos.  Furthermore I recognise that the PowerCLI code included was in the form of an image and not text that can easily be leveraged.  In light of this I wanted to take opportunity to release these materials in a format that can be consumed more easily.</p>
<p>The original presentation, including the VMworld recording is available from the <a href="http://www.vmworld.com/docs/DOC-6295">VMworld 2012 Virtual Pavilion</a>.</p>
<p>Within the presentation we covered a selection of key functions used to automate the recovery of vCloud Director, including:</p>
<ul>
<li>Mount-VmfsVolumes</li>
<li>Disable-VMwareHA</li>
<li>Exit-MaintenanceMode</li>
<li>Register-VirtualMachines</li>
<li>Start-vShieldEdge</li>
<li>Find-ProviderVdc</li>
<li>Find-OrganizationVdc</li>
<li>Find-VApps</li>
<li>Set-OptionVaules</li>
<li>PowerOn-VApp</li>
</ul>
<p>In conjunction with the PowerCLI code for each of the above function I&#8217;ve added some brief explanation around the purpose of each function.</p>
<h3>Mount-VmfsVolumes</h3>
<p>Following successful use of your storage management utility to break replication and make volumes read/write (if required by storage platform), virtual machines will appear ‘Inactive’ in the vCenter Server inventory. To rectify this, replicated VMFS volumes need to be force mounted by the recovery hosts.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/d9a00207-600c-40c8-a02a-5f4e12cc3baf/embed" height="390" width="625" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function Mount-VmfsVolumes ($ClusterName, $EsxUser, $EsxPassword){
    $Cluster = Get-Cluster -Name $ClusterName
    $AvailVMHosts = $Cluster | Get-VMHost | where {($_.ConnectionState -eq &quot;Maintenance&quot;)}
    $AvailVMHosts | Get-VMHostStorage -RescanAllHba | Out-Null
    foreach ($AvailVMHost in $AvailVMHosts){
        Connect-VIServer -Server $AvailVMHost.Name -User $EsxUser -Password $EsxPassword | Out-Null
        $VMHost = Get-VMHost -Server $AvailVMHost.Name
        $HstSys = Get-View $VMHost.id
        $HstStSys = Get-view $VMHost.StorageInfo
        $HstDsSys = Get-View $HstSys.ConfigManager.DatastoreSystem
        $UnresVols = $HstDsSys.QueryUnresolvedVmfsVolumes()
        foreach ($UnresVol in $UnresVols){
            $DevicePaths = New-Object System.Collections.ArrayList
            $Extents = $UnresVol.Extent
            $Extents | Foreach {
                $DevicePath = $_.DevicePath
                $DevicePaths += $DevicePath
            }
            $VmfsResSpec = New-Object Vmware.Vim.HostUnresolvedVmfsResolutionSpec[](1)
            $VmfsResSpec[0] = New-Object Vmware.Vim.HostUnresolvedVmfsResolutionSpec
            $VmfsResSpec[0].ExtentDevicePath = $DevicePaths
            $VmfsResSpec[0].UuidResolution = “forceMount”
            $HstStSys.ResolveMultipleUnresolvedVmfsVolumes($VmfsResSpec) | Out-Null
        }
        Disconnect-VIServer -Server $AvailVMHost.Name -Confirm:$false | Out-Null
    }
}
</pre>
<h3>Disable-VMwareHA</h3>
<p>Following the successful mounting of replicated VMFS volumes, there is a requirement to take the recovery ESXi Server hosts out of maintenance mode for the vCloud Director resource cluster. If there is an intention to use the vCloud Director API to initiate vApp PowerOn operations (in order to honour any defined power sequence) then we must first disable VMware HA in order to prevent virtual machines being powered on automatically.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/37ab94a0-4edc-4391-9dbe-c0a74015c9fc/embed" height="390" width="625" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function Disable-VMwareHA ($ClusterName){
    $Cluster = Get-Cluster -Name $ClusterName
    $Cluster | Set-Cluster –HARestartPriority Disabled –Confirm:$false | Out-Null
}
</pre>
<h3>Exit-MaintenanceMode</h3>
<p>Having made the decision regarding the use of VMware HA the recovery ESXi Server hosts need to be removed from Maintenance Mode.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/8eafc33f-917c-4f9b-b4af-65f131a7385a/embed" height="390" width="625" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function Exit-MaintenceMode ($ClusterName){
    $Cluster = Get-Cluster -Name $ClusterName
    $Cluster | Get-VMHost -State Maintenance | Set-VMHost –State Connected  | Out-Null
}
</pre>
<h3>Register-VirtualMachines</h3>
<p>In the event that VMware HA is reconfigured to prevent virtual machines being powered on automatically, the associated consequence is that the virtual machines will remain ‘Inactive’ and require registering.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/eec9806d-4d21-4cfe-b131-9de680e3dfd6/embed" height="390" width="625" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function Register-VirtualMachines ($ClusterName, $EsxUser, $EsxPassword){
    $Cluster = Get-Cluster -Name $ClusterName
    $AvailVMHosts = $Cluster | Get-VMHost | where {$_.ConnectionState -eq &quot;Connected&quot;}
    $InActVms = $Cluster | Get-VM | where {$_.ExtensionData.OverallStatus -eq &quot;gray&quot;}
    $InActVmObjs = @()
    $InActVms | Foreach {
        $InActVmObj = New-Object -TypeName PSOBject -Property @{
            VmPathName = $_.ExtensionData.Config.Files.VmPathName
            VmName = $_.Name
            VmResourcePool = $_.ResourcePool
            VmMoRef = $_.Id
        }
        $InActVmObjs += $InActVmObj
     }
     foreach ($InActVmObj in $InActVmObjs){
         $RandVMHostIndex = Get-Random -Minimum 0 -Maximum ($AvailVMHosts | Measure-Object).Count
         $InActVmObj | Add-Member -MemberType NoteProperty -Name VmHostIndex -Value $RandVMHostIndex
     }
     $VMHostIndex = 0
     foreach ($AvailVMHost in $AvailVMHosts){
         Connect-VIServer -Server $AvailVMHost.Name -User $EsxUser -Password $EsxPassword | Out-Null
         $HstResPools = Get-ResourcePool -Server $AvailVMHost.Name
         $HstResPoolsCount = ($HstResPools | Measure-Object).Count
         $HstVmFolder = Get-Folder –Name vm -Server $AvailVMHost.Name
         $HstVmFolderRef = Get-View $HstVmFolder.Id
         $HstInActVmObjs = $InActVmObjs | where {$_.VmHostIndex -eq $VMHostIndex}
         foreach ($HstInActVmObj in $HstInActVmObjs){
             $VmPath = $HstInActVmObj.VmPathName
             $VmName = $HstInActVmObj.VmName
             $ResourcePool = $HstInActVmObj.VmResourcePool
             if ($HstResPoolsCount -gt 1){
                 $VmResPool = $HstResPools | where {$_.Name -eq $ResourcePool}
             }else{
                 $VmResPool = Get-ResourcePool -Server $AvailVMHost.Name
             }
             $VmResPoolRef = (Get-View $VmResPool.id).MoRef
             $HstVmFolderRef.RegisterVM($VmPath,$VmName,$false,$VmResPoolRef,$null)
         }
         $VMHostIndex ++
         Disconnect-VIServer -Server $AvailVMHost.Name -Confirm:$false
     }
}
</pre>
<h3>Start-vShieldEdge</h3>
<p>Even if a decision has been taken to use the vCloud Director API to power on virtual machines, this will not address vShield Edge appliances deployed on organization external routed networks. It is logical that the relatively low number of vShield Edge appliances supporting organization networks be started earlier, in order to support any connectivity to vApp external dependencies.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/c56750d3-9767-4dd1-b703-cf9e5dc53003/embed" height="390" width="625" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function Start-vShieldEdge ($ClusterName){
    $Cluster = Get-Cluster -Name $ClusterName
    $Cluster | Get-ResourcePool –Name “System vDC*” | Get-VM -Name &quot;vse-*&quot; | Start-VM | Out-Null
}
</pre>
<h3>Find-ProviderVdc</h3>
<p>Automation of this activity can range from being relatively simple to more complex, depending on the approach taken. This could be achieved manually in the form of a simple ‘mapping table’, however this section will highlight how this can be achieved dynamically.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/40e5bbce-f9d6-42a7-8e51-68ff1286534d/embed" height="390" width="625" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function Find-ProviderVdc ($ClusterName, $VcdServer, $VcdUser, $VcdPassword){
    $Cluster = Get-Cluster -Name $ClusterName
    $AvailVMHosts = $Cluster | Get-VMHost | where {$_.ConnectionState -eq &quot;Connected&quot;}
    $RefVMHost = $AvailVMHosts | Select -First 1
    Connect-CIServer -Server $VcdServer -User $VcdUser -Password $VcdPassword | Out-Null
    $Result = Search-Cloud -QueryType Host -Name $RefVMHost.Name
    $RefVMHostHref = (Get-CIView -SearchResult $Result).Href
    $Pvdcs = Get-ProviderVdc
    foreach ($Pvdc in $Pvdcs){
        foreach ($VMHost in $Pvdc.ExtensionData.HostReferences.HostReference){
            if ($VMHost.Href -eq $RefVMHostHref){
                $MatchedPvdc = $Pvdc
                Write-Host &quot;Match found in Provider vDC&quot; $MatchedPvdc.Name
            }
        }
    }
    Disconnect-CIServer -Server $VcdServer -Confirm:$false
}
</pre>
<h3>Find-OrganisationVdc</h3>
<p>In order to power on vApps we first need to understand which organization virtual datacenters are present and later which vApps they contain. Having previously determined the provider virtual datacenter the process for determining associated organization virtual datacenters is relatively simple.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/8e32dd55-beb5-4b61-9192-68e336a6b126/embed" height="390" width="625" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function Find-OrganisationVdc ($VcdServer, $VcdUser, $VcdPassword, $ProviderVdc){
    Connect-CIServer -Server $VcdServer -User $VcdUser -Password $VcdPassword | Out-Null
    $Ovdcs = Get-OrgVdc -ProviderVdc $ProviderVdc
    Disconnect-CIServer -Server $VcdServer -Confirm:$false
}
</pre>
<h3>Find-vApps</h3>
<p>Having previously determined the organization virtual datacenters the process for determining associated vApps is relatively simple.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/87ee379c-f405-4bde-8156-1720da760ecc/embed" height="311" width="625" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function Find-VApps ($VcdServer, $VcdUser, $VcdPassword, $OrganisationVdc){
    Connect-CIServer -Server $VcdServer -User $VcdUser -Password $VcdPassword | Out-Null
    $vApps = Get-CIVApp –OrgVdc $OrganisationVdc
    Disconnect-CIServer -Server $VcdServer -Confirm:$false
}
</pre>
<h3>Set-OptionValues</h3>
<p>When created virtual machines are assigned a UUID, derived from the physical ESXi Server host UUID and the path to the virtual machine configuration file. Although the process to mount VMFS volumes does not alter the path to the configuration file, the virtual machine will have been recovered on a different ESXi Server hosts. The result being that the constituent virtual machines of a vApp may be detected as being moved or copied.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/550d1a60-0e9f-4d17-8563-480790f72c76/embed" height="390" width="625" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function Set-OptionValues ($ClusterName, $Key, $Value){
    $Cluster = Get-Cluster -Name $ClusterName
    $VMs = $Cluster | Get-VM
    Foreach ($VM in $VMs){
        $VirtualMachineConfigSpec = new-object VMware.Vim.VirtualMachineConfigSpec
        $VirtualMachineConfigSpec.ExtraConfig += new-object VMware.Vim.OptionValue
        $VirtualMachineConfigSpec.ExtraConfig[0].key = $Key
        $VirtualMachineConfigSpec.ExtraConfig[0].value = $Value
        ($VM.ExtensionData).ReconfigVM_Task($VirtualMachineConfigSpec)
     }
}
</pre>
<h3>PowerOn-vApp</h3>
<p>Lastly, having identified the vApps for a given organization virtual datacenter, it is relatively simple to initiate a power on operation.</p>
<p><!-- copy and paste. Modify height and width if desired. --><iframe loading="lazy" style="overflow: hidden;" name="tsc_player" src="http://www.screencast.com/users/adalgleish/folders/Camtasia/media/6e6f67b0-ebe1-4262-815f-eb99bbd081e9/embed" height="390" width="625" frameborder="0" scrolling="no"></iframe></p>
<pre class="brush: powercli; title: Code Example (use at your own risk):; notranslate">
function PowerOn-VApp ($OrganisationVdc, $VcdServer, $VcdUser, $VcdPassword){
    Connect-CIServer -Server $VcdServer -User $VcdUser -Password $VcdPassword | Out-Null
    $vApps = Get-CIVApp –OrgVdc $OrganisationVdc | where {$_.Status -ne &quot;PoweredOn&quot;}
    Foreach ($vApp in $vApps){
        ($vApp.Extensiondata).PowerOn() | Out-Null
    }
}
</pre>
<h1>Feedback</h1>
<p>Thank you to those of you that provided feedback. In the most part it seems like people enjoyed the sessions and found the content useful.  I wanted to take the opportunity to thank people for their feedback and make it clear I have read all of the comments provided and will take this in to consideration for future versions of this presentation or anything similar in nature.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://vcloudscape.com/2012/11/20/inf-vsp2164-automation-of-vcloud-dr/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">354</post-id>	</item>
		<item>
		<title>PowerCLI in SRM Recovery Plan Steps</title>
		<link>http://vcloudscape.com/2012/09/28/powercli-in-srm-recovery-plan-steps/</link>
					<comments>http://vcloudscape.com/2012/09/28/powercli-in-srm-recovery-plan-steps/#respond</comments>
		
		<dc:creator><![CDATA[Aidan Dalgleish]]></dc:creator>
		<pubDate>Fri, 28 Sep 2012 14:57:03 +0000</pubDate>
				<category><![CDATA[Disaster Recovery]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[Site Recovery Manager]]></category>
		<guid isPermaLink="false">http://vcloudscape.com/?p=343</guid>

					<description><![CDATA[Introduction In recent months I’ve been involved in a project with Gary Blake to implement one of, if not the, first vCloud Director Disaster Recovery (DR) solution.  The design is based upon the solution described in the VMware vCloud Blogs written by Chris Colotti and Duncan Epping.  In order to provide a slick automated solution, [&#8230;]]]></description>
										<content:encoded><![CDATA[<h1>Introduction</h1>
<p>In recent months I’ve been involved in a project with <a href="http://vmland.blogspot.co.uk/">Gary Blake</a> to implement one of, if not the, first vCloud Director Disaster Recovery (DR) solution.  The design is based upon the solution described in the <a href="http://blogs.vmware.com/vcloud/2012/02/overview-of-disaster-recovery-in-vcloud-director.html">VMware vCloud Blogs</a> written by <a href="http://twitter.com/#!/ccolotti">Chris Colotti</a> and <a href="http://twitter.com/#!/duncanyb">Duncan Epping</a>.  In order to provide a slick automated solution, I was keen to leverage the power of Windows PowerShell (PowerShell) and VMware vSphere PowerCLI (PowerCLI).  Unsatisfied with the thought of manually running some basic scripts, I wanted VMware Site Recovery Manager (SRM) to drive the majority, if not all, of the recovery process.  Throughout this project a number of challenges arose in executing PowerCLI functions in order to achieve the desired result, so I thought I would share some details of the final approach used.</p>
<h1>The Challenge</h1>
<p>In order to use SRM to drive the automated recovery of vCloud Director Resource Clusters, it was decided to implement a series of additional Recovery Plan Steps.  These would execute PowerCLI functions that accept a series of parameters, including some of those available from the SRM Environment Variables (the <a href="http://www.vmware.com/pdf/srm_admin_5_0.pdf">Site Recovery Manager Administration Guide</a> contains further details).  If you were to search the internet on this subject you would undoubtedly find a large number of resources that suggest the solution is to; a) Call a PowerShell script using of a batch or ‘helper’ script, or b) Call a PowerShell script directly.  Whilst both approaches can fulfil the requirement, I wanted more!  I’ll explain why…</p>
<p>Using a batch script to call a PowerShell script works perfectly well but my issue with this approach was that SRM receives the exit code from the batch script and not the PowerShell script.  I.e. if the batch script successfully runs but the PowerShell script experiences an error, SRM will still interpret the exit code of 0 from the batch script and hence interpret the Recovery Plan Step as successfully completed – not the slick solution I had in mind.</p>
<p>Calling a PowerShell script directly addresses the issue of SRM receiving the relevant exit code, since if an error is triggered by the PowerShell script it will be picked up by SRM and the Recovery Plan Step will be marked as failed.  Problem Solved?  Nearly, but I still wanted something more!  Whilst this ultimately works, what I really wanted was the ability to call specific custom functions and in the process supply SRM Environment Variable as parameters.</p>
<h1>The Solution</h1>
<p>The end solution implemented was to provide the capability for SRM, through the use of additional Recovery Plan Steps, to call bespoke PowerShell Advanced Functions directly.  In order to achieve this some specific configuration steps are required.  We’ll cover these configurations steps in two stages; a) Calling PowerCLI Cmdlets from SRM, and b) Calling Advanced Functions from SRM.</p>
<h2>Calling PowerCLI Cmdlets from SRM</h2>
<p>The process for calling a PowerShell Cmdlet directly from SRM is relatively straight forward and effectively the same as that for calling a PowerShell script.  The specifics arise when there is a requirement to call a PowerCLI Cmdlet.  More specifically we need to ensure that the PowerCLI Cmdlets, that are distributed as a PowerShell Snapin, are loaded.  Assuming PowerShell and PowerCLI are already installed, the following steps provide an explanation of how this can be achieved:</p>
<ol>
<li>Create a dedicated user as a service account for SRM.  Configure the SRM service to run as this user.</li>
<li>Log on to the SRM Server, using the previously created service account</li>
<li>Open the 32bit PowerShell: <strong>Start &gt; Accessories &gt; Windows PowerShell &gt; Windows PowerShell (x86)</strong></li>
<li>Set the Execution Policy by typing: <strong><span style="font-family: Courier New;">Set-ExecutionPolicy RemoteSigned</span></strong></li>
<li><span style="color: #1c1c1c;">Find the path to the PowerShell Profile by typing: <strong><span style="font-family: Courier New;">$profile</span><span style="font-family: Arial;">.  </span></strong></span><span style="color: #1c1c1c;">Validate it exists by typing: <strong><span style="font-family: Courier New;">Test-Path $profile</span></strong></span></li>
<li>If the result was ‘False’, create a new profile by typing:<strong> <span style="font-family: Courier New;">New-Item -path $profile -type file –force</span></strong></li>
<li>Open the profile file by typing: <strong><span style="font-family: Courier New;">notepad $profile</span></strong></li>
<li><span style="color: #1c1c1c;">Configure the profile to load vSphere Cmdlets by adding: <strong><span style="font-family: Courier New;">Add-PSSnapin VMware.VimAutomation.Core</span></strong></span></li>
<li><span style="color: #1c1c1c;">Repeat step 8 for additional Cmdlets (e.g. vCloud Director) by adding: <strong><span style="font-family: Courier New;">Add-PSSnapin &lt;Snapin Name&gt;</span></strong></span><!--EndFragment--></li>
</ol>
<p>Upon completion of these configuration steps it will be possible to use an SRM Recovery Plan Step to execute any PowerCLI Cmdlets by selecting ‘Command on SRM Server’ and using the format <span style="font-family: Courier New;">C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Powershell.exe &lt;Cmdlet&gt; &lt;Params&gt;</span>.  This is shown in the example below:</p>
<p><a href="http://vcloudscape.com/wp-content/uploads/2012/09/image.png"><img loading="lazy" style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="image" alt="image" src="http://vcloudscape.com/wp-content/uploads/2012/09/image_thumb.png" width="500" height="200" border="0" /></a></p>
<h2>Calling Advanced Functions from SRM</h2>
<p>Having worked through the guidance provided in the previous ‘Calling PowerCLI Cmdlets from SRM’ section, you should have the capability to call PowerShell or PowerCLI Cmdlets (and Cmdlets for any other Snapins added) directly from an SRM Recovery Plan Step.  What you won’t yet be able to do is call any custom Advanced Functions you have created.  The following steps provide an explanation regarding how this can be achieved:</p>
<ol>
<li>Take the <span style="font-family: Courier New;"><strong>&lt;filename&gt;.ps1</strong></span> file containing the functions and create a module by renaming it <span style="font-family: Courier New;"><strong>&lt;filename&gt;.psm1</strong></span></li>
<li><span style="color: #1c1c1c;">Navigate to the directory <strong><span style="font-family: Courier New;">C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules</span></strong><br />
</span></li>
<li><span style="color: #1c1c1c;">Create a directory called <span style="font-family: Courier New;"><strong>&lt;filename&gt;</strong></span>, then copy the PowerS</span><span style="color: #1c1c1c;">hell module file</span>to the directory</li>
<li>Open the 32bit PowerShell: <strong>Start &gt; Accessories &gt; Windows PowerShell &gt; Windows PowerShell (x86)</strong></li>
<li>Type <span style="font-family: Courier New;"><strong>Get-Module –ListAvailable</strong></span>and verify that your new module is present</li>
<li>Open the profile file by typing: <strong><span style="font-family: Courier New;">notepad $profile</span></strong></li>
<li>Configure the profile file to load the new module by adding: <span style="font-family: Courier New;"><strong>Import-Module &lt;filename&gt;</strong></span></li>
</ol>
<p>Upon completion of these configuration steps it will be possible to use an SRM Recovery Plan Step to execute PowerCLI functions.  Furthermore, assuming you’ve written them correctly (a subject for another post I think…), then you will also receive the relevant exit codes to indicate if the SRM Recovery Plan Step should be marked as successful or failed.  In order to execute a custom Advanced Function simply select ‘Command on SRM Server’ and use the format <span style="font-family: Courier New;">C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Powershell.exe &lt;Function&gt; &lt;Params&gt;</span>. This is shown in the example below:</p>
<p><a href="http://vcloudscape.com/wp-content/uploads/2012/09/image1.png"><img loading="lazy" style="background-image: none; padding-left: 0px; padding-right: 0px; display: block; float: none; margin-left: auto; margin-right: auto; padding-top: 0px; border-width: 0px;" title="image" alt="image" src="http://vcloudscape.com/wp-content/uploads/2012/09/image_thumb1.png" width="500" height="227" border="0" /></a></p>
<h3>Implementation Tips</h3>
<p>In addition to the implementation steps covered so far there are a few additional pointers worth mentioning that will save you some frustration.  In particular I’m referring to the use of single vs double quotes and how to use the SRM Environment Variables as parameters.</p>
<p>Firstly, if you are having issues with calling any function the best course of action (apologies if I’m ‘teaching you to suck eggs’) is to first run your function on the command line and then transpose it in to the SRM Recovery Plan Step and add the Environment Variables etc…  If you are still having issue then alter your problematic function such that it writes any supplied parameters to a log file, such that you confirm if they are being interpreted correctly. You’ll notice in the above example that various parameters, such as path names, are passed in double quotes and in the most part this works fine, however on some occasions you may find that the value is not passed correctly and some ‘tweaking’ is required.  As a general rule I would recommend the following approach:</p>
<ul>
<li>In the first instance do not use any quotes – You’ll soon recognise if this is an issue as the PowerShell function will throw an error with respect to the parameters.  I.e. The value of the supplied argument to a given parameter is actually being interpreted as a parameter, which is undefined.</li>
<li>In cases where a given argument is causing an error (path names being a good example) then surround the argument in double quotes.</li>
<li>Finally if you function is still generating an error or the value of the given argument is being interpreted incorrectly try using single quotes.  This generally seemed to rectify issues where a given argument contained a space or special character.</li>
</ul>
<p>Lastly, in the event you are attempting to pass SRM Environment Variables, you may find that the environment variable is interpreted literally.  In these cases the solution, as can been seen in the above screen shot for the value %<span style="font-family: Courier New;">VMware_VC_Host%</span>, is to use the <span style="font-family: Courier New;">Get-Content</span> Cmdlet.  For example replace the normal SRM Environment Variable with <span style="font-family: Courier New;"><strong>(Get-Content env:VMware_VC_Host)</strong><span style="font-family: Arial;"><strong>. </strong>Credit due to <a href="https://twitter.com/garyjblake">Gary Blake</a> for figuring this one out.</span></span></p>
<h1>Conclusion</h1>
<p>With the application of some simple configuration steps and some well considered scripting it is possible to use SRM to execute PowerShell advanced functions, that could be used to perform all manner of custom tasks for those more complex disaster recovery solutions.  For instance, in the second example above an advanced function is being called to check the status of a defined service within a Microsoft Windows guest operating system and report back a success or fail (exit 0 or 1).  Now what would be really nice would be the ability for SRM to perform a defined action based on the exit code…</p>
]]></content:encoded>
					
					<wfw:commentRss>http://vcloudscape.com/2012/09/28/powercli-in-srm-recovery-plan-steps/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">343</post-id>	</item>
	</channel>
</rss>
