<?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/"
	>

<channel>
	<title>VMstore Archives - LucD notes</title>
	<atom:link href="https://www.lucd.info/tag/vmstore/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.lucd.info/tag/vmstore/</link>
	<description>My PowerShell ramblings</description>
	<lastBuildDate>Wed, 20 Aug 2014 14:01:04 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.lucd.info/wp-content/uploads/2018/12/cropped-120px-Tibetan_Dharmacakra-32x32.png</url>
	<title>VMstore Archives - LucD notes</title>
	<link>https://www.lucd.info/tag/vmstore/</link>
	<width>32</width>
	<height>32</height>
</image> 
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>Tintri Automation Toolkit – Part 2 &#8211; VM Protection and Reporting</title>
		<link>https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/</link>
					<comments>https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/#respond</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Wed, 20 Aug 2014 14:01:02 +0000</pubDate>
				<category><![CDATA[Module]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Tintri]]></category>
		<category><![CDATA[Tintri Automation Toolkit]]></category>
		<category><![CDATA[VMstore]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=4774</guid>

					<description><![CDATA[After Part 1 &#8211; The Basics in this series, I will show in [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>After <a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/" target="_blank">Part 1 &#8211; The Basics</a> in this series, I will show in Part 2 how you can set up Tintri’s VM <strong>Protection</strong> through <strong>Replication</strong>. And to conclude this post I will show some<strong> Reporting</strong> that you can do with the <strong>Tintri Automation Toolkit</strong>.</p>
<p style="text-align: center;"><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/ps-pcl-tintri/" rel="attachment wp-att-4757"><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4757" src="https://lucd.info/wp-content/uploads/2014/08/PS-PCL-Tintri.png" alt="PS-PCL-Tintri" width="400" height="400" srcset="https://www.lucd.info/wp-content/uploads/2014/08/PS-PCL-Tintri.png 400w, https://www.lucd.info/wp-content/uploads/2014/08/PS-PCL-Tintri-150x150.png 150w, https://www.lucd.info/wp-content/uploads/2014/08/PS-PCL-Tintri-300x300.png 300w" sizes="(max-width: 400px) 100vw, 400px" /></a></p>
<p><span id="more-4774"></span></p>
<h2>VM Protection with per-VM replication</h2>
<p>One of the great features of Tintri VMstore is <strong>per-VM replication</strong> and the ease of setting up such replication for a VM between multiple VMstores.</p>
<p>The concept is quite simple:</p>
<ul>
<li>Schedule snapshots of the VM</li>
<li>Specify where to replicate the VM</li>
</ul>
<p>Instead of doing this through the <strong>VMstore Dashboard</strong>, we can now do this with the Tintri module Cmdlets. This means that can you now set up <strong>Replication</strong> as part of your <strong>automated VM deployment</strong> process.</p>
<p>The following script sets up replication for a specific VM.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$vm = Get-TintriVM -Name $vmName

$tvmSnapSched = @{
   VM = $vm
   SnapshotScheduleType = [Tintri.Windows.RA.V110.Dto.VirtualMachineSnapshotScheduleType]::HOURLY
   MinuteOnTheHour = &quot;17&quot;
   SnapshotConsistency = &quot;CRASH_CONSISTENT&quot;
   RetentionHoursLocal = 2
   RetentionHoursRemote = 2
}

$sched = New-TintriVMSnapshotSchedule @tvmSnapSched
Set-TintriVMSnapshotSchedule -VM $vm -SnapshotSchedule $sched

$rpPref = &quot;ll-t540-02 (10GbE)&quot;
$rp = Get-TintriDatastore | Get-TintriDatastoreReplPath | where {$_.DisplayName -eq $rpPref}

New-TintriVMReplConfiguration -VM $vm -DatastoreReplPath $rp</pre><p></p>
<p>&nbsp;</p>
<p>The Snapshot schedule that is created will take a snapshot every hour and retains the last snapshots.</p>
<p>The replication path (a combination of the source IP address/port and the destination IP address/port) is selected based on the path name, which is user defined as the VMstore administrator creates the path.</p>
<p>When the above script is executed replication for the VM becomes active. We can easily check this through a PowerShell script.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-TintriVMReplConfiguration -VM $vm
Get-TintriVMSnapshotSchedule -VM $vm | where {$_.RetentionSourceMinutes -eq 120}</pre><p></p>
<p>The output</p>
<p><a href="https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/tintri-replica-running/" rel="attachment wp-att-4778"><img decoding="async" class="alignnone size-full wp-image-4778" src="https://lucd.info/wp-content/uploads/2014/08/tintri-replica-running.png" alt="tintri-replica-running" width="818" height="323" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-replica-running.png 818w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-replica-running-300x118.png 300w" sizes="(max-width: 818px) 100vw, 818px" /></a></p>
<p>We can of course also check that the replication setup is functioning via the <strong>Dashboard</strong>.</p>
<p><a href="https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/tintri-replica-dashboard/" rel="attachment wp-att-4779"><img decoding="async" class="alignnone size-full wp-image-4779" src="https://lucd.info/wp-content/uploads/2014/08/tintri-replica-dashboard.png" alt="tintri-replica-dashboard" width="952" height="182" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-replica-dashboard.png 952w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-replica-dashboard-300x57.png 300w" sizes="(max-width: 952px) 100vw, 952px" /></a></p>
<p>The snapshotting uses the schedule we provided.</p>
<p><a href="https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/tintri-snapshot-schedule/" rel="attachment wp-att-4780"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4780" src="https://lucd.info/wp-content/uploads/2014/08/tintri-snapshot-schedule.png" alt="tintri-snapshot-schedule" width="698" height="373" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-snapshot-schedule.png 698w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-snapshot-schedule-300x160.png 300w" sizes="auto, (max-width: 698px) 100vw, 698px" /></a></p>
<p>On the source VMstore we see that the Replica is created.</p>
<p><a href="https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/tintri-replica-source/" rel="attachment wp-att-4781"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4781" src="https://lucd.info/wp-content/uploads/2014/08/tintri-replica-source.png" alt="tintri-replica-source" width="964" height="189" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-replica-source.png 964w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-replica-source-300x58.png 300w" sizes="auto, (max-width: 964px) 100vw, 964px" /></a></p>
<p>On the destination VMstore we see the snapshots of the VM.</p>
<p><a href="https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/tintri-replica-destination/" rel="attachment wp-att-4782"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4782" src="https://lucd.info/wp-content/uploads/2014/08/tintri-replica-destination.png" alt="tintri-replica-destination" width="952" height="274" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-replica-destination.png 952w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-replica-destination-300x86.png 300w" sizes="auto, (max-width: 952px) 100vw, 952px" /></a></p>
<h2>Reporting with the Tintri Automation Toolkit</h2>
<p>Part of an administrator’s job, is to produce regular status reports on the environments he or she manages. The Tintri Automation Toolkit comes loaded with a number of Cmdlets that allow for retrieving status information through PowerShell scripts.</p>
<p>Just a few examples below.</p>
<p>This script provides the status of both controllers on a VMstore (which has redundant controllers) and their components.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$appl = Get-TintriAppliance -TintriServer $srv1
foreach($controller in $appl.Controllers){
   $controller.Components | Select @{N=&quot;Controller&quot;;E={$controller.Locator}},
      @{N=&quot;Controller Role&quot;;E={$controller.Role}},
      @{N=&quot;Controler State&quot;;E={$controller.State}},
      @{N=&quot;Component&quot;;E={$_.Locator}},
      @{N=&quot;Status&quot;;E={$_.Status}} | Format-Table -AutoSize
}</pre><p></p>
<p>The script produces the following output</p>
<p><a href="https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/tintri-report-controller/" rel="attachment wp-att-4783"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4783" src="https://lucd.info/wp-content/uploads/2014/08/tintri-report-controller.png" alt="tintri-report-controller" width="622" height="564" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-report-controller.png 622w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-report-controller-300x272.png 300w" sizes="auto, (max-width: 622px) 100vw, 622px" /></a></p>
<p>The following script provides location and type of the disks in a VMstore.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$appl = Get-TintriAppliance -TintriServer $srv1
$appl.Disks | Select   Locator,State,Type | Format-Table -AutoSize</pre><p></p>
<p><a href="https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/tintri-report-diskstate/" rel="attachment wp-att-4784"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4784" src="https://lucd.info/wp-content/uploads/2014/08/tintri-report-diskstate.png" alt="tintri-report-diskstate" width="343" height="275" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-report-diskstate.png 343w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-report-diskstate-300x240.png 300w" sizes="auto, (max-width: 343px) 100vw, 343px" /></a></p>
<p>With the <strong>Get-TintriDashboard</strong> cmdlet you have access to the same information that is displayed in the Dashboard web interface.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-TintriDashboard -HostName $srv1.ApplianceHostName |
Select Model,ApplianceVersion,Uptime,FlashHitPercent,TotalLatency,SpaceFreeGib,SpaceTotalGib</pre><p></p>
<p><a href="https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/tintri-report-dashboard/" rel="attachment wp-att-4785"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4785" src="https://lucd.info/wp-content/uploads/2014/08/tintri-report-dashboard.png" alt="tintri-report-dashboard" width="379" height="118" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-report-dashboard.png 379w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-report-dashboard-300x93.png 300w" sizes="auto, (max-width: 379px) 100vw, 379px" /></a></p>
<p>And my favorite, access to all kinds of performance figures through the <strong>Get-TintriDatastoreStat</strong> and <strong>Get-TintriVMStat</strong> Cmdlets.</p>
<p>The following script, for example, extracts the latency counters for a specific VM, and then uses the <a href="https://www.lucd.info/2013/01/03/export-xls-the-sequel-and-ordered-data/">Export-Xlsx</a> function to produce a spreadsheet with a chart included.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-TintriVM -Name $vmName |
Get-TintriVMStat -IncludeHistoricStats |
Select TimeStartMs,LatencyHostMs,LatencyNetworkMs,LatencyStorageMs,LatencyDiskMs |
Export-Csv report.csv -NoTypeInformation</pre><p></p>
<p>The resulting spreadsheet looks something like this</p>
<p><a href="https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/tintri-report-performance/" rel="attachment wp-att-4786"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4786" src="https://lucd.info/wp-content/uploads/2014/08/tintri-report-performance.png" alt="tintri-report-performance" width="956" height="647" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-report-performance.png 956w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-report-performance-300x203.png 300w" sizes="auto, (max-width: 956px) 100vw, 956px" /></a></p>
<p>Note that a VMstore keeps 7 days of statistical data, each sample for a 10 minute interval. These are the same exact graphs available from the VMstore UI.</p>
<p>The chart was produced with the <a href="https://www.lucd.info/2013/01/03/export-xls-the-sequel-and-ordered-data/">Export-Xlsx</a> function.</p>
<h2>Conclusion</h2>
<p>In conclusion, this 1st version of the <strong>Tintri Automation Toolkit</strong> brings an extensive set of Cmdlets to manage your Tintri VMstore(s). If you want to automate your VMstore actions, I will definitely advise to give the Tintri Automation Toolkit a try.</p>
<p>Thanks to all the good people at Tintri who gave me the opportunity and access to their lab to explore the Tintri Automation module.</p>
<p>Enjoy !</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2014/08/20/tintri-automation-toolkit-vm-protection-and-reporting-part-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Tintri Automation Toolkit &#8211; Part 1 &#8211; The Basics</title>
		<link>https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/</link>
					<comments>https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/#comments</comments>
		
		<dc:creator><![CDATA[LucD]]></dc:creator>
		<pubDate>Thu, 14 Aug 2014 14:01:15 +0000</pubDate>
				<category><![CDATA[Module]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Tintri]]></category>
		<category><![CDATA[Tintri Automation Toolkit]]></category>
		<category><![CDATA[VMstore]]></category>
		<guid isPermaLink="false">http://www.lucd.info/?p=4755</guid>

					<description><![CDATA[There are numerous companies that recognized the usefulness of PowerShell, and how it [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>There are numerous companies that recognized the usefulness of PowerShell, and how it can help automate their product. The PowerCLI PSSnapin from VMware is a great example.</p>
<p>And now Tintri, the creators of the VMstore, have joined the ranks. Tintri delivers a PowerShell module, called the <strong>Tintri Automation Toolkit</strong>, that allows administrators to automate the monitoring and management of a <strong>VMstore</strong> system. The Toolkit also nicely leverages PowerShell constructs such as object piping for enabling end-to-end VM-level automation.</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/ps-pcl-tintri/" rel="attachment wp-att-4757"><img loading="lazy" decoding="async" class="wp-image-4757 size-medium aligncenter" src="https://lucd.info/wp-content/uploads/2014/08/PS-PCL-Tintri-300x300.png" alt="PS-PCL-Tintri" width="300" height="300" srcset="https://www.lucd.info/wp-content/uploads/2014/08/PS-PCL-Tintri-300x300.png 300w, https://www.lucd.info/wp-content/uploads/2014/08/PS-PCL-Tintri-150x150.png 150w, https://www.lucd.info/wp-content/uploads/2014/08/PS-PCL-Tintri.png 400w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a>These posts will not be providing a detailed description of the VMstore, and all its merits. There are ample other sources available for that. Needless to say you should definitely have a look at the <a href="https://www.tintri.com/">Tintri website</a> if you want to learn more about the <strong>VMstore</strong>. I listed a couple of other sources at the end of the series.</p>
<p>I was given the opportunity to have a preview of the of the <strong>Tintri Automation Toolkit</strong> module, and was permitted to play around with the cmdlets in the <strong>Tintri lab</strong>.</p>
<p>To take away all suspense, I was quite impressed!</p>
<p><span id="more-4755"></span></p>
<h1>The Basics</h1>
<p>Note that I was experimenting with a <strong>pre-release</strong> version of the Tintri module, so some names, parameters and methods might change slightly when the Tintri Automation Toolkit goes GA.</p>
<p>When you start the Tintri PowerShell Toolkit you are greeted with a PowerShell Command window that looks something like this.</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/welcome-window/" rel="attachment wp-att-4758"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4758" src="https://lucd.info/wp-content/uploads/2014/08/Welcome-window.png" alt="Welcome-window" width="676" height="341" srcset="https://www.lucd.info/wp-content/uploads/2014/08/Welcome-window.png 676w, https://www.lucd.info/wp-content/uploads/2014/08/Welcome-window-300x151.png 300w" sizes="auto, (max-width: 676px) 100vw, 676px" /></a></p>
<p>You can of course also load the Toolkit inside your own PowerShell or PowerShell ISE session, with the</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Import-module -Name TintriPowershellToolkit</pre><p></p>
<p>command. Be sure to check the name of the Tintri module, it might change from the <strong>preview version</strong> I have been using.</p>
<p>The Tintri module currently weighs in at <strong>47</strong> cmdlets.</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/tintri-cmdlets-group/" rel="attachment wp-att-4759"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4759" src="https://lucd.info/wp-content/uploads/2014/08/tintri-cmdlets-group.png" alt="tintri-cmdlets-group" width="961" height="224" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-cmdlets-group.png 961w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-cmdlets-group-300x69.png 300w" sizes="auto, (max-width: 961px) 100vw, 961px" /></a></p>
<p>Setting up a session with a Tintri VMstore is quite simple. Just pass the name you use for the Tintri VMstore and a user/password combo.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Connect-TintriServer -Server &quot;Store1&quot; -UserName user -Password password</pre><p></p>
<p>Or with a PSCredential.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$user = &quot;user&quot;
$pswd = &quot;password&quot;

$cred = New-Object -Typename System.Management.Automation.PSCredential `
        -ArgumentList $user,($pswd | ConvertTo-SecureString -AsPlainText -Force)

Connect-TintriServer -Server &quot;Store1&quot; -Credential $cred</pre><p></p>
<p>Be aware that the Tintri module has a minimum requirement on the VMstore to which you want to connect. The VMstore must be running the <strong>Tintri OS 3.0 (which is GA now)</strong>, or later.</p>
<p>The Tintri module uses a <strong>default</strong> VMstore concept. The first VMstore you connect to will be the <strong>default</strong> server. All Tintri Cmdlets, that do not specify an explicit Tintri server, will run against the <strong>default</strong> VMstore.</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/tintri-connect/" rel="attachment wp-att-4760"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4760" src="https://lucd.info/wp-content/uploads/2014/08/tintri-connect.png" alt="tintri-connect" width="796" height="219" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-connect.png 796w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-connect-300x82.png 300w" sizes="auto, (max-width: 796px) 100vw, 796px" /></a></p>
<p>The VMstores you are connected to, are stored in the <strong>$global:TintriServers</strong> variable.</p>
<p>You can run a cmdlet against a specific VMstore by using the <strong>TintriServer</strong> parameter, which is available on most Cmdlets in the Tintri module.</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/tintri-connect-global/" rel="attachment wp-att-4761"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4761" src="https://lucd.info/wp-content/uploads/2014/08/tintri-connect-global.png" alt="tintri-connect-global" width="813" height="325" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-connect-global.png 813w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-connect-global-300x119.png 300w" sizes="auto, (max-width: 813px) 100vw, 813px" /></a></p>
<p>While I was exploring the Tintri module, I connected to multiple VMstores. The following lines were handy when I needed to reset all open connections and wanted to start with a “fresh” set up.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$TintriSrv1 = &quot;ll-t540-01&quot;
$TintriSrv2 = &quot;ll-t540-02&quot;
$vCenter = &quot;ll-vcenter&quot;

$user = &quot;user&quot;
$pswd = &quot;password&quot;

$cred = New-Object -Typename System.Management.Automation.PSCredential `
      -ArgumentList $user,($pswd | ConvertTo-SecureString -AsPlainText -Force)

Disconnect-TintriServer -All -Force | Out-Null

$srv1 = Connect-TintriServer -Server $TintriSrv1 -Credential $cred
$srv2 = Connect-TintriServer -Server $TintriSrv2 -Credential $cred</pre><p></p>
<p>The script first closes all open connections, and then connects to 2 VMstores. The first connection, in this case $TintriSrv1 will become the “default” connection.</p>
<h1>PowerCLI Integration</h1>
<p>The Tintri module allows for easy integration with the PowerCLI PSSnapin.</p>
<p>You can use objects returned by a PowerCLI cmdlet, as input for a Tintri module cmdlet.</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/tintri-powercli-integration-1/" rel="attachment wp-att-4762"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4762" src="https://lucd.info/wp-content/uploads/2014/08/tintri-powercli-integration-1.png" alt="tintri-powercli-integration-1" width="706" height="116" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-powercli-integration-1.png 706w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-powercli-integration-1-300x49.png 300w" sizes="auto, (max-width: 706px) 100vw, 706px" /></a></p>
<p>In this example we get a PowerCLI <strong>VirtualMachine</strong> object, by using the “Get-VM” cmdlet to query the vSphere Server, and use the returned object as input to a Tintri cmdlet.</p>
<p>The help for the <strong>Get-TintriVM</strong> cmdlet shows that we can pass a VirtualMachine object over the pipeline.</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/tintri-powercli-2/" rel="attachment wp-att-4763"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4763" src="https://lucd.info/wp-content/uploads/2014/08/tintri-powercli-2.png" alt="tintri-powercli-2" width="929" height="183" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-powercli-2.png 929w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-powercli-2-300x59.png 300w" sizes="auto, (max-width: 929px) 100vw, 929px" /></a></p>
<h1>Using VMstore Features</h1>
<h2>Cloning</h2>
<p>The VMstore offers the option to clone a VM. This method, since it is performed by the VMstore, is considerable faster than a VM clone done through vCenter, as it leverages native Tintri per-VM clones.</p>
<p>The code to create such a clone looks like this</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$vm = Get-VM -Name $vmSource

# Get hostresource
$hr = Get-TintriVM -VM $vm | Get-TintriVirtualHostResource -FilterByPreferredOnly

$start = Get-Date
$task = New-TintriVMClone -SourceVMName $vmSource -NewVMCloneName $vmDestination -VMHostResource $hr
while($task.State -eq &quot;Running&quot;){
   $task = Get-TintriTaskStatus -TintriTask $task
   sleep 1
}

$finish = Get-Date
$task | Select State,ProgressDescription,
   @{N=&quot;Duration&quot;;E={New-TimeSpan -Start $start -End $finish | Select -ExpandProperty Seconds}}</pre><p></p>
<p>With the <strong>Get-TintriVirtualHostResource</strong> you specify to which VMHost in the vSphere environment the VM shall be cloned, and to which VMHost the new VM shall be registered.</p>
<p>Also note how you use the Task object, that is returned by the New-VMTintriClone cmdlet, as input to the <strong>Get-TintriTaskStatus</strong> cmdlet. This way you can monitor the execution of the clone process.</p>
<p>In the same way you can clone up to <strong>500 VMs at a time</strong>. For that you will have to use the <strong>New-TintriCloneMany</strong> cmdlet.</p>
<p>The Tintri Toolkit also offers a cmdlet, called <strong>New-TintriVMNameSequence</strong>, that allows you to specify how these cloned VMs shall be named.</p>
<p>A sample script</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$hr = Get-TintriVM -VM $vm | Get-TintriVirtualHostResource -FilterByPreferredOnly

$nameSplat = @{
   PrefixText = &quot;Clone&quot;
   SuffixText = &quot;Luc&quot;
   DigitStartValue = 7
   DigitPlaceHolderCount = 2
   VMCount = 4
   IncrementStepValue = 2
}

$tnSeq = New-TintriVMNameSequence @nameSplat

$cloneSplat = @{
   SourceVMName = $vmSource
   NewVMNameSequence = $tnSeq
   VMHostResource = $hr
   CloneCount = 3
}

$task = New-TintriVMCloneMany @cloneSplat</pre><p></p>
<p>The resulting VMs, 3 in total will have a <strong>DisplayName</strong> as defined with the New-TintriVMNameSequence cmdlet.</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/tintri-clone/" rel="attachment wp-att-4764"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4764" src="https://lucd.info/wp-content/uploads/2014/08/tintri-clone.png" alt="tintri-clone" width="647" height="87" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-clone.png 647w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-clone-300x40.png 300w" sizes="auto, (max-width: 647px) 100vw, 647px" /></a></p>
<p>Note that the <strong>New-TintriCloneMany</strong> cmdlet returns an <strong>array</strong> of Task objects. You can use these in the same way to monitor the status of each individual clone process. Note also that the clone VMs take up no additional space (Used Space = 0.00 B) as they are created.</p>
<h2>Snapshots</h2>
<p>Tintri VMstore provides the ability to create space efficient snapshots of a VM for data protection and for disaster recovery (by replicating to a second VMstore). You can create such Snapshots manually or schedule them.</p>
<h3>Manual</h3>
<p>The manual creation of a Snapshot is done as follows.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">New-TintriVMSnapshot -VM $vm -SnapshotDescription &quot;Snap1&quot;</pre><p></p>
<p>The check the creation of the snapshot, you can do</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-TintriVMSnapshot -VM $vm -SnapshotDescription &quot;Snap1&quot;</pre><p></p>
<p>The returned object</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/tintri-snapshot-manual/" rel="attachment wp-att-4765"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4765" src="https://lucd.info/wp-content/uploads/2014/08/tintri-snapshot-manual.png" alt="tintri-snapshot-manual" width="636" height="244" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-snapshot-manual.png 636w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-snapshot-manual-300x115.png 300w" sizes="auto, (max-width: 636px) 100vw, 636px" /></a></p>
<p>The creation of a VMstore snapshot offers some more options.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$snapSplat = @{
   VM = $vm
   SnapshotDescription = &quot;Snap2&quot;
   SnapshotConsistency = [Tintri.Windows.RA.V110.Dto.SnapshotConsistency]::CRASH_CONSISTENT
   RetentionMinutes = 120
}

New-TintriVMSnapshot @snapSplat</pre><p></p>
<p>Note that I used <a href="https://technet.microsoft.com/en-us/magazine/gg675931.aspx">splatting</a> in this example. It is a handy way to avoid long Cmdlet lines.</p>
<p>The Snapshot consistency provides 2 options, CRASH_CONSISTENT and VM_CONSISTENT. See the <strong>Tintri VMstore System Administration Manual</strong> for more information on these 2 options.</p>
<p>A handy feature, in my opinion, is the <strong>Retention time</strong> you can define for a Snapshot. It should avoid those “forgotten” snapshots that tend to pollute our Datastores. Note that the minimum value is 2 hours.</p>
<h3>Scheduled</h3>
<p>The scheduled creation of Snapshots requires the creation of a Schedule. This can be done as follows.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$tvmSnapSched = @{
   SnapshotScheduleType = [Tintri.Windows.RA.V110.Dto.VirtualMachineSnapshotScheduleType]::HOURLY
   MinuteOnTheHour = &quot;17&quot;
   SnapshotConsistency = &quot;CRASH_CONSISTENT&quot;
}

$sched = New-TintriVMSnapshotSchedule @tvmSnapSched</pre><p></p>
<p>The VMstore supports HOURLY, DAILY, WEEKLY, MONTHLY and QUARTERLY schedules. Depending on the selected scheduletype, you can use additional parameters to fine-tune the schedule. For example, the weekly schedule, has a <strong>TintriDaysOfWeek</strong> parameter. Some more examples.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$tvmSnapSched2 = @{
   SnapshotScheduleType = [Tintri.Windows.RA.V110.Dto.VirtualMachineSnapshotScheduleType]::DAILY
   TimeOfDay = &quot;10:00&quot;
   SnapshotConsistency = &quot;VM_CONSISTENT&quot;
}

$tvmSnapSched3 = @{
   VM = $vm
   SnapshotScheduleType = [Tintri.Windows.RA.V110.Dto.VirtualMachineSnapshotScheduleType]::WEEKLY
   TintriDaysOfWeek = &quot;Tuesday&quot;
}</pre><p></p>
<p>Note that you don’t need to assign a VM directly to a Snapshotschedule. You can do that later on, when you “attach” the Snapshotschedule.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">$sched = New-TintriVMSnapshotSchedule @tvmSnapSched2
Set-TintriVMSnapshotSchedule -VM $vm -SnapshotSchedule $sched</pre><p></p>
<p>To check which snapshot schedule is attached to a specific VM, you can do something like this.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-TintriVMSnapshotSchedule -VM $vm | Select VMName,Type,CronExpressions</pre><p></p>
<p>Note that one can define default snapshot schedules at the VMstore level. When they are not active, the CronExpressions property will be empty.</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/tintri-snap-cron/" rel="attachment wp-att-4766"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4766" src="https://lucd.info/wp-content/uploads/2014/08/tintri-snap-cron.png" alt="tintri-snap-cron" width="878" height="152" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-snap-cron.png 878w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-snap-cron-300x51.png 300w" sizes="auto, (max-width: 878px) 100vw, 878px" /></a></p>
<p>When you want to go back to the <strong>default</strong> Snapshotschedule, the one that is defined on the VMstore level, you can do.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Set-TintriVMSnapshotScheduleToDefault -VM $vm</pre><p></p>
<p>To see the snapshots for a specific VM, you can do</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-TintriVM -VM $vm | Get-TintriVMSnapshot |
Select VMName,Description,Type,CreateDate,ExpirationTime |
Format-Table -AutoSize</pre><p></p>
<p>This returns something like this.</p>
<p><a href="https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/tintri-snap-list/" rel="attachment wp-att-4768"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4768" src="https://lucd.info/wp-content/uploads/2014/08/tintri-snap-list.png" alt="tintri-snap-list" width="726" height="123" srcset="https://www.lucd.info/wp-content/uploads/2014/08/tintri-snap-list.png 726w, https://www.lucd.info/wp-content/uploads/2014/08/tintri-snap-list-300x50.png 300w" sizes="auto, (max-width: 726px) 100vw, 726px" /></a></p>
<p>Notice that the snapshots without an expiration data, will show December 31st in 1969 as the expiration time. That is in Linux zero day, which January 1st 1970, minus your time zone offset. This becomes obvious when we convert the property to UTC.</p>
<p></p><pre class="urvanov-syntax-highlighter-plain-tag">Get-TintriVM -VM $vm | Get-TintriVMSnapshot |
Select VMName,Description,Type,CreateDate,
   @{N=&quot;ExpirationTime&quot;;E={([DateTime]$_.ExpirationTime).ToUniversalTime()}} |
Format-Table -AutoSize</pre><p></p>
<p>That’s it for <strong>Part 1</strong>.</p>
<p>In the second part I will be showing how to use Tintri’s <strong>VM Protection</strong> through <strong>Replication</strong> with the <strong>Tintri Automation Tookit</strong>.</p>
<p>Enjoy !</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.lucd.info/2014/08/14/tintri-automation-toolkit-basics-part-1/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
