<?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#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>David Warburton</title>
	<atom:link href="http://blog.davidwarburton.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.davidwarburton.net</link>
	<description>Musings of a VM and storage engineer with a subtle addiction to scripting</description>
	<lastBuildDate>Tue, 04 May 2010 12:39:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.davidwarburton.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/c20477eed3c95efb1b5743638d034b93?s=96&#038;d=http://s2.wp.com/i/buttonw-com.png</url>
		<title>David Warburton</title>
		<link>http://blog.davidwarburton.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.davidwarburton.net/osd.xml" title="David Warburton" />
	<atom:link rel='hub' href='http://blog.davidwarburton.net/?pushpress=hub'/>
		<item>
		<title>Netbackup script to report scratch tapes</title>
		<link>http://blog.davidwarburton.net/2010/05/04/netbackup-script-to-report-scratch-tapes/</link>
		<comments>http://blog.davidwarburton.net/2010/05/04/netbackup-script-to-report-scratch-tapes/#comments</comments>
		<pubDate>Tue, 04 May 2010 12:35:29 +0000</pubDate>
		<dc:creator>DavidWarburton</dc:creator>
				<category><![CDATA[Netbackup]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://blog.davidwarburton.net/?p=98</guid>
		<description><![CDATA[I&#8217;ve seen Netbackup used in two completely different ways now. In my last environment all tapes rotas, movements and scratch tapes were handled manually. We had a spreadsheet showing tape sets (see below for an example), when these tapes were collected by Iron Mountain, which days of the months we defined as Monthly/Quarterly backups and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=98&subd=davidwarburton&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen Netbackup used in two completely different ways now. In my last environment all tapes rotas, movements and scratch tapes were handled manually. We had a spreadsheet showing tape sets (see below for an example), when these tapes were collected by Iron Mountain, which days of the months we defined as Monthly/Quarterly backups and so on. In this scenario each set of tapes is a number of tapes &#8211; on some days you may use less, on some days you may not have enough loaded.</p>
<p>In the new environment we let Netbackup dictate which tapes are in the scratch pool and free for re-use based on the expiration policy of the jobs written to those tapes. In theory this should mean that you only ever use as many tapes as you need for a given backup job. The problem with this set-up is that although it is, in theory, more efficient, you don&#8217;t always know which tapes you will need each night and how many you have free.</p>
<p>Each day guys were running NBU command lines to show which tapes were in the scratch pool, but having to manually sift through them to see which tapes were currently sat in drives/libraries and of the ones held off-site, which tapes were of which format (LTO2, 3 or 4).</p>
<p>The following script can be scheduled to email out a list of tapes in the scratch pool, which are in what library and also groups the offsite tapes by format. It was knocked up in a hurry so isn&#8217;t as parameterised or dynamic as it should be, but the comments should help you fix it for your needs&#8230;</p>
<p><span id="more-98"></span>Here&#8217;s the script and HTML header &amp; footer&#8230;</p>
<h4>scratch_list.ps1</h4>
<pre>$debugpreference = "continue"

#This "output" variable runs and stores the output of the NBU command line
#Be sure that this .exe is in your path, otherwise change the below to include the full path to the executable.
$output = vmquery.exe -b -pn Scratch
$htmlfile = ".\output.txt"
$today = Get-Date

#Arrays to hold and sort info about our tapes.
#NOTE: this script is hard-coded to work for LTO2 (HCART2), LTO3 (HCART3) and LTO4 (HCART) tape drives/libraries
[array]$aTapes = @()
[array]$aHOffsite = @()
[array]$aH2Offsite = @()
[array]$aH3Offsite = @()

#NOTE: this script is hard coded to include the specific names of tape drives attached (via various media servers) to the master server
$aRobots = @{"TLD0" = 0; "TLD1" = 0; "TLD2" = 0; "TLD3" = 0; "TLD4" = 0; "TLD5" = 0; "TLD6" = 0; "TLD7" = 0; "TLD8" = 0; "TLD9" = 0; "TLD10" = 0; "TLD11" = 0; "TLD12" = 0; "TLD13" = 0; "TLD14" = 0}
$emailBody = Get-Content "header.html"
$aOffsite = 0

#Function to send mail (currently configured to send via Exchange)
function sendEmail() {
 $eServer = New-Object system.net.mail.smtpClient("exchange_server01")

 $From = "netbackup@yourcompany.com"
 $To = "nbu_reports@yourcompany.com"

 $todayDate = [string] $today.day + "/" + [string] $today.month + "/" + [string] $today.year

 $title = "Scratch tape list for $todayDate"

 $Body = $emailBody
 $eMsg = New-Object System.Net.Mail.MailMessage($From,$To,$title,$body)

 $eMsg.IsBodyHTML = $True

 $eServer.send($eMsg)    
}

#Take output of NBU command line util, and for each line pick out bits of the string
#Chuck everything in to a new array called $aTapes
foreach ($line in $output){
 if (($line.contains("HCART")) -and (-not $line.contains("A00"))) {

 $tName = ($line.substring(0, 6)).trim()
 $tType = ($line.substring(8, 6)).trim()
 $tRobot = $line.substring(23, 5).trim() #this captures a wide area with some white space that needs trimming

 $tRobot = $tRobot.replace(" ", "")

 $aTapes += ,($tName, $tRobot, $tType)
 }
}

#Go through the array we just created and then put the contents in to seperate arrays
#dependant on whether they are LTO, LTO2 or LTO3 tapes...
for ($j = 0; $j -lt $aTapes.length; $j++) {
 $tapeID = $aTapes[$j][0]
 $robot = $aTapes[$j][1]
 $type = $aTapes[$j][2]

 if ($robot.contains("-")) {
 switch ($type ) {
 "HCART" {$aHOffsite += ,($tapeID)}
 "HCART2" {$aH2Offsite += ,($tapeID)}
 "HCART3" {$aH3Offsite += ,($tapeID)}
 }

 } else {#If a library type does not contain HCART, HCART2 or HCART3 we must assume it's offsite (or in a safe))
 $temp = "TLD$robot"
 $aRobots[$temp] = $aRobots[$temp] + 1
 }
}

#Take the contents of $aRobots (offsite tapes) and put it in to a variables ready to be dumped in to our html output
foreach ($element in $aRobots) {
 $element &gt; $htmlfile
}

#Start pipping everything out to the $emailBody variable which will make the body of our email
$emailBody += '&lt;table&gt;&lt;tr&gt;&lt;td&gt;Tape drive&lt;/td&gt;&lt;td&gt;# scratch tapes&lt;/td&gt;&lt;/tr&gt;'
foreach ($line in Get-Content $htmlfile) {

 if ($line.contains("TLD")) {
 $emailBody += "&lt;tr&gt;"

 $robot = $line.substring(0, 5)
 $count = $line.substring(31, 3)

 $emailBody += "&lt;td&gt;$robot&lt;/td&gt;&lt;td&gt;$count&lt;/td&gt;"

 $emailBody += "&lt;/tr&gt;"
 }
}
$emailBody += '&lt;/table&gt;&lt;br/&gt;&lt;br/&gt;'

$emailBody += "&lt;b&gt;Offsite tapes...&lt;/b&gt;&lt;br/&gt;"

$emailBody += "&lt;b&gt;HCART&lt;/b&gt;&lt;br&gt;"
foreach($element in $aHOffsite) {
 $emailBody += "$element&lt;br/&gt;"
}
$emailBody += "&lt;br/&gt;&lt;b&gt;HCART2&lt;/b&gt;&lt;br&gt;"
foreach($element in $aH2Offsite) {
 $emailBody += "$element&lt;br/&gt;"
}
$emailBody += "&lt;br/&gt;&lt;b&gt;HCART3&lt;/b&gt;&lt;br&gt;"
foreach($element in $aH3Offsite) {
 $emailBody += "$element&lt;br/&gt;"
}

$emailBody += Get-Content "footer.html"

sendEmail
</pre>
<p>As per my other NBU scripts I use HTML files to store the CSS and opening HTML in order to easily format nice looking emails. See below for examples&#8230;</p>
<h4>header.html</h4>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
&lt;html&gt;
&lt;head&gt;
 &lt;title&gt;Scratch tape list&lt;/title&gt;
 &lt;style type="text/css"&gt;
 body {
 font-family: Calibri, Arial, Helvetica;
 color: black;
 font-size: small;
 background-color: #FFFFFF }
 p {
 font-size: small }
 .big {
 font-size: small }
 table {
 font-size: small;
 padding: 0px ;
 border-spacing: 2px ;
 empty-cells: hide ;
 border: 1px solid #AAAAAA }
 td {
 background-color: #EEEEEE;
 vertical-align: top }
 th {
 background-color: #EEEEEE;
 vertical-align: top ;
 text-align: left}
 &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;p&gt;*** This email is now automatically generated ***&lt;br&gt;&lt;/p&gt;
</pre>
<h4>footer.html</h4>
<pre>&lt;br/&gt;
&lt;p&gt;Regards,&lt;br/&gt;&lt;br/&gt;
&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Let me know if this helps you out at all or if you can suggest any improvements&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwarburton.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwarburton.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwarburton.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwarburton.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwarburton.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwarburton.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwarburton.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwarburton.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwarburton.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwarburton.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=98&subd=davidwarburton&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davidwarburton.net/2010/05/04/netbackup-script-to-report-scratch-tapes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3a54ad2551bd756d17e5f75aab3c2acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">DavidWarburton</media:title>
		</media:content>
	</item>
		<item>
		<title>Using CrashPlan to backup a network share</title>
		<link>http://blog.davidwarburton.net/2010/03/12/using-crashplan-to-backup-a-network-share/</link>
		<comments>http://blog.davidwarburton.net/2010/03/12/using-crashplan-to-backup-a-network-share/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 23:12:07 +0000</pubDate>
		<dc:creator>DavidWarburton</dc:creator>
				<category><![CDATA[Batch]]></category>
		<category><![CDATA[Other Backups]]></category>

		<guid isPermaLink="false">http://blog.davidwarburton.net/?p=87</guid>
		<description><![CDATA[Some time ago I started using CrashPlan with CrashPlan Central to finally start backing up my family photos and important documents off-site. It&#8217;s been working pretty well, despite my frustrations over slow upload speeds. It&#8217;s pretty much a fire and forget solution. Recently I&#8217;ve installed FreeNAS on to an old PC to (a) start getting [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=87&subd=davidwarburton&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Some time ago I started using CrashPlan with <a href="http://b2.crashplan.com/consumer/features-central.html" target="_blank">CrashPlan Central</a> to finally start backing up my family photos and important documents off-site. It&#8217;s been working pretty well, despite my frustrations over slow upload speeds. It&#8217;s pretty much a fire and forget solution.</p>
<p>Recently I&#8217;ve installed <a href="http://freenas.org/FreeNAS" target="_blank">FreeNAS</a> on to an old PC to (a) start getting some stability to my storage solution, and (b) play around with ZFS and iSCSI at home. I tried OpenFiler but it pales in comparison to FreeNAS. I&#8217;ve gone against my better judgement and I&#8217;m using some of the cooler plugins including the Torrent client, Dynamic DNS and I&#8217;ve even installed SABNzbd on it. FreeNAS comes with rsync built in and even <a href="http://www.cis.upenn.edu/~bcpierce/unison/" target="_blank">Unison</a> which is an interesting solution to cross platform backup/synchronisation, but I&#8217;ve payed for my CrashPlan Central plan so want to make use of it!Only problem now is backing up my data!</p>
<p>CrashPlan doesn&#8217;t support backing up from a network share &#8211; either mapped drive or UNC path. There is a <a href="http://support.crashplan.com/doku.php/recipe/back_up_windows_mapped_drives" target="_blank">work around</a> on the CrashPlan site which works but is a little convoluted so wanted to post a nice, quick version here.</p>
<p>Read on after the break&#8230; <span id="more-87"></span>The problem is simply that CrashPlan runs as a service using the SYSTEM account. To allow us to backup a network share we have a couple of options&#8230;.</p>
<ol>
<li>Change the service to run as a standard user account (e.g. the one you&#8217;re logged in to your machine as)</li>
<li>Map a drive under the SYSTEM account so that it is visible to CrashPlan</li>
</ol>
<p>I&#8217;d recommend the latter but if you just plan on using this on a desktop machine and/or want a quick and dirty solution, here&#8217;s how you change the logon account for the service&#8230;</p>
<ul>
<li>Open up the Services MMC and find the <strong>CrashPlan Backup Service</strong>. Double-click it to open its properties<br />
<a href="http://davidwarburton.files.wordpress.com/2010/03/service_1.png"><img class="alignnone size-thumbnail wp-image-88" title="service_1" src="http://davidwarburton.files.wordpress.com/2010/03/service_1.png?w=144&#038;h=150" alt="Select CrashPlan service" width="144" height="150" /></a></li>
<li>Click the <strong>Log On</strong> tab and then select the <strong>This account</strong> radio button. </li>
<li>Enter the username and password of a local/domain user account with full permissions to the network share you want to back up <br />
<a href="http://davidwarburton.files.wordpress.com/2010/03/service_2.png"><img class="alignnone size-thumbnail wp-image-90" title="service_2" src="http://davidwarburton.files.wordpress.com/2010/03/service_2.png?w=150&#038;h=113" alt="Enter a local/domain username" width="150" height="113" /></a></li>
<li>Click <strong>OK</strong> and then restart the service <br />
<a href="http://davidwarburton.files.wordpress.com/2010/03/service_3.png"><img class="alignnone size-thumbnail wp-image-91" title="service_3" src="http://davidwarburton.files.wordpress.com/2010/03/service_3.png?w=150&#038;h=74" alt="Restart the service" width="150" height="74" /></a></li>
<li>Relaunch the CrashPlan application and you&#8217;ll now be able to see drives that you currently have mapped as a backup selection as well as local drives</li>
</ul>
<p> </p>
<p>The preferred method is to map a drive as the SYSTEM account. That in itself is no big deal, the thing is getting the drive mapped as soon as the machine boots and doing it each and every time your machine restarts. To do this we simply make use of Vista/7&#8242;s Task Scheduler.</p>
<p>The batch script, which we&#8217;ll save as <strong>c:\mount.bat</strong> simply uses a<strong> NET USE</strong> command. The one drawback to this method is that the username and <em>password</em> need to be saved in the script. You must use a username which has permissions to the network share. This need not be a local username, in the case of FreeNAS, if you have it joined to a domain as I do.</p>
<p>Here&#8217;s the code:</p>
<pre>net use M: <a href="//\\freenas\media">\\freenas\media</a> /USER:dave@mydomain.lan myP4ssw0rd</pre>
<p>Once you have that saved open up the Task Scheduler&#8230;</p>
<p><a href="http://davidwarburton.files.wordpress.com/2010/03/task_1.png"><img class="alignnone size-thumbnail wp-image-92" title="task_1" src="http://davidwarburton.files.wordpress.com/2010/03/task_1.png?w=128&#038;h=150" alt="Open the task scheduler" width="128" height="150" /></a></p>
<p>Create a new task (I keep my tasks in a seperate folder to the default Windows ones simply for easier administration). Give your ask a name, for example <strong>Mount drive for CrashPlan</strong>. Select <strong>Run whether user is logged on or not</strong>, tick the <strong>Run with highest privileges</strong> box and then click <strong>Change User or Group&#8230;</strong></p>
<p><a href="http://davidwarburton.files.wordpress.com/2010/03/task_2.png"><img class="alignnone size-thumbnail wp-image-93" title="task_2" src="http://davidwarburton.files.wordpress.com/2010/03/task_2.png?w=150&#038;h=111" alt="Change the username" width="150" height="111" /></a></p>
<p>Type <strong>system</strong> and then <strong>Check Names</strong> (it should capitalise and underline). Click <strong>OK</strong>.</p>
<p>Back in the Create Task window slect the <strong>Triggers</strong> tab and click <strong>New&#8230;</strong> Select <strong>At log on&#8230;</strong> from the drop down list and click <strong>OK </strong>to close the window.</p>
<p>Now select the <strong>Actions </strong>tab and, again, click <strong>New&#8230;</strong> leave the action as <strong>Start a program</strong> and then browse to your batch that we created above.</p>
<p><a href="http://davidwarburton.files.wordpress.com/2010/03/task_3.png"><img class="alignnone size-thumbnail wp-image-94" title="task_3" src="http://davidwarburton.files.wordpress.com/2010/03/task_3.png?w=150&#038;h=116" alt="Create the action" width="150" height="116" /></a></p>
<p>Click <strong>OK </strong>to close the New Action window and again for the <strong>Create Task </strong>window.</p>
<p>Job done! You can right click on the task and select Run to try it out.</p>
<p>A much more elegant solution would be to have a native FreeNAS (or just BSD) client for CrashPlan or to make use of rsync/Unison. This will do me for now though.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwarburton.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwarburton.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwarburton.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwarburton.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwarburton.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwarburton.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwarburton.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwarburton.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwarburton.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwarburton.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=87&subd=davidwarburton&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davidwarburton.net/2010/03/12/using-crashplan-to-backup-a-network-share/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3a54ad2551bd756d17e5f75aab3c2acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">DavidWarburton</media:title>
		</media:content>

		<media:content url="http://davidwarburton.files.wordpress.com/2010/03/service_1.png?w=144" medium="image">
			<media:title type="html">service_1</media:title>
		</media:content>

		<media:content url="http://davidwarburton.files.wordpress.com/2010/03/service_2.png?w=150" medium="image">
			<media:title type="html">service_2</media:title>
		</media:content>

		<media:content url="http://davidwarburton.files.wordpress.com/2010/03/service_3.png?w=150" medium="image">
			<media:title type="html">service_3</media:title>
		</media:content>

		<media:content url="http://davidwarburton.files.wordpress.com/2010/03/task_1.png?w=128" medium="image">
			<media:title type="html">task_1</media:title>
		</media:content>

		<media:content url="http://davidwarburton.files.wordpress.com/2010/03/task_2.png?w=150" medium="image">
			<media:title type="html">task_2</media:title>
		</media:content>

		<media:content url="http://davidwarburton.files.wordpress.com/2010/03/task_3.png?w=150" medium="image">
			<media:title type="html">task_3</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Powershell to report on Netapp filer snapshots</title>
		<link>http://blog.davidwarburton.net/2010/03/02/using-powershell-to-report-on-netapp-filer-snapshots/</link>
		<comments>http://blog.davidwarburton.net/2010/03/02/using-powershell-to-report-on-netapp-filer-snapshots/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 09:21:17 +0000</pubDate>
		<dc:creator>DavidWarburton</dc:creator>
				<category><![CDATA[Netapp]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Storage / Backups]]></category>

		<guid isPermaLink="false">http://blog.davidwarburton.net/?p=79</guid>
		<description><![CDATA[We had a few issues recently where SnapManager for Exchange and SnapDrive were failing to communicate properly which resulted in a weeks worth of missed snapshots before anyone realised what was going on. I wrote this script to report on the status of snapshots. The filer name is passed as a variable and a list [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=79&subd=davidwarburton&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>We had a few issues recently where SnapManager for Exchange and SnapDrive were failing to communicate properly which resulted in a weeks worth of missed snapshots before anyone realised what was going on.</p>
<p>I wrote this script to report on the status of snapshots. The filer name is passed as a variable and a list of volume names is stored as a variable at the top of the script. The output is nicely formatted email.</p>
<ol>
<li>The script uses SSH to connect to the filer (see my <a href="/2010/02/26/scripting-netapp-filers/">SSH guide for Netapp filers</a>)</li>
<li>For each vol listed in the array, the list of snapshots is returned</li>
<li>Any line with &#8220;__daily&#8221; in is processed &#8211; all others are ignored (we only care about our nightly verified snapshots which are all named __daily)</li>
<li>The snapshot name contains the date/time it was taken &#8211; this is read and if the date is within 24 hours of now a success is return (since reports are run the day after the verified job). If the date is over 24 hours a failure is returned.</li>
<li>A nicely formated HTML email is sent out which looks a little something like this&#8230;</li>
</ol>
<p><strong>Please see below for today&#8217;s backup report.</strong></p>
<table style="font-size:xx-small;" border="1" cellpadding="0">
<tbody>
<tr>
<td valign="top"><strong>VOL Name</strong></td>
<td valign="top"><strong>Status</strong></td>
<td valign="top"><strong>Snapshot name</strong></td>
</tr>
<tr>
<td valign="top">Vol_Exc02_DB</td>
<td valign="top"><span style="color:#0000ff;">Success</span></td>
<td valign="top">0% ( 0%) 0% ( 0%) Mar   02 01:44 exchsnap__exchange02_03-01-2010_23.00.14__daily   (busy,backup[0],dump)</td>
</tr>
<tr>
<td valign="top">Vol_Exc02_LOG</td>
<td valign="top"><span style="color:#0000ff;">Success</span></td>
<td valign="top">0% ( 0%) 0% ( 0%) Mar   02 04:38 eloginfo__exchange02_03-01-2010_23.00.14__daily</td>
</tr>
<tr>
<td valign="top">Vol_Exc02_DB1</td>
<td valign="top"><span style="color:#0000ff;">Success</span></td>
<td valign="top">0% ( 0%) 0% ( 0%) Mar 01 23:00 exchsnap__exchange02_03-01-2010_23.00.14__daily</td>
</tr>
<tr>
<td valign="top">Vol_Exc02_LOG1</td>
<td valign="top"><span style="color:#0000ff;">Success</span></td>
<td valign="top">1% ( 0%) 0% ( 0%) Mar   02 01:27 eloginfo__exchange02_03-01-2010_23.00.14__daily</td>
</tr>
<tr>
<td valign="top">Vol_Exc03_DB</td>
<td valign="top"><span style="color:#0000ff;">Success</span></td>
<td valign="top">1% ( 1%) 0% ( 0%) Mar   02 00:50 exchsnap__exchange03_03-01-2010_23.00.13__daily</td>
</tr>
<tr>
<td valign="top">Vol_Exc03_LOG</td>
<td valign="top"><span style="color:#0000ff;">Success</span></td>
<td valign="top">0% ( 0%) 0% ( 0%) Mar   02 02:06 eloginfo__exchange03_03-01-2010_23.00.13__daily</td>
</tr>
<tr>
<td valign="top">Vol_Exc03_DB1</td>
<td valign="top"><span style="color:#ff0000;">FAILURE</span></td>
<td valign="top">1% ( 1%) 0% ( 0%) Feb   26 23:00 exchsnap__exchange03_03-01-2010_23.00.13__daily</td>
</tr>
<tr>
<td valign="top">Vol_Exc03_LOG1</td>
<td valign="top"><span style="color:#ff0000;">FAILURE</span></td>
<td valign="top">0% ( 0%) 0% ( 0%) Feb   26 00:32 eloginfo__exchange03_03-01-2010_23.00.13__daily</td>
</tr>
</tbody>
</table>
<p>See the script and HTML files after the jump&#8230;<span id="more-79"></span></p>
<p>Don&#8217;t forget to change the name of your mail server, your sending and recipient email addresses and, most importantly, the location of plink.exe and your DSA keys used to establish the SSH connection (although you could easily modify this script to use RSH instead).</p>
<h4>snapReport.ps1 script</h4>
<pre># ==============================================================================================
#
# NAME:     Netapp filer snapshot reports
#
# AUTHOR:     David Warburton
# DATE:     12/03/2009
#
# PARAMETERS:    1. $filer
#        Specifies the name of the remote filer to connect to.
#        example: snapReport.ps1 myfiler01
#
# ==============================================================================================
$debugPreference = "continue"
$errorActionPreference = "stop"
$filer = $Args[0]
$htmlFile = "D:\Logs\Exchange Snapshot Report\exchange_Snapshot.html"
$volumes = ("Vol_Exc02_DB", "Vol_Exc02_LOG", "Vol_Exc02_DB1", "Vol_Exc02_LOG1", "Vol_Exc03_DB", "Vol_Exc03_LOG", "Vol_Exc03_DB1", "Vol_Exc03_LOG1")
$header = get-content "header.html"
$header &gt; $htmlFile
$today = get-date
function sendEmail() {
 $eServer = new-object system.net.mail.smtpClient("mailserver.yourdomain.com")
 $From = "youraddress@yourcompany.com"
 $To = "backup_reports@yourcompany.com"
 if ($checkType -eq "weekly") {
 $title = "Weekly "
 } else {
 $title = "Daily "
 }
 $todayDate = [string] $today.day + "/" + [string] $today.month + "/" + [string] $today.year
 $title += "Exchange snapshot Report for $todayDate"
 $Body = get-content $htmlFile
 $eMsg = new-object System.Net.Mail.MailMessage($from,$to,$Title,$body)
 $eMsg.IsBodyHTML = $True
 #$eMsg.cc.add($cc)
 $eServer.send($eMsg)
}
function checkSnap($volName) {
 $output = D:\Utils\PuTTY\plink.exe svc-ssh@$filer -i D:\Utils\PuTTY\id_dsa.ppk snap list $volName
 $validsnap = $False
 $snapname = ""
 foreach ($line in $output){
 if ($line.contains("__daily")) {
 $sMonth = $line.substring(62, 2)
 $sDay = $line.substring(65, 2)
 $sYear = $line.substring(68, 4)
 $sDate = [datetime] "$sMonth $sDay $sYear"
 if (($sDate.date).addDays(1) -eq $today.date) {
 $validsnap = $True
 $snapname = $line
 }
 }
 if ($validsnap) {
 return $snapname
 }
 }
 return $False
}
foreach ($vol in $volumes) {
 $line = "&lt;tr&gt;&lt;td&gt;$vol&lt;/td&gt;"
 $status = checkSnap $vol
 if ($status -eq $false) {
 $line += "&lt;td&gt;&lt;font color=red&gt;FAILED&lt;/font&gt;&lt;/td&gt;"
 } else {
 $line += "&lt;td&gt;&lt;font color=blue&gt;Success&lt;/font&gt;&lt;/td&gt;"
 }
 $line += "&lt;td&gt;$status&lt;/td&gt;&lt;/tr&gt;"
 $line &gt;&gt; $htmlFile
}
$footer = Get-Content "footer.html"
$footer &gt;&gt; $htmlFile
sendEmail
</pre>
<p>Here are the HTML bits for the header and footer of the email&#8230;</p>
<h4>header.html</h4>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"&gt;
&lt;html&gt;
&lt;head&gt;
 &lt;title&gt;Backup Report&lt;/title&gt;
 &lt;style type="text/css"&gt;
 body {
 font-family: Calibri, Arial, Helvetica;
 color: black;
 font-size: xx-small;
 background-color: #FFFFFF }
 p {
 font-size: x-small }
 .big {
 font-size: x-small;
 font-weight: bold }
 table {
 padding: 0px ;
 border-spacing: 2px ;
 empty-cells: hide ;
 border: 1px solid #AAAAAA }
 td {
 background-color: #EEEEEE;
 vertical-align: top }
 th {
 background-color: #EEEEEE;
 vertical-align: top ;
 text-align: left}
 &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;*** This email is now automatically generated ***&lt;br&gt;&lt;br&gt;&lt;b&gt;Please see below for today's backup report.&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;
 &lt;b&gt;NOTE: &lt;/b&gt;&lt;br/&gt;
 - Exchange and SQL snapshots are managed by SnapManager and are alerted independantly to this report.&lt;br/&gt;
 - Not &lt;u&gt;all&lt;/u&gt; snapshots are shown in these reports. Hourly snapshots are currently not reported upon.
&lt;/p&gt;
&lt;table&gt;
&lt;tr&gt;
 &lt;th&gt;VOL Name&lt;/th&gt;&lt;th&gt;Status&lt;/th&gt;&lt;th&gt;Number of Snapshots&lt;/th&gt;&lt;th&gt;Last snapshot taken&lt;/th&gt;
&lt;/tr&gt;
</pre>
<h4>footer.html</h4>
<pre>&lt;/table&gt;
&lt;br/&gt;
&lt;p&gt;Regards.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwarburton.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwarburton.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwarburton.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwarburton.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwarburton.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwarburton.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwarburton.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwarburton.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwarburton.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwarburton.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=79&subd=davidwarburton&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davidwarburton.net/2010/03/02/using-powershell-to-report-on-netapp-filer-snapshots/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3a54ad2551bd756d17e5f75aab3c2acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">DavidWarburton</media:title>
		</media:content>
	</item>
		<item>
		<title>NTFS permissions lost when copying from a snapshot</title>
		<link>http://blog.davidwarburton.net/2010/03/01/ntfs-permissions-lost-when-copying-from-a-snapshot/</link>
		<comments>http://blog.davidwarburton.net/2010/03/01/ntfs-permissions-lost-when-copying-from-a-snapshot/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 10:04:24 +0000</pubDate>
		<dc:creator>DavidWarburton</dc:creator>
				<category><![CDATA[Netapp]]></category>
		<category><![CDATA[OnTAP 7.2.6]]></category>
		<category><![CDATA[Windows Server 2003]]></category>

		<guid isPermaLink="false">http://blog.davidwarburton.net/?p=75</guid>
		<description><![CDATA[Something I just remembered when performing a restore for a user. When copying files from a CIFS snapshot using the hidden .snapshot directory NTFS permissions are lost. Instead they are inherited from the folder you are copying to. To maintain permissions, use NDMPCOPY specifying the snapshot name in the source (first) parameter&#8230; ndmpcopy "filer1:/vol/vol_A/qtree_A/.snapshot/nightly.1/MyDocs" "filer1:/vol/vol_A/qtree_A/MyDocs" [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=75&subd=davidwarburton&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Something I just remembered when performing a restore for a user.</p>
<p>When copying files from a CIFS snapshot using the hidden .snapshot directory NTFS permissions are lost. Instead they are inherited from the folder you are copying to.</p>
<p>To maintain permissions, use NDMPCOPY specifying the snapshot name in the source (first) parameter&#8230;</p>
<pre>ndmpcopy "filer1:/vol/vol_A/qtree_A/.snapshot/nightly.1/MyDocs" "filer1:/vol/vol_A/qtree_A/MyDocs"</pre>
<p>You can enclose the path in quotes if the path has spaces in.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwarburton.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwarburton.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwarburton.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwarburton.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwarburton.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwarburton.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwarburton.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwarburton.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwarburton.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwarburton.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=75&subd=davidwarburton&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davidwarburton.net/2010/03/01/ntfs-permissions-lost-when-copying-from-a-snapshot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3a54ad2551bd756d17e5f75aab3c2acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">DavidWarburton</media:title>
		</media:content>
	</item>
		<item>
		<title>Netapp Rapid Cloning Utility v3.0</title>
		<link>http://blog.davidwarburton.net/2010/02/26/netapp-rapid-cloning-utility-v3-0/</link>
		<comments>http://blog.davidwarburton.net/2010/02/26/netapp-rapid-cloning-utility-v3-0/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 16:02:01 +0000</pubDate>
		<dc:creator>DavidWarburton</dc:creator>
				<category><![CDATA[ESX]]></category>
		<category><![CDATA[ESXi]]></category>
		<category><![CDATA[Netapp]]></category>
		<category><![CDATA[Storage / Backups]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[vSphere]]></category>

		<guid isPermaLink="false">http://blog.davidwarburton.net/?p=71</guid>
		<description><![CDATA[Netapp have released their new version of their Rapid Cloning Utility &#8211; a vCenter plugin which allows you to provision and new datastores and clone hosts (including VMware View 4 VDI&#8217;s) with ease right inside of the Virtual Infrastructure Client. vCenter 4 is needed but it is compatible with ESX 3.5 and 4. The great [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=71&subd=davidwarburton&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Netapp have released their new version of their Rapid Cloning Utility &#8211; a vCenter plugin which allows you to provision and new datastores and clone hosts (including VMware View 4 VDI&#8217;s) with ease right inside of the Virtual Infrastructure Client. vCenter 4 is needed but it is compatible with ESX 3.5 and 4.</p>
<p>The great thing is that all the storage processing is offloaded from vCenter and is performed entirely on the filers. I&#8217;ve not had a chance to play with the RCU yet but this just looks utterly awesome! Check out this preview blog post and video from Netapp:</p>
<p><a href="http://blogs.netapp.com/virtualstorageguy/2009/12/preview-rapid-cloning-utility-30-vcenter-plug-in.html" target="_blank">http://blogs.netapp.com/virtualstorageguy/2009/12/preview-rapid-cloning-utility-30-vcenter-plug-in.html</a></p>
<p>If you don&#8217;t have time to sit and read, then at least check out the video. I dare you not to be impressed!</p>
<p><span style="text-align:center; display: block;"><a href="http://blog.davidwarburton.net/2010/02/26/netapp-rapid-cloning-utility-v3-0/"><img src="http://img.youtube.com/vi/dBSC-IOw93I/2.jpg" alt="" /></a></span><br />
Do any other storage vendors have similar tools?</p>
<address>Source: <a href="http://www.ntapgeek.com/2010/02/netapp-updates-rcu-for-vmware-vsphere-4.html" target="_blank">http://www.ntapgeek.com/2010/02/netapp-updates-rcu-for-vmware-vsphere-4.html</a></address>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwarburton.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwarburton.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwarburton.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwarburton.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwarburton.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwarburton.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwarburton.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwarburton.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwarburton.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwarburton.wordpress.com/71/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=71&subd=davidwarburton&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davidwarburton.net/2010/02/26/netapp-rapid-cloning-utility-v3-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3a54ad2551bd756d17e5f75aab3c2acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">DavidWarburton</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/dBSC-IOw93I/2.jpg" medium="image" />
	</item>
		<item>
		<title>Scripting Netapp filers</title>
		<link>http://blog.davidwarburton.net/2010/02/26/scripting-netapp-filers/</link>
		<comments>http://blog.davidwarburton.net/2010/02/26/scripting-netapp-filers/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 14:05:50 +0000</pubDate>
		<dc:creator>DavidWarburton</dc:creator>
				<category><![CDATA[Netapp]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Storage / Backups]]></category>

		<guid isPermaLink="false">http://blog.davidwarburton.net/?p=66</guid>
		<description><![CDATA[Scripting the Netapp filers can be accomplished by using either RSH or SSH. Both of these options must be enabled on the filer(s) in question using. In either case scripts are not processed on the filers themselves. They are scheduled and run on Windows/Linux systems using their native languages (e.g. Vbscript or Powershell). These scripts [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=66&subd=davidwarburton&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Scripting the Netapp filers can be accomplished by using either RSH or SSH. Both of these options must be enabled on the filer(s) in question using.</p>
<p>In either case scripts are not processed on the filers themselves. They are scheduled and run on Windows/Linux systems using their native languages (e.g. Vbscript or Powershell). These scripts simply call native OnTAP commands against a filer which then returns data in the form of text. This is important to note as although Powershell is a useful language to use OnTAP will not return native PS objects which means you are limited to text/string based manipulation.</p>
<h3><strong>RSH</strong></h3>
<p>This method is the least secure but is the quickest and easiest to set up. Users need not necessarily be filer administrators. Although there is some degree of security in the sense that access is restricted to a set user account and accessible only via a set IP address, data is not encrypted.</p>
<p>RSH is not natively supported in Windows 2008 [from the command line] as it is in Windows 2003.</p>
<p>To enable RSH on the filer use the following command:</p>
<pre>options rsh.enable on</pre>
<p>You must also specify user accounts and IP addresses via the FilerView web interface.</p>
<h3>SSH</h3>
<p>Windows 2008 does not natively support SSH either so this is accomplished using <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">plink</a>.</p>
<p>To enable SSH on the filer use the following commands:</p>
<pre style="padding-left:30px;">secureadmin setup
secureadmin enable ssh
</pre>
<p>Read more after the break&#8230;</p>
<h4><span id="more-66"></span>Configuring SSH</h4>
<ol>
<li>First create a local user      account on the filer using the following command:
<pre> useradmin user add svc-ssh -g Administrators</pre>
<ol type="a">
<li>the passwords are kept in the Password spreadsheet</li>
<li>The user must be a member of       Administrators to be granted the Login_ssh permission on the filer</li>
</ol>
</li>
<li>Using Powershell (whilst      running with your Admin Account) change directory to the hidden share on      the filer:
<pre> cd \\filer\c$\etc\sshd\</pre>
</li>
<li>Create a folder with the same      name as your account created in step 1 and then another folder to hold the      SSH keys:
<pre> md svc-ssh
 md svc-ssh\.ssh</pre>
</li>
<li>On the script server lunch      PUTTYGEN.EXE and under the &#8220;Key&#8221; menu change the type to      &#8220;SSH-2 DSA key&#8221;. Leave everything else on its default      setting.</li>
<li>Click on the <strong>Generate </strong>button      and follow the prompt</li>
<li>Enter the same password from      step 1 in the &#8220;Key passphrase&#8221; and &#8220;Confirm      passphrase&#8221; areas (they do not HAVE to be the same as step 1 but are      being kept so for simplicity)</li>
<li>When complete, click on Save      public key. Save it to the PuTTY folder with the name:<br />
<strong>id_dsa.pub</strong></li>
<li>Save the private key to the      same place with a similar name:<br />
i<strong>d_dsa.ppk</strong></li>
<li>Copy the contents of the      &#8220;Public key for pasting into OpenSSH authorised_key file&#8221; area      and paste it in to a new text document. You should use Wordpad to do this as Notepad does not      handle the line breaks properly. Save this document as authorized_keys.</li>
<li>You are now finished. You can test connection using PuTTY by selecting your private key. The first time you connect you will be prompted to accept the hosts key. You will still be prompted for a username but you should not need to enter a password as this is what the SSH keys are for.</li>
<p>For scripting purposes we use plink.exe to issue a command. For example:</p>
<pre>.\plink.exe svc-ssh@filer -i "id_dsa.ppk" df -s
</pre>
</ol>
<h4>Scripting using plink</h4>
<p>The basic use of plink.exe is as follows:</p>
<pre>.\plink.exe svc-ssh@filer -i "id_dsa.ppk" df -s</pre>
<p>Two methods can be used to script the filers depending on what you&#8217;re trying to achieve:</p>
<div>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>Reporting</td>
<td>Grabbing the   contents of a single command and piping it to a Powershell variable. This   allows us to manipulate the string (or lines of strings) that are returned.   Objects are not returned so true Powershell scripting (i.e. Object   Orientated) can not be done but PS gives us some very useful string   maniplation functions.</td>
</tr>
<tr>
<td>Maintenance</td>
<td>Issuing multiple   commands to the filer to perform repetitive/scheduled actions. For example,   deleting, renaming and taking new snapshots.</td>
</tr>
</tbody>
</table>
</div>
<p>NOTE: when calling plink.exe in Powershell the full or abbreviated path must be specified. So use either a full path, for example, D:\Utils\PuTTY\plink.exe or just .\plink.exe</p>
<h3>Reporting</h3>
<p>From a Powershell command prompt simply pipe the output of an SSH command in to a variable for later manipulation:</p>
<p>$output = .\plink.exe svc-ssh@filer -i &#8220;id_dsa.ppk&#8221; df -s</p>
<h3>Maintenance</h3>
<p>If multiple command need to be issued &#8211; for example, you need to delete a snapshot, rename the previous 5 snapshots, and then take a new snapshot &#8211; you should issue them all via the one SSH connection.</p>
<p>Commands can be concatenated using a semi-colon. Just be sure to enclose everything in quotes. For example:</p>
<pre> .\plink.exe svc-ssh@filer -i "id_dsa.ppk" "snap delete Vol_A hourly.6; snap rename Vol_A hourly.5 hourly.4; snap rename Vol_A hourly.4 hourly.3; snap rename Vol_A hourly.3 hourly.2; snap rename Vol_A hourly.2 hourly.1; snap create Vol_A hourly.0"
</pre>
<p>Well that&#8217;s it. It&#8217;s a pretty brief post &#8211; if you have any questions please feel free to post them in the comments&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwarburton.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwarburton.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwarburton.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwarburton.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwarburton.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwarburton.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwarburton.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwarburton.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwarburton.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwarburton.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=66&subd=davidwarburton&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davidwarburton.net/2010/02/26/scripting-netapp-filers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3a54ad2551bd756d17e5f75aab3c2acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">DavidWarburton</media:title>
		</media:content>
	</item>
		<item>
		<title>Netbackup Report Scripting</title>
		<link>http://blog.davidwarburton.net/2010/02/25/netbackup-report-scripting-2/</link>
		<comments>http://blog.davidwarburton.net/2010/02/25/netbackup-report-scripting-2/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 14:01:16 +0000</pubDate>
		<dc:creator>DavidWarburton</dc:creator>
				<category><![CDATA[Batch]]></category>
		<category><![CDATA[Netbackup]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[VBscript]]></category>

		<guid isPermaLink="false">http://davidwarburton.wordpress.com/?p=51</guid>
		<description><![CDATA[Hi everyone. I&#8217;m going to jump right in to my first post (the main reason for starting this blog in the first place) and show you the progress I&#8217;ve made with automating daily reports using our backup solution of choice, Symantec (used to be Veritas) Netbackup. Until now our users have demanded daily reports to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=51&subd=davidwarburton&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Hi everyone. I&#8217;m going to jump right in to my first post (the main  reason for starting this blog in the first place) and show you the  progress I&#8217;ve made with automating daily reports using our backup  solution of choice, Symantec (used  to be Veritas) Netbackup.</p>
<p>Until  now our users have demanded daily reports to be emailed out to key  individuals. The format of these emails was quite basic in theory&#8230;it  simply showed a list of all servers (clients) that were backed up, their  status from last night (e.g. successful, failed, etc&#8230;) but then,  crucially, a list of files that had been skipped.</p>
<p>The reason for  listing each file that had failed was due to Netbackup&#8217;s poor poor  (don&#8217;t get me started on how poor) feedback in the Activity Monitor and  it&#8217;s built in reports. You see sometimes jobs could be marked as  &#8220;Successful with warnings&#8221; if the job completed but the odd file had  been skipped (if it were in use, for example). But other times, although  it still listed which files had been missed if you double-clicked on  each job, it showed the overall status as Successful. This meant that to  report on the servers in the format that was required by our users we  had to manually trawl through the 360 jobs across two Netbackup servers  just to copy and paste the lines of the files that had been missed.</p>
<p>Needless  to say it didn&#8217;t take me long to get bored of this so I started looking  at a way of reproducing our reports automatically.  After some time,  I&#8217;ve come up with a solution &#8211; it uses VBScript to parse the logs files  which I output using a few key Netbackup command-line tools.</p>
<p>The basic process and components to the script are as follows&#8230;</p>
<ol>
<li>A VBscript calls a number of external batch scripts</li>
<li>These batch script run NBU commands and spit their output to text files</li>
<li>The VBscript then reads these text files</li>
<li>The VBscript reads a servers.txt file to determine what jobs to report on*</li>
<li>A LOT of array and string manipulation is used to catalogue which jobs have run and which have errors and if so, it collates all skipped files</li>
<li>These arrays are then parsed and dumped to either an HTML file (which can be used directly in the body of an email) or, as I&#8217;ve recently changed to script, outputs to an Excel file.</li>
</ol>
<p>There are some nice bits to the script(s) and some really nasty bits &#8211; I welcome you to improve on the original and share it with everyone (for example, I know there is a much neater way of calling and parsing the output of batch jobs rather than the nasty wscript.sleep I have used).</p>
<p>* A text file (called servers.txt) is kept along side the scripts. This file is manually edited and must be kept up to date. The file is a number of lines, each one representing a client/job that we wish to report on. The format is as follows:</p>
<pre style="padding-left:30px;">60, myserver, mypolicy, GroupName</pre>
<p>The number at the start represents what days of the week the report should be generated. <em>myserver </em>is obviously the client that is to be reported on. <em>mypolicy</em> is the name of a policy that you are reporting on (since a client may me a member of multiple policies). Finally, <em>GroupName</em> is free text and can be used to group similar clients (that may not necessarily be grouped by the same policy.</p>
<p>The scripts necessary to generate a report are&#8230;</p>
<ol>
<li><a href="/2010/02/25/generatereport-vbs/"><strong>generateReport.vbs</strong></a><br />
The primary script which calls the others and also performs of the processing and HTML/Excel generation</li>
<li><a href="/2010/02/25/job_summary-bat/"><strong>j</strong><strong>obs_summary.bat</strong></a><br />
Issues the bpdjobs &#8211; simmary command and pipes output to a text file. This provides a simple overview of number of total jobs and the number that have succeeded, failed or errored.</li>
<li><a href="/2010/02/25/jobs_report-bat/"><strong>jobs_report.bat</strong></a><br />
This is the main batch script upon which the report is generated. It is a hideous mess of space-formatted garbage and why so much processing is needed to generate a useful and nice looking report.</li>
</ol>
<p>Clicking the scripts above will take you to a separate page with the code and more explanations of how to use it in your environment.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwarburton.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwarburton.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwarburton.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwarburton.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwarburton.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwarburton.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwarburton.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwarburton.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwarburton.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwarburton.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=51&subd=davidwarburton&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davidwarburton.net/2010/02/25/netbackup-report-scripting-2/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3a54ad2551bd756d17e5f75aab3c2acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">DavidWarburton</media:title>
		</media:content>
	</item>
		<item>
		<title>generateReport.vbs</title>
		<link>http://blog.davidwarburton.net/2010/02/25/generatereport-vbs/</link>
		<comments>http://blog.davidwarburton.net/2010/02/25/generatereport-vbs/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 13:40:53 +0000</pubDate>
		<dc:creator>DavidWarburton</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[VBscript]]></category>

		<guid isPermaLink="false">http://davidwarburton.wordpress.com/?p=32</guid>
		<description><![CDATA[Below is the code for the generateReport.vbs file which is the primary script for generating automatic Netbackup reports. This one is pretty length so check it out after the break&#8230; Sadly the script may cut off some lines. If you&#8217;d like a copy of the script to play around with drop me an email&#8230; 1: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=32&subd=davidwarburton&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>Below is the code for the generateReport.vbs file which is the primary script for generating automatic Netbackup reports. This one is pretty length so check it out after the break&#8230;<span id="more-32"></span></p>
<p>Sadly the script may cut off some lines. If you&#8217;d like a copy of the script to play around with drop me an email&#8230;</p>
<pre style="font-family:arial;font-size:12px;border:1px dashed #cccccc;width:99%;height:auto;overflow:auto;background:url('http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif') repeat scroll 0 0 #f0f0f0;color:#000000;text-align:left;line-height:20px;padding:0;"><code style="color:#000000;">1:  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
2:  ' GENERATE LOG FILES
3:  Option Explicit
4:  Const fileServerList = "servers.txt"
5:  'On Error Resume Next
6:  'Overview status variables
7:  Dim ov_func, ov_status, ov_fail, ov_all, ov_all_status
8:  Dim WshShell, emailBody, filetxt, statusFile, fileToday
9:  Set WshShell = WScript.CreateObject("WScript.Shell")
10:  Set objFSO = CreateObject("Scripting.FileSystemObject")
11:  Set statusFile = objFSO.CreateTextFile("reportsbackupStatus.txt", True)
12:  Set filetxt = objFSO.CreateTextFile("reportsarchivebackupReport_" &amp; Year(Now) &amp; Month(Now) &amp; Day(Now) &amp; ".html", True)
13:  Set fileToday = objFSO.CreateTextFile("reportstoday.html", True)
14:  emailBody = ""
15:  '''''''''''''''''''''''''''''''''''''''''''''''''''''
16:  ' WE ARE NOW GOING TO USE EXCEL SHEETS TO REPORT
17:  ''dim objExcel, objBook, objSheet
18:  ''Set objExcel = CreateObject("Excel.Application")
19:  ''objBook = objExcel.Workbooks.Add()
20:  ''objSheet = objBook.Worksheets.Item(1)
21:  ''objExcel.Visible = False
22:  ''objExcel.Cells(1, 1).Value = "Test value"
23:  '''''''''''''''''''''''''''''''''''''''''''''''''''''
24:  Dim startDate, endDate, prevDay, numDays
25:  'Dates should be in the format mm/dd/yyyy
26:  'Times should be in the format HH:mm:ss
27:  endDate = month(now) &amp; "/" &amp; Day(now) &amp; "/" &amp; Year(now) &amp; " " &amp; "17:00:00"
28:  'Now figure out if we need the error log from just last night or from the whole weekend
29:  If Weekday(now) = 2 then '2 = Monday
30:       numDays = -3 'take us back 3 days to Friday
31:  Else
32:       numDays = -1 'just take us back 1 day to yesterday
33:  End If
34:  prevDay = DateAdd("d", numDays, now)
35:  startDate = CStr(month(prevDay) &amp; "/" &amp; Day(prevDay) &amp; "/" &amp; Year(prevDay) &amp; " " &amp; "17:00:00")
36:  'WScript.Echo "startDate = " &amp; startDate
37:  'WScript.Echo "endDate = " &amp; endDate
38:  'WScript.Echo "activity_errors.bat " &amp; startDate &amp; " " &amp; endDate
39:  'Run the batch scripts with our new date parameters to generate our log files...
40:  backupLogs
41:  WshShell.Run ("jobs_summary.bat")
42:  WshShell.Run ("jobs_report.bat")
43:  WshShell.Run ("activity_errors.bat """ &amp; startDate &amp; """ """ &amp; endDate &amp; """")
44:  'Wait 90 seconds (!!!) for the file to close before we try and read it
45:  WScript.Sleep 90000
46:  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
47:  ' START GENERATING THE HTML HEADER INFO TO THE REPORT FILE
48:  ' #Write HTML header to Log
49:  writeLog "b", "&lt;!DOCTYPE html PUBLIC ""-//W3C//DTD HTML 4.01//EN""&gt;" &amp; _
50:       "&lt;html&gt;" &amp; _
51:       "&lt;head&gt;" &amp; _
52:        "&lt;title&gt;Backup Report&lt;/title&gt;" &amp; _
53:        "&lt;style type=""text/css""&gt;" &amp; _
54:             "body {" &amp; _
55:              "font-family: Calibri, Arial, Helvetica; " &amp; _
56:              "color: black;" &amp; _
57:              "font-size: xx-small;" &amp; _
58:                   "background-color: #FFFFFF }" &amp; _
59:             " p {" &amp; _
60:         "     font-size: x-small }" &amp; _
61:             " .big {" &amp; _
62:         "     font-size: x-small;" &amp; _
63:         "     font-weight: bold }" &amp; _
64:             " table {" &amp; _
65:              "      padding: 0px ;" &amp; _
66:              "      border-spacing: 0px ;" &amp; _
67:              "      empty-cells: hide ;" &amp; _
68:              "      border: 1px solid #AAAAAA }" &amp; _
69:             " td {" &amp; _
70:              "      background-color: #EEEEEE;" &amp; _
71:            "      vertical-align: top }" &amp; _
72:        "&lt;/style&gt;" &amp; _
73:       "&lt;/head&gt;" &amp; _
74:       "&lt;body&gt;"
75:  writeLog "e", "&lt;p&gt;&lt;b&gt;*** This email is now automatically generated ***&lt;/b&gt;&lt;br&gt;&lt;br&gt;Please see below for today's backup report.&lt;/p&gt;"
76:  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
77:  ' READ IN LIST OF SERVERS AND GENERATE Array
78:  Dim objReadFile, nSched, strServer, aSvrStatus, objFSO, count, strPolicy, aLine, strLine, strGroup
79:  Const ForReading = 1
80:  'Create object for reading from our log file list
81:  Set objReadFile = objFSO.OpenTextFile(fileServerList, ForReading, True)
82:  count = 0
83:  ReDim aSvrStatus(5,count)
84:  ReDim aSvrLogs(3,count)
85:  'aSvrStatus(0,n) = server name
86:  'aSvrStatus(1,n) = catalog policy
87:  'aSvrStatus(2,n) = status code
88:  'aSvrStatus(3,n) = total bytes backed up
89:  'aSvrStatus(4,n) = category/group (e.g. Front Office, Back Office, IT...)
90:  'aSvrLogs(0,n) = server name
91:  'aSvrLogs(1,n) = warning/error messages
92:  'aSvrLogs(2,n) = warning/error messages
93:  Do
94:       strLine = objReadFile.ReadLine
95:       'Check for comments and blank lines...
96:       If strLine = "" Or Left(strLine, 1) = "#" Or isNull(strLine) Then
97:            'do Nothing
98:       Else
99:            aLine = split(strLine, ",")
100:            nSched = aLine(0)
101:            strPolicy = aLine(1)
102:            strServer = aLine(2)
103:            strGroup = aLine(3)
104:            'This has been changed slightly. The hex code now denotes if the REPORT should be run today for this particular client
105:            If logToday(nSched) Then
106:                 'wscript.Echo "nSched = " &amp; nSched
107:                 'wscript.Echo "strPolicy = " &amp; strPolicy
108:                 'wscript.Echo "strServer = " &amp; strServer
109:                 ReDim preserve aSvrStatus(5, count)
110:                 aSvrStatus(0, count) = strServer
111:                 aSvrStatus(1, count) = strPolicy
112:                 aSvrStatus(4, count) = strGroup
113:                 'WScript.Echo count &amp; " - " &amp; aSvrStatus(0, count) &amp; ", " &amp; aSvrStatus(1, count)
114:                 count = count + 1
115:            Else
116:                 'do nothing
117:            End If
118:       End If
119:  Loop Until objReadFile.AtEndOfStream = True
120:  Dim numServers
121:  numServers = count
122:  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
123:  ' FIRST OFF, CREATE A LIST OF JUMP LINKS
124:  jumpLinks
125:  Sub jumpLinks()
126:       writeLog "f", "&lt;b&gt;Jump to...&lt;/b&gt;&lt;br/&gt;"
127:       Dim count, prevGroup
128:       For count = 0 To numServers - 1
129:            'If the group name In the current element of the array is not the same as before, close and start a new table
130:            If prevGroup &lt;&gt; aSvrStatus(4, count) Then
131:                 writeLog "f", "- &lt;a href=""#" &amp; aSvrStatus(4, count) &amp; """&gt;" &amp; aSvrStatus(4, count) &amp; "&lt;/a&gt;&lt;br/&gt;"
132:            End If
133:            prevGroup = aSvrStatus(4, count)
134:       Next
135:  End Sub
136:  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
137:  ' SECONDLY, SIMPLY SPIT OUT THE DETAILS OF THE SUMMARY.LOG FILE
138:  'Create object for reading from our log file list
139:  Set objReadFile = objFSO.OpenTextFile("logssummary.log", ForReading, True)
140:  Dim summaryCount
141:  summaryCount = 0
142:  writeLog "b", "&lt;p&gt;"
143:  Do
144:       strLine = objReadFile.readLine
145:       If summaryCount = 0 Then
146:            'Ignore the first line and output it as it appears
147:            writeLog "b", "&lt;b&gt;" &amp; strLine &amp; "&lt;/b&gt;&lt;table&gt;"
148:       Else
149:            'if line is blank then skip it
150:            If strLine &lt;&gt; "" and not IsNull(strLine) Then
151:                 'Subsqeuent lines need to be split to seperate the category and the total
152:                 strLine = Replace(strLine, "Partially Successful", "Partially-Successful")
153:                 strLine = Replace(strLine, " ", "")
154:                 aLine = Split(strLine, ":")
155:                 writeLog "b", "&lt;tr&gt;&lt;td&gt;" &amp; aLine(0) &amp; "&amp;nbsp;&lt;/td&gt;&lt;td&gt;&amp;nbsp;" &amp; aLine(1) &amp; "&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;"
156:            End If
157:       End If
158:       summaryCount = summaryCount + 1
159:  Loop Until objReadFile.AtEndOfStream = True
160:  writeLog "b", "&lt;/table&gt;&lt;i&gt;Please note: more than one ""job"" exists per backup client.&lt;/i&gt;&lt;br&gt;&lt;br&gt;"
161:  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
162:  ' NOW WE HAVE OUR ARRAY WE CAN PARSE THE REPORT.CSV FILE FOR EACH SERVER STATUS
163:  Set objReadFile = objFSO.OpenTextFile("logsreport.csv", ForReading, True)
164:  Dim currentStatus
165:  Do
166:       aLine = split(objReadFile.ReadLine, ",")
167:       'For every line in the report, we need to loop through the array searching for a match
168:       For count = 0 To numServers - 1
169:            'aLine(6) = Server name
170:            'aLine(4) = Policy name
171:            'aLine(16) = bytes copied
172:            'If the server name and policy name match then we update information
173:            If aSvrStatus(0, count) = aLine(6) And aSvrStatus(1, count) = aLine(4) Then
174:                 'Check current status. If the current status is less that the new one from this line in the report log, then override it.
175:                 'The reason is that we want to know about ANY errors, so we don't care if drive C backed up successfully if drive D had issues.
176:                 If aSvrStatus(2, count) = "" Or aSvrStatus(2, count) &lt; aLine(3) Then
177:                      'If the status is blank, it MAY be in progress. Check the prev column too which will confirm this.
178:                      If aLine(2) = 1 And aLine(3) = "" Then
179:                           aSvrStatus(2, count) = "IP"
180:                      Else
181:                           'WScript.Echo aSvrStatus(0, count) &amp; " currently: [" &amp; aSvrStatus(2, count) &amp; "]" &amp; VbCrLf &amp; "Changing to: [" &amp; aLine(3) &amp; "]"
182:                           aSvrStatus(2, count) = aLine(3)
183:                      End If
184:                 end If
185:                 'Calculate Total Bytes. Not used. Seems inaccurate.
186:                 aSvrStatus(3, count) = aSvrStatus(3, count) + aLine(16)
187:            End If
188:       Next
189:  Loop Until objReadFile.AtEndOfStream = True
190:  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
191:  ' GO THROUGH THE ERROR LOG AND MATCH UP SERVERS AND FAILED FILES
192:  Set objReadFile = objFSO.OpenTextFile("logserrors.log", ForReading, True)
193:  count = 0
194:  Dim bUseOther : bUseOther = False
195:  Dim otherCount : otherCount = 0
196:  ReDim aSvrLogs(2, count)
197:  ReDim aOtherErrors(otherCount)
198:  Do
199:       strLine = objReadFile.ReadLine
200:       bUseOther = False
201:       'Get the server name from the string. We find the position of the word "client" then add 7 to account for that word and the space after.
202:       'We then search for the semi-colon and finish at 1 before (so as not to include the semi-colon itself.
203:       If InStr(strLine, "client ") &gt; 0 Then
204:            'Being as this text file can change format by quite a lot, we need to put a catch in here.
205:            'If we can't easily extract our information, simply append this error line to the aOtherErrors
206:            'array. At least then the error will still be captured.
207:            On Error Resume Next
208:            strServer = mid(strLine, InStr(strLine, "client ") + 7, inStr(strLine, ":") - InStr(strLine, "client ") - 7)
209:            If Err.Number &lt;&gt; 0 Then
210:                 bUseOther = True
211:            Else
212:                 'add this to the normal Array
213:                 strLine = Mid(strLine, inStr(strLine, ":") + 2)
214:                 If Err.Number &lt;&gt; 0 Then     bUseOther = True
215:            End If
216:            On Error GoTo 0
217:       Else
218:            bUseOther = True
219:       End If
220:       'Here we actually enter the data in to the correct array
221:       If Not bUseOther Then
222:            '???COULD WE LOOP THROUGH THE ARRAY LOOKING FOR DUPLICATE ENTRIES???
223:            redim preserve aSrvLogs(2, count)
224:            aSrvLogs(0, count) = strServer
225:            aSrvLogs(1, count) = strLine
226:            count = count + 1
227:       Else
228:            'If we can't easily extract a server name to associate this error to, store it in a seperate array.
229:            ReDim Preserve aOtherErrors(otherCount)
230:            aOtherErrors(otherCount) = strLine
231:            otherCount = otherCount + 1
232:       End If
233:  Loop Until objReadFile.AtEndOfStream = True
234:  'Call sub to output the details of the array (server names, errors, etc...)
235:  writeArray
236:  writeLog "e", "&lt;br&gt;&lt;p&gt;Regards,&lt;br&gt;&lt;br&gt;&lt;b&gt;Systems Engineering, 2nd Line&lt;/b&gt;&lt;br&gt;Robert Half International&lt;/p&gt;"
237:  writeLog "b", "&lt;/body&gt;"
238:  writeLog "b", "&lt;/html&gt;"
239:  filetxt.Close
240:  fileToday.Close
241:  'today.html is used by the Daily Checks spreadsheet
242:  objFSO.copyfile "reportsarchivebackupReport_" &amp; Year(Now) &amp; Month(Now) &amp; Day(Now) &amp; ".html", "reportsuk_netbackup.html"
243:  ''' EMAIL NO LONGER AUTOMATICALLY SENT. INSTEAD, THE TODAY.HTML FILE GENERATED IS USED BY ANOTHER SCRIPT
244:  ''' WHICH COLATES ALL NETBACKUP AND FILER SNAPSHOT REPORTS IN TO ONE.
245:  '''SendEmail
246:  'WScript.Echo "Done"
247:  Dim objRange
248:  ''Set objRange = objExcel.usedRange
249:  ''objRange.EntireColumn.AutoFit()
250:  ''objRange.AutoFit()
251:  ''objExcel.SaveAs("c:test.xls")
252:  ''objExcel.Quit()
253:  ' ******** END OF SCRIPT ! ********
254:  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
255:  ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
256:  ' FUNCTIONS AND SUB-ROUTINES
257:  Function logToday(hexSchedule)
258:       'All this funtion does is return TRUE if the log file was supposed to have
259:       'been run "today" (or whatever schedule was passed to it).
260:       Dim hs : hs = hexSchedule
261:       Dim isInDate : isInDate = false
262:       Dim Sun : Sun = false
263:       Dim Mon : Mon = false
264:       Dim Tues : Tues = false
265:       Dim Wed : Wed = false
266:       Dim Thur : Thur = false
267:       Dim Fri : Fri = false
268:       Dim Sat : Sat = False
269:       Dim today : today = weekday(date())
270:       ' 1 = Sunday
271:       ' 2 = Monday
272:       ' 3 = Tuesday
273:       ' 4 = Wednesday
274:       ' 5 = Thursday
275:       ' 6 = Friday
276:       ' 7 = Saturday
277:       If hs &gt;= 64 Then
278:            hs = hs - 64
279:            Sat = True
280:       End If
281:       If hs &gt;= 32 Then
282:            hs = hs - 32
283:            Fri = True
284:       End If
285:       If hs &gt;= 16 Then
286:            hs = hs - 16
287:            Thur = True
288:       End If
289:       If hs &gt;= 8 Then
290:            hs = hs - 8
291:            Wed = True
292:       End If
293:       If hs &gt;= 4 Then
294:            hs = hs - 4
295:            Tues = True
296:       End If
297:       If hs &gt;= 2 Then
298:            hs = hs - 2
299:            Mon = True
300:       End If
301:       If hs &gt;= 1 Then
302:            Sun = True
303:       End If
304:       'I've had to change this check. The servers.txt file now states
305:       'when REPORTS should be run, NOT when the clients were due to be backed up.
306:       'REPORTS DO NOT GET RUN AT THE WEEKEND SO WE DON'T NEED SATURDAY OR SUNDAY
307:       Select Case today
308:            Case 2
309:                 If Mon Then isInDate = true
310:            Case 3
311:                 If Tues Then isInDate = true
312:            Case 4
313:                 If Wed Then isInDate = true
314:            Case 5
315:                 If Thur Then isInDate = true
316:            Case 6
317:                 If Fri Then isInDate = true
318:       End select
319:       'MsgBox "logToday = " &amp; isInDate
320:       logToday = isInDate
321:  End Function
322:  Sub writeLog(bEmail, strLine)
323:       'bEmail used to be a boolean variable hence the name
324:       'b = write to both email and HTML file
325:       'e = write to email body onlly
326:       'f = write to HTML file only
327:       Select Case bEmail
328:            Case "e"
329:                 emailBody = emailBody &amp; strLine
330:                 fileToday.Writeline(strLine)
331:            Case "f"
332:                 filetxt.Writeline(strLine)
333:            Case "b"
334:                 emailBody = emailBody &amp; strLine
335:                 fileToday.Writeline(strLine)
336:                 filetxt.Writeline(strLine)
337:       End select
338:  End Sub
339:  Sub backupLogs()
340:       'On Error Resume Next
341:       Dim dayName
342:       ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
343:       'Before we start copying all the log files, we want to move
344:       'the current log folder to a temporary backup folder...
345:       'WScript.Echo "Copying LOGS folder to backup location"
346:       If objFSO.FolderExists("logs") Then
347:            dayName = Weekday(date)
348:            'Take off a day (this will be YESTERDAYS logs we are moving)
349:            dayName = dayName - 1
350:            If dayName = 0 Then dayName = 7 '0 is invalid so go back a week
351:            Select Case dayName
352:                 Case 1
353:                      dayName = "Sunday"
354:                 Case 2
355:                      dayName = "Monday"
356:                 Case 3
357:                      dayName = "Tuesday"
358:                 Case 4
359:                      dayName = "Wednesday"
360:                 Case 5
361:                      dayName = "Thursday"
362:                 Case 6
363:                      dayName = "Friday"
364:                 Case 7
365:                      dayName = "Saturday"
366:            End Select
367:            'First check if our destination folder exists. If so, remove it.
368:            If objFSO.FolderExists("logs" &amp; dayName) then
369:                 objFSO.DeleteFolder "logs" &amp; dayName
370:            End If
371:            objFSO.CopyFolder "logs", "backups" &amp; dayName, True
372:       End If
373:       'Make sure the LOGS folder exists before we begin copying logs in to it
374:       If Not objFSO.FolderExists("logs") Then
375:            objFSO.CreateFolder("logs")
376:       End If
377:       'WScript.Echo " Copied to logs" &amp; dayName
378:       ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
379:  End Sub
380:  Sub SendEmail ()
381:       'Make sure the HTML file has been closed
382:       WScript.Sleep 5000
383:       Dim strComputer, objNetwork, emailSubject, objEmail
384:       Set objNetwork = WScript.CreateObject("WScript.Network")
385:       strComputer = objNetwork.ComputerName
386:       Dim today, backupType
387:       today = weekday(now())
388:       If today = 2 Then
389:            backupType = "Weekly "
390:       Else
391:            backupType = "Daily "
392:       End If
393:       emailSubject = backupType &amp; ucase(Left(strComputer, 2)) &amp; " Backup Report for " &amp; Day(Now) &amp; "/" &amp; Month(Now) &amp; "/" &amp; Year(Now)
394:       set objEmail = CreateObject("CDO.Message")
395:       objEmail.From = "storageTeam@yourCompany.com"
396:       ''objEmail.To = "toaddress@email.com"
397:       objEmail.To = "backupReports@yourCompany.com"
398:       objEmail.Subject = emailSubject
399:       objEmail.HTMLbody = emailBody
400:       'objEmail.CreateMHTMLBody "file://c:/scripts/reports/backupReport_" &amp; Year(Now) &amp; Month(Now) &amp; Day(Now) &amp; ".html"
401:       objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
402:       objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.yourdomain.com"
403:       objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
404:       objEmail.Configuration.Fields.Update
405:       objEmail.AddAttachment "file://c:/scripts/reports/backupReport_" &amp; Year(Now) &amp; Month(Now) &amp; Day(Now) &amp; ".html"
406:       objEmail.Send
407:  End Sub
408:  Sub writeArray ()
409:       Dim count, strOne, strTwo, numSpaces, strSpaces, cntSpace, cntErrors, strError, prevGroup
410:       prevGroup = ""
411:       Dim overview
412:       Set overview = CreateObject("Scripting.Dictionary")
413:       For count = 0 To numServers - 1
414:            'If the group name In the current element of the array is not the same as before, close and start a new table
415:            If prevGroup &lt;&gt; aSvrStatus(4, count) Then
416:                 ov_func = aSvrStatus(4, count)
417:                 'If this is NOT the first iteration of the array then we must already have an open table, so close it off first...
418:                 If count &gt; 0 Then
419:                      writeLog "f", "&lt;/table&gt;"
420:                      'save current status to OV_ALL variable
421:                      ov_all = ov_all &amp; "UK Netbackup," &amp; ov_func &amp; "," &amp; ov_status &amp; VbCrLf
422:                 End If
423:                 'reset other variables
424:                 ov_fail = False
425:                 ov_status = "Success"
426:                 writeLog "f", "&lt;h2&gt;" &amp; aSvrStatus(4, count) &amp; "&lt;/h2&gt;"
427:                 If count = 0 Then
428:                      writeLog "e", "&lt;table width=""300"" id=""" &amp; aSvrStatus(4, count) &amp; """&gt;"
429:                      'Only write this to the email/today file for the first iteration
430:                      writeLog "b", "&lt;tr class=""big""&gt;&lt;td&gt;Client&lt;/td&gt;&lt;td&gt;Policy&lt;/td&gt;&lt;td&gt;Status&lt;/td&gt;&lt;td&gt;Warnings&lt;/td&gt;&lt;/tr&gt;"
431:                 End If
432:                 writeLog "f", "&lt;table id=""" &amp; aSvrStatus(4, count) &amp; """&gt;"
433:                 writeLog "f", "&lt;tr class=""big""&gt;&lt;td&gt;Client&lt;/td&gt;&lt;td&gt;Policy&lt;/td&gt;&lt;td&gt;Status&lt;/td&gt;&lt;td&gt;Warnings&lt;/td&gt;&lt;/tr&gt;"
434:            End If
435:            'Now we have done our check, reset the variable for checking in the next iteration of the loop
436:            prevGroup = aSvrStatus(4, count)
437:            writeLog "b", "&lt;tr&gt;"
438:            strOne = aSvrStatus(0, count)
439:            strTwo = aSvrStatus(2, count)
440:            If Len(strOne) &lt; 8 Then
441:                 strOne = strOne &amp; "  "
442:            End If
443:            Select Case strTwo
444:                 Case "IP"
445:                      strTwo = "&lt;font color=""orange""&gt;In progress&lt;/font&gt;"
446:                      ov_status = "Failure" : ov_fail = True
447:                 Case "0"
448:                      strTwo = "&lt;font color=""blue""&gt;Success&lt;/font&gt;"
449:                 Case "1"
450:                      strTwo = "Success (with warnings)"
451:                      If not ov_fail Then
452:                           ov_status = strTwo
453:                      End If
454:                 Case "11"
455:                      strTwo = "&lt;font color=""red""&gt;FAILURE - System call failed (UKNOWN ERROR)&lt;/font&gt;"
456:                      ov_status = "Failure" : ov_fail = True
457:                 Case "48"
458:                      strTwo = "&lt;font color=""red""&gt;FAILURE - Could not contact client&lt;/font&gt;"
459:                      ov_status = "Failure" : ov_fail = True
460:                 Case "58"
461:                      strTwo = "&lt;font color=""red""&gt;FAILURE - Could not connect to client&lt;/font&gt;"
462:                      ov_status = "Failure" : ov_fail = True
463:                 Case "96"
464:                      strTwo = "&lt;font color=""red""&gt;FAILURE - No media available&lt;/font&gt;"
465:                      ov_status = "Failure" : ov_fail = True
466:                 Case "150"
467:                      strTwo = "&lt;font color=""red""&gt;FAILURE - Cancelled by administrator&lt;/font&gt;"
468:                      ov_status = "Failure" : ov_fail = True
469:                 Case "156"
470:                      strTwo = "&lt;font color=""red""&gt;FAILURE - Snapshot error encountered&lt;/font&gt;"
471:                      ov_status = "Failure" : ov_fail = True
472:                 Case "196"
473:                      strTwo = "&lt;font color=""red""&gt;FAILURE - Backup window expired&lt;/font&gt;"
474:                      ov_status = "Failure" : ov_fail = True
475:                 Case "200"
476:                      strTwo = "&lt;font color=""red""&gt;FAILURE - Scheduler found no backups due to run&lt;/font&gt;"
477:                      ov_status = "Failure" : ov_fail = True
478:                 Case "800"
479:                      strTwo = "&lt;font color=""red""&gt;FAILURE - Resource request failed&lt;/font&gt;"
480:                      ov_status = "Failure" : ov_fail = True
481:                 Case ""
482:                      strTwo = "&lt;font color=""orange""&gt;Queued...&lt;/font&gt;"
483:                      ov_status = "Failure"
484:                 Case Else
485:                      strTwo = "Error Code: " &amp; strTwo
486:                      ov_status = "Success (with warnings)"
487:            End Select
488:            numSpaces = 20 - Len(strOne)
489:            For cntSpace = 1 To 20
490:                 strSpaces = strSpaces &amp; " "
491:            Next
492:            writeLog "b", "&lt;td nowrap&gt;" &amp; strOne &amp; "&lt;/td&gt;&lt;td nowrap&gt;" &amp; aSvrStatus(1, count) &amp; "&lt;/td&gt;&lt;td nowrap&gt;" &amp; strTwo &amp; "&lt;/td&gt;"
493:            writeLog "b", "&lt;td&gt;"
494:            'If this is a mailstore policy do not output the failed files, since they would have already
495:            'been reported against the flatfile backup for that server. Any additional errors should be
496:            'in the aOtherErrors array.
497:            If inStr(aSvrStatus(1, count), "mail") &gt; 0 Then
498:                 writeLog "b", "&lt;i&gt;see below for potential mailstore warnings&lt;/i&gt;"
499:            Else
500:                 On Error Resume Next
501:                 For cntErrors = 0 To UBound(aSrvLogs,2)
502:                      'WScript.Echo "Pass " &amp; cntErrors &amp; ". "
503:                      'WScript.echo "strOne = " &amp; strOne
504:                      'wscript.Echo "aSrvLogs(0, cntErrors) = " &amp; aSrvLogs(0, cntErrors)
505:                      If Trim(strOne) = trim(aSrvLogs(0, cntErrors)) Then
506:                           strError = aSrvLogs(1, cntErrors)
507:                           'Trim off unnecessary text:
508:                           strError = Replace(strError, "WRN - ", "")
509:                           strError = Replace(strError, "ERR - ", "")
510:                           strError = Replace(strError, "can't open file: ", "")
511:                           strError = Replace(strError, "failure reading file: ", "")
512:                           writeLog "b", "&amp;bull; " &amp; strError &amp; "&lt;br/&gt;"
513:                      'Else
514:                      '     writeLog "f", "&amp;nbsp;"
515:                      End If
516:                 Next
517:                 On Error GoTo 0
518:            End If
519:            If overview.Exists(aSvrStatus(4, count)) Then
520:                 'Function already exists, so just update status ONLY if it is worse that is currently held
521:                 select case ov_status
522:                      Case "Failure"
523:                           'Status is as bad as it'll get so we'd may as well write it
524:                           overview.Item(aSvrStatus(4, count)) = ov_status
525:                      Case "Success (with warnings)"
526:                           if overview.Item(aSvrStatus(4, count)) &lt;&gt; "Failure" Then
527:                                overview.Item(aSvrStatus(4, count)) = ov_status
528:                           End If
529:                      Case "Success"
530:                           if overview.Item(aSvrStatus(4, count)) &lt;&gt; "Failure" and overview.Item(aSvrStatus(4, count)) &lt;&gt; "Success (with warnings)" Then
531:                                overview.Item(aSvrStatus(4, count)) = ov_status
532:                           End If
533:                 End select
534:            Else
535:                 'Function does NOT exist so create it and write the status
536:                 overview.Add aSvrStatus(4, count), ov_status
537:            End If
538:            writeLog "f", "&lt;/td&gt;"
539:            writeLog "b", "&lt;/tr&gt;"
540:       Next
541:       'save current status to OV_ALL variable
542:       ov_all = overview.Keys
543:       ov_all_status = overview.Items
544:       writeLog "b", "&lt;/table&gt;"
545:       writeLog "f", "&lt;p style=""font-size: x-small""&gt;The following minor errors were unable to be associated to a particular job/client...&lt;/p&gt;&lt;p style=""font-size: x-small""&gt;"
546:       For cntErrors = 0 To UBound(aOtherErrors)
547:            writeLog "f", "&amp;bull; " &amp; aOtherErrors(cntErrors) &amp; "&lt;br/&gt;"
548:       Next
549:       writeLog "f", "&lt;/p&gt;"
550:       Dim aCount
551:       For aCount = 0 To overview.Count - 1
552:            statusFile.WriteLine "UK Netbackup," &amp; ov_all(aCount) &amp; "," &amp; ov_all_status(aCount)
553:       Next
554:       'statusFile.Write ov_all
555:       statusFile.close
556:  End Sub
</code></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwarburton.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwarburton.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwarburton.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwarburton.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwarburton.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwarburton.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwarburton.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwarburton.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwarburton.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwarburton.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=32&subd=davidwarburton&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davidwarburton.net/2010/02/25/generatereport-vbs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3a54ad2551bd756d17e5f75aab3c2acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">DavidWarburton</media:title>
		</media:content>
	</item>
		<item>
		<title>jobs_report.bat</title>
		<link>http://blog.davidwarburton.net/2010/02/25/jobs_report-bat/</link>
		<comments>http://blog.davidwarburton.net/2010/02/25/jobs_report-bat/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 13:32:24 +0000</pubDate>
		<dc:creator>DavidWarburton</dc:creator>
				<category><![CDATA[Batch]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://davidwarburton.wordpress.com/2010/02/25/jobs_report-bat/</guid>
		<description><![CDATA[This batch is called by the main generateReport.vbs script. It used built-in Netbackup command line utilities to output the contents of the NBU database report section to a CSV whith the VBscript then imports. 1: REM *** THIS BATCH FILE IS CALLED AUTOMATICALLY BY generateReports.bat *** 2: REM *** Run bpdbjobs for todays report... 3: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=26&subd=davidwarburton&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>This batch is called by the main <a href="/generatereport-vbs/">generateReport.vbs</a> script. It used built-in Netbackup command line utilities to output the contents of the NBU database report section to a CSV whith the VBscript then imports.</p>
<pre style="font-family:arial;font-size:12px;border:1px dashed #cccccc;width:99%;height:auto;overflow:auto;background:url('http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif') repeat scroll 0 0 #f0f0f0;color:#000000;text-align:left;line-height:20px;padding:0;"><code style="color:#000000;">1:  REM *** THIS BATCH FILE IS CALLED AUTOMATICALLY BY generateReports.bat ***
2:  REM *** Run bpdbjobs for todays report...
3:  @bpdbjobs -report -gdm &gt; logs\report.csv
4:  REM *** Run again to add to master report...
5:  @bpdbjobs -report -gdm &gt;&gt; backups\reports_master.csv
</code></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwarburton.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwarburton.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwarburton.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwarburton.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwarburton.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwarburton.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwarburton.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwarburton.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwarburton.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwarburton.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=26&subd=davidwarburton&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davidwarburton.net/2010/02/25/jobs_report-bat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3a54ad2551bd756d17e5f75aab3c2acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">DavidWarburton</media:title>
		</media:content>
	</item>
		<item>
		<title>job_summary.bat</title>
		<link>http://blog.davidwarburton.net/2010/02/25/job_summary-bat/</link>
		<comments>http://blog.davidwarburton.net/2010/02/25/job_summary-bat/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 13:30:07 +0000</pubDate>
		<dc:creator>DavidWarburton</dc:creator>
				<category><![CDATA[Batch]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://davidwarburton.wordpress.com/?p=23</guid>
		<description><![CDATA[This simple batch simply generates a summary of recent jobs (total, number failed, etc&#8230;) 1: REM *** THIS BATCH FILE IS CALLED AUTOMATICALLY BY generateReports.vbs *** 2: @bpdbjobs -summary -L &#62; logs\summary.log<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=23&subd=davidwarburton&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<p>This simple batch simply generates a summary of recent jobs (total, number failed, etc&#8230;)</p>
<pre style="font-family:arial;font-size:12px;border:1px dashed #cccccc;width:99%;height:auto;overflow:auto;background:url('http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif') repeat scroll 0 0 #f0f0f0;color:#000000;text-align:left;line-height:20px;padding:0;"><code style="color:#000000;">1:  REM *** THIS BATCH FILE IS CALLED AUTOMATICALLY BY generateReports.vbs ***
2:  @bpdbjobs -summary -L &gt; logs\summary.log
</code></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davidwarburton.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davidwarburton.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/davidwarburton.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/davidwarburton.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/davidwarburton.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/davidwarburton.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/davidwarburton.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/davidwarburton.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/davidwarburton.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/davidwarburton.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.davidwarburton.net&blog=11246690&post=23&subd=davidwarburton&ref=&feed=1" />]]></content:encoded>
			<wfw:commentRss>http://blog.davidwarburton.net/2010/02/25/job_summary-bat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3a54ad2551bd756d17e5f75aab3c2acd?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">DavidWarburton</media:title>
		</media:content>
	</item>
	</channel>
</rss>