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

<channel>
	<title>SQLvariations: SQL Server, a little PowerShell, maybe some Hyper-V &#187; SQL Server</title>
	<atom:link href="http://sqlvariant.com/wordpress/index.php/category/sql-server/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlvariant.com/wordpress</link>
	<description>maybe even the occasional ETL tidbit</description>
	<lastBuildDate>Wed, 01 Feb 2012 20:15:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>My First MSSQLTip!</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/11/my-first-mssqltip/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/11/my-first-mssqltip/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 02:48:45 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[Denali CTP3]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[MSSQLTip]]></category>
		<category><![CDATA[SQL Server 2012 CTP3]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2011/11/my-first-mssqltip/</guid>
		<description><![CDATA[Today my first ever MSSQLTip was published.&#160; Before you ask: Yes, it talked about PowerShell. It came about because some of the SQL MVPs were trying to figure out the best way to download a VM that had been split up into 36 different equal-sized files.&#160; I’m sure there’s a better way than this but at the same time it took me about 4 minutes to write.&#160; Write is the wrong term, more like copy/paste/change a few things. Give it a whirl and let me know what you think!&#160;]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mssqltips.com/sqlservertip/2540/simple-way-to-download-sql-denali-ctp3-vm-from-microsoft-using-powershell/"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/11/image1.png" width="349" height="113" /></a>Today my <a href="http://www.mssqltips.com/sqlservertip/2540/simple-way-to-download-sql-denali-ctp3-vm-from-microsoft-using-powershell/">first ever MSSQLTip</a> was published.&#160; Before you ask: Yes, it talked about PowerShell.</p>
<p>It came about because some of the SQL MVPs were trying to figure out the best way to download a VM that had been split up into 36 different equal-sized files.&#160; I’m sure there’s a better way than this but at the same time it <strong>took me about 4 minutes to write</strong>.&#160; Write is the wrong term, more like <a href="http://sqlvariant.com/wordpress/index.php/powershell-script-to-download-sql-mcm-videos/">copy</a>/<a href="http://www.microsoft.com/download/en/details.aspx?id=27740">paste</a>/change a few things.</p>
<p>Give it a whirl and let me know what you think!&#160; <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/11/wlEmoticon-smile.png" /></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/11/my-first-mssqltip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Resources for my SQL Server PowerShell Extensions webcast</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/10/resources-for-my-sql-server-powershell-extensions-webcast/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/10/resources-for-my-sql-server-powershell-extensions-webcast/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 21:03:05 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[Denali CTP3]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[SQL Server 2012]]></category>
		<category><![CDATA[SQLPSX]]></category>
		<category><![CDATA[Webcast]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2011/10/resources-for-my-sql-server-powershell-extensions-webcast/</guid>
		<description><![CDATA[I did another webcast for the Secrets of SQL Server webcast series today.  In the today’s webcast we built on some things I had demoed in a prior webcast and showed how PowerShell in conjunction with SQLPSX can really help you solve some common problems DBAs face. I showed how you could pull size and free space information from all of your data files, then used the same technique to pull size information from all of your tables across every database on an instance.  Later we created a database and some tables, and then showed how to do some basic login comparisons, all with SQLPSX. In addition, we stored the results of the frees pace and table size information in a database using the Out-DataTable and Write-DataTable functions.  Finally we wrapped up with a quick demo on how the new SQL Server cmdlets inside of the SQLPS Module in Denali combined with some new functionality in PowerShell v3 CTP1 can really make backing up a database with PowerShell a lot easier. Here’s what you’ll need to recreate today’s demos; Download and install SQLPSX The Out-DataTable function from the TechNet script repository The Write-DataTable function from the TechNet script repository and these scripts Oh, and here are the handful of slides that I had I hope I see you next week at the PASS Summit or next month during another webcast, this time on customizing your own functions to work with the SMO.]]></description>
			<content:encoded><![CDATA[<p><a href="http://a1100.v46030f.c46030.g.vm.akamaistream.net/7/1100/46030/v0001/smb2.download.akamai.com/46030/Idera/100511-SQLSP01/100511-SQLSP01_archive.wmv"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/10/image_thumb.png" alt="image" width="220" height="244" align="right" border="0" /></a>I did another<strong> <a href="http://a1100.v46030f.c46030.g.vm.akamaistream.net/7/1100/46030/v0001/smb2.download.akamai.com/46030/Idera/100511-SQLSP01/100511-SQLSP01_archive.wmv">webcast </a></strong>for the <a href="http://www.idera.com/Education/SQL-server-Webcasts/">Secrets of SQL Server</a> webcast series today.  In the today’s webcast we built on some things I had demoed in a <a href="http://www.idera.com/Events/RegisterWC.aspx?EventID=232">prior webcast</a> and showed how PowerShell in conjunction with <strong><a href="http://sqlpsx.codeplex.com/">SQLPSX</a></strong> can really help you solve some common problems DBAs face.</p>
<p>I showed how you could pull size and free space information from all of your data files, then used the same technique to pull size information from all of your tables across every database on an instance.  Later we created a database and some tables, and then showed how to do some basic login comparisons, all with SQLPSX.</p>
<p>In addition, we stored the results of the frees pace and table size information in a database using the Out-DataTable and Write-DataTable functions.  Finally we wrapped up with a quick demo on how the new SQL Server cmdlets inside of the SQLPS Module in Denali combined with some new functionality in PowerShell v3 CTP1 can really make backing up a database with PowerShell a lot easier.</p>
<p>Here’s what you’ll need to recreate today’s demos;</p>
<ul>
<li>Download and install <a href="http://sqlpsx.codeplex.com/"><strong>SQLPSX</strong></a></li>
<li>The <a href="http://gallery.technet.microsoft.com/scriptcenter/4208a159-a52e-4b99-83d4-8048468d29dd"><strong>Out-DataTable</strong></a> function from the TechNet script repository</li>
<li>The <strong><a href="http://gallery.technet.microsoft.com/scriptcenter/2fdeaf8d-b164-411c-9483-99413d6053ae">Write-DataTable</a></strong> function from the TechNet script repository</li>
<li>and <strong><a href="http://SQLvariant.com/BlogSupport/Scripts/PowerShell/SoSS_Webcast2.zip">these scripts</a></strong></li>
<li>Oh, and here are the handful of <a href="http://SQLvariant.com/BlogSupport/SlideDecks/SoSS-GetMoreDoneWithSQLPSX.pptx">slides</a> that I had</li>
</ul>
<p>I hope I see you next week at the PASS Summit or next month during another webcast, this time on customizing your own functions to work with the SMO.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/10/resources-for-my-sql-server-powershell-extensions-webcast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://a1100.v46030f.c46030.g.vm.akamaistream.net/7/1100/46030/v0001/smb2.download.akamai.com/46030/Idera/100511-SQLSP01/100511-SQLSP01_archive.wmv" length="0" type="video/asf" />
		</item>
		<item>
		<title>New PowerShell Cmdlets in SQL Denali CTP3</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/07/new-powershell-cmdlets-in-sql-denali-ctp3/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/07/new-powershell-cmdlets-in-sql-denali-ctp3/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 13:38:27 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[CTP3]]></category>
		<category><![CDATA[Denali]]></category>
		<category><![CDATA[IntegrationServices]]></category>
		<category><![CDATA[SQLAS]]></category>
		<category><![CDATA[XEvent]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=2243</guid>
		<description><![CDATA[CTP3 of SQL Denali is finally publicly available! I woke up at 5 am this morning to kick off my download.  I&#8217;ve finished the install and I&#8217;m happy that I can finally report that we have new cmdlets for SQL Server.  First off, after running Get-Module -ListAvailable I saw: Manifest   SQLASCMDLETS Manifest   SQLPS This means that SQLPS inside of SQL Agent should finally allow you to import a module during your job step.  There is now a Function called SQLServer that, from what I can tell, is the SQLServer Provider.  When under PS SQLSERVER:\&#62; if you do a dir &#124; Select pschildname you will find the following list: PSChildName &#8212;&#8212;&#8212;&#8211; SQL SQLPolicy SQLRegistration DataCollection XEvent Utility DAC IntegrationServices SQLAS From my notes it looks like XEvent, IntegrationServices, and SQLAS are the directories that have been added here.  Can&#8217;t wait to try out the IntegrationServices portion!  [Update]: Apparently I may need a defaul instance install for this to work. I also noticed that Tab-Completion appears to be fixed!!    Also, SQL Registrations &#62; &#8216;Database Engine Server Group&#8217; are split up into instances like CMS was.  Not sure what that&#8217;s all about just yet.  In fact when I try to use it, it doesn&#8217;t seem to work.  Maybe I should read the help files.  But I think they may have just gotten CMS &#38; RS reversed.  CMS isn&#8217;t working for me either yet. When you drill down under XEvents and go to your Denali instaince you will see: Packages, &#38; Sessions.  I guess this means that I finally need to read Jonathat&#8217;s blog series on X-Events. When I imported the SQLPS module I received a warning about unapproved verbs.  Oh well, hopefully they&#8217;ll work that out soon.  Next I ran Get-Command -Module &#8220;SQLPS&#8221; and found the following list of cmdlets. Name Module Add-SqlAvailabilityDatabase SQLPS Add-SqlAvailabilityGroupListenerStaticIp SQLPS Backup-SqlDatabase SQLPS Convert-UrnToPath SQLPS Decode-SqlName SQLPS Disable-SqlHADRService SQLPS Enable-SqlHADRService SQLPS Encode-SqlName SQLPS Invoke-PolicyEvaluation SQLPS Invoke-Sqlcmd SQLPS Join-SqlAvailabilityGroup SQLPS New-SqlAvailabilityGroup SQLPS New-SqlAvailabilityGroupListener SQLPS New-SqlAvailabilityReplica SQLPS New-SqlHADREndpoint SQLPS Remove-SqlAvailabilityDatabase SQLPS Remove-SqlAvailabilityGroup SQLPS Remove-SqlAvailabilityReplica SQLPS Restore-SqlDatabase SQLPS Resume-SqlAvailabilityDatabase SQLPS Set-SqlAvailabilityGroup SQLPS Set-SqlAvailabilityGroupListener SQLPS Set-SqlAvailabilityReplica SQLPS Set-SqlHADREndpoint SQLPS SQLSERVER SQLPS Suspend-SqlAvailabilityDatabase SQLPS Switch-SqlAvailabilityGroup SQLPS Test-SqlAvailabilityGroup SQLPS Test-SqlAvailabilityReplica SQLPS Test-SqlDatabaseReplicaState SQLPS Analysis Services got some love too in the form of 11 cmdlets!  After inporting the SQLASCMDLETS module I ran this Get-Command -Module &#8220;SQLASCMDLETS&#8221; and found the following. Name Module Add-RoleMember SQLASCMDLETS Backup-ASDatabase SQLASCMDLETS Invoke-ASCmd SQLASCMDLETS Invoke-ProcessCube SQLASCMDLETS Invoke-ProcessDimension SQLASCMDLETS Invoke-ProcessPartition SQLASCMDLETS Merge-Partition SQLASCMDLETS New-RestoreFolder SQLASCMDLETS New-RestoreLocation SQLASCMDLETS Remove-RoleMember SQLASCMDLETS Restore-ASDatabase SQLASCMDLETS More news to follow soon!]]></description>
			<content:encoded><![CDATA[<p>CTP3 of SQL Denali is finally <a href="https://www.microsoft.com/betaexperience/pd/SQLDCTP3CTA/enus/default.aspx" target="_blank">publicly available</a>!</p>
<p>I woke up at 5 am this morning to kick off my download.  I&#8217;ve finished the install and I&#8217;m happy that I can finally report that we have new cmdlets for SQL Server. </p>
<p>First off, after running <span style="color: #0000ff;">Get-Module</span> <span style="color: #000080;">-ListAvailable</span> I saw:</p>
<p>Manifest   SQLASCMDLETS<br />
Manifest   SQLPS</p>
<p>This means that SQLPS inside of SQL Agent should finally allow you to import a module during your job step. </p>
<p>There is now a Function called SQLServer that, from what I can tell, is the SQLServer Provider.  When under PS SQLSERVER:\&gt; if you do a <span style="color: #0000ff;">dir</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Select</span> <span style="color: #8a2be2;">pschildname</span> you will find the following list:</p>
<p>PSChildName<br />
&#8212;&#8212;&#8212;&#8211;<br />
SQL<br />
SQLPolicy<br />
SQLRegistration<br />
DataCollection<br />
<strong>XEvent</strong><br />
Utility<br />
DAC<br />
<strong>IntegrationServices</strong><br />
<strong>SQLAS</strong></p>
<p>From my notes it looks like <strong><span style="color: #003366;">XEvent</span></strong>, <strong><span style="color: #003366;">IntegrationServices</span></strong>, and <strong><span style="color: #003366;">SQLAS </span></strong>are the directories that have been added here.  Can&#8217;t wait to try out the IntegrationServices portion!  [Update]: Apparently I may need a defaul instance install for this to work.</p>
<p>I also noticed that <span style="color: #003300;"><strong>Tab-Completion </strong></span>appears to be fixed!!  <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   Also, SQL Registrations &gt; &#8216;Database Engine Server Group&#8217; are split up into instances like CMS was.  Not sure what that&#8217;s all about just yet.  In fact when I try to use it, it doesn&#8217;t seem to work.  Maybe I should read the help files.  But I think they may have just gotten CMS &amp; RS reversed.  CMS isn&#8217;t working for me either yet.</p>
<p>When you drill down under XEvents and go to your Denali instaince you will see: Packages, &amp; Sessions.  I guess this means that I finally need to read Jonathat&#8217;s blog series on X-Events.</p>
<p>When I imported the SQLPS module I received a warning about unapproved verbs.  Oh well, hopefully they&#8217;ll work that out soon.  Next I ran <strong><span style="color: #0000ff;">Get-Command</span> <span style="color: #000080;">-Module</span> <span style="color: #8b0000;">&#8220;SQLPS&#8221;</span></strong> and found the following list of cmdlets.</p>
<table border="0" cellspacing="0" cellpadding="0" width="370">
<colgroup span="1">
<col span="1" width="267"></col>
<col span="1" width="103"></col>
</colgroup>
<tbody>
<tr height="20">
<td width="267" height="20">Name</td>
<td width="103">Module</td>
</tr>
<tr height="20">
<td height="20">Add-SqlAvailabilityDatabase</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Add-SqlAvailabilityGroupListenerStaticIp</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Backup-SqlDatabase</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Convert-UrnToPath</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Decode-SqlName</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Disable-SqlHADRService</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Enable-SqlHADRService</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Encode-SqlName</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Invoke-PolicyEvaluation</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Invoke-Sqlcmd</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Join-SqlAvailabilityGroup</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">New-SqlAvailabilityGroup</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">New-SqlAvailabilityGroupListener</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">New-SqlAvailabilityReplica</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">New-SqlHADREndpoint</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Remove-SqlAvailabilityDatabase</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Remove-SqlAvailabilityGroup</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Remove-SqlAvailabilityReplica</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Restore-SqlDatabase</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Resume-SqlAvailabilityDatabase</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Set-SqlAvailabilityGroup</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Set-SqlAvailabilityGroupListener</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Set-SqlAvailabilityReplica</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Set-SqlHADREndpoint</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">SQLSERVER</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Suspend-SqlAvailabilityDatabase</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Switch-SqlAvailabilityGroup</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Test-SqlAvailabilityGroup</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Test-SqlAvailabilityReplica</td>
<td>SQLPS</td>
</tr>
<tr height="20">
<td height="20">Test-SqlDatabaseReplicaState</td>
<td>SQLPS</td>
</tr>
</tbody>
</table>
<p>Analysis Services got some love too in the form of 11 cmdlets!  After inporting the SQLASCMDLETS module I ran this <span style="color: #0000ff;">Get-Command</span> <span style="color: #000080;">-Module</span> <span style="color: #8b0000;">&#8220;SQLASCMDLETS&#8221;</span> and found the following.</p>
<table border="0" cellspacing="0" cellpadding="0" width="370">
<colgroup span="1">
<col span="1" width="267"></col>
<col span="1" width="103"></col>
</colgroup>
<tbody>
<tr height="20">
<td width="267" height="20">Name</td>
<td width="103">Module</td>
</tr>
<tr height="20">
<td height="20">Add-RoleMember</td>
<td>SQLASCMDLETS</td>
</tr>
<tr height="20">
<td height="20">Backup-ASDatabase</td>
<td>SQLASCMDLETS</td>
</tr>
<tr height="20">
<td height="20">Invoke-ASCmd</td>
<td>SQLASCMDLETS</td>
</tr>
<tr height="20">
<td height="20">Invoke-ProcessCube</td>
<td>SQLASCMDLETS</td>
</tr>
<tr height="20">
<td height="20">Invoke-ProcessDimension</td>
<td>SQLASCMDLETS</td>
</tr>
<tr height="20">
<td height="20">Invoke-ProcessPartition</td>
<td>SQLASCMDLETS</td>
</tr>
<tr height="20">
<td height="20">Merge-Partition</td>
<td>SQLASCMDLETS</td>
</tr>
<tr height="20">
<td height="20">New-RestoreFolder</td>
<td>SQLASCMDLETS</td>
</tr>
<tr height="20">
<td height="20">New-RestoreLocation</td>
<td>SQLASCMDLETS</td>
</tr>
<tr height="20">
<td height="20">Remove-RoleMember</td>
<td>SQLASCMDLETS</td>
</tr>
<tr height="20">
<td height="20">Restore-ASDatabase</td>
<td>SQLASCMDLETS</td>
</tr>
</tbody>
</table>
<p>More news to follow soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/07/new-powershell-cmdlets-in-sql-denali-ctp3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why I Need a Week of SQLskills Immersion</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/01/why-i-need-a-week-of-sqlskills-immersion/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/01/why-i-need-a-week-of-sqlskills-immersion/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 05:09:39 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2011/01/why-i-need-a-week-of-sqlskills-immersion/</guid>
		<description><![CDATA[SQLskills is giving back to the community with a free seat to their training class in Dallas next month (Feb. 21st – 25th) To answer Paul Randal’s question of why I should get to win a week of training from SQLskills this is what I have to say: Plain and Simple.&#160; I’m a Second Generation DBA with over a decade of experience with SQL Server.&#160; I want some deep level ideas for some new PowerShell scripts to simply tasks for DBAs everywhere.&#160; I’ll also spend countless hours telling all my fellow DBAs here in Atlanta what all I learned until they can take it no more and demand this level of top-notch training for themselves!&#160; I’ll get started with the PowerShell scripts right now even.&#160; This little script will search twitter for a giver hashtag, in this case: #SQLskills.&#160; It will then save everything it finds off to an XML file and then query it: $SearchHashtag = &#34;sqlskills&#34; $wc = new-object net.webclient $url = &#34;http://search.twitter.com/search.atom?q=%23$SearchHashtag&#34; $OutFile = &#34;c:\temp\Download_$($SearchHashtag)_$([DateTime]::Now.ToString('yyyyMMddHHmmss')).xml&#34; $wc.DownloadString($url) &#124; add-content $OutFile; [xml]$tweetxml = get-content $OutFile $tweetxml.feed.entry &#124; Format-List ($tweetxml.feed.entry).count]]></description>
			<content:encoded><![CDATA[<p>SQLskills is giving back to the community with a free seat to their <a href="http://www.sqlskills.com/Master1-Dallas-20110221.asp">training class in Dallas next month (Feb. 21st – 25th)</a></p>
<p>To answer Paul Randal’s question of <a href="http://www.sqlskills.com/BLOGS/PAUL/post/Master_Immersion_Event_Competition.aspx">why I should get to win a week of training from SQLskills</a> this is what I have to say:</p>
<p>Plain and Simple.&#160; I’m a Second Generation DBA with over a decade of experience with SQL Server.&#160; I want some deep level ideas for some new PowerShell scripts to simply tasks for DBAs everywhere.&#160; I’ll also spend countless hours telling all my fellow DBAs here in Atlanta what all I learned until they can take it no more and demand this level of top-notch training for themselves!&#160; <img style="border-bottom-style: none; border-right-style: none; border-top-style: none; border-left-style: none" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/wlEmoticon-openmouthedsmile1.png" /></p>
<p>I’ll get started with the PowerShell scripts right now even.&#160; This little script will search twitter for a giver hashtag, in this case: #SQLskills.&#160; It will then save everything it finds off to an XML file and then query it:</p>
<pre style="width: 539px; height: 280px" class="PowerShellColorizedScript"><span style="color: #ff4500">$SearchHashtag</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;sqlskills&quot;</span>            

<span style="color: #ff4500">$wc</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">new-object</span> <span style="color: #8a2be2">net.webclient</span>
<span style="color: #ff4500">$url</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;http://search.twitter.com/search.atom?q=%23$SearchHashtag&quot;</span>
<span style="color: #ff4500">$OutFile</span> <span style="color: #a9a9a9">=</span> <span style="color: #8b0000">&quot;c:\temp\Download_$($SearchHashtag)_$([DateTime]::Now.ToString('yyyyMMddHHmmss')).xml&quot;</span>
<span style="color: #ff4500">$wc</span><span style="color: #a9a9a9">.</span><span style="color: #000000">DownloadString</span><span style="color: #000000">(</span><span style="color: #ff4500">$url</span><span style="color: #000000">)</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">add-content</span> <span style="color: #ff4500">$OutFile</span><span style="color: #000000">;</span>            

<span style="color: #008080">[xml]</span><span style="color: #ff4500">$tweetxml</span> <span style="color: #a9a9a9">=</span> <span style="color: #0000ff">get-content</span> <span style="color: #ff4500">$OutFile</span>            

<span style="color: #ff4500">$tweetxml</span><span style="color: #a9a9a9">.</span><span style="color: #000000">feed</span><span style="color: #a9a9a9">.</span><span style="color: #000000">entry</span> <span style="color: #a9a9a9">|</span> <span style="color: #0000ff">Format-List</span>            

<span style="color: #000000">(</span><span style="color: #ff4500">$tweetxml</span><span style="color: #a9a9a9">.</span><span style="color: #000000">feed</span><span style="color: #a9a9a9">.</span><span style="color: #000000">entry</span><span style="color: #000000">)</span><span style="color: #a9a9a9">.</span><span style="color: #000000">count</span>            </pre>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/01/why-i-need-a-week-of-sqlskills-immersion/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Is the Connect Feed for SQL Server in Your Reader?</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/01/is-the-connect-feed-for-sql-server-in-your-reader/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/01/is-the-connect-feed-for-sql-server-in-your-reader/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 15:08:56 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Connect]]></category>
		<category><![CDATA[Out-GridView]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2011/01/is-the-connect-feed-for-sql-server-in-your-reader/</guid>
		<description><![CDATA[Last week Nicolas Cain ( blog &#124; twitter ) Rob Farley ( blog &#124; twitter ) Aaron Bertrand ( blog &#124; twitter ) and I were all working together on a small skunk-works project to read in all of of the items on the SQL-Connect website (more in that project in a later post).  A few hours into this process I realized “hey, I don’t even have this RSS feed in my Reader!”  I’m not sure why I didn’t; maybe I was lulled into safety by Aaron Bertrand’s “Connect Digests” but unfortunately he doesn’t do those any more. So I just wanted to encourage everyone who makes their living off of SQL Server to take a minute to add these two RSS feeds to your favorite feed-reader.  https://connect.microsoft.com/rss/68/RecentFeedbackForConnection.xml https://connect.microsoft.com/rss/68/RecentlyModifiedFeedbackForConnection.xml If you haven’t been on Connect for a while and wonder what’s out there, well I’ve got a PowerShell script for you   Invoke-Sqlcmd -ServerInstance denali.db.5026258.hostedresource.com ` -Database denali -Username denaliconnect -Password Wide0pen -Query " SELECT ID , Title , ItemStatus , UpVoteCount , DownVoteCount , ItemDescription , Author , Modified , ValidationCount , WorkAroundCount , URL , OpenedDate FROM denali.dbo.ConnectItems" &#124; out-gridview OK, you can totally take that login info and use your SQL Management Studio to connect to this database too but I wanted to show you a REALLY cool use for the Out-GridView command.  When run the PowerShell script and the window pops up Just Click on + Add Criteria &#62; ItemDescription &#62; Add. Like this: Then just type in a search term like “SSIS” and see what you get back… Rob has also put together a way to search the data that is much better and where we hope to ultimately go with it.  Again, that’s all for another post.]]></description>
			<content:encoded><![CDATA[<p>Last week <strong>Nicolas Cain</strong> ( <a href="http://www.englishtosql.com/">blog</a> | <a href="http://twitter.com/anonythemouse">twitter</a> ) Rob Farley ( <a href="http://sqlblog.com/blogs/rob_farley">blog</a> | <a href="http://www.twitter.com/rob_farley">twitter</a> ) Aaron Bertrand ( <a href="http://sqlblog.com/blogs/aaron_bertrand/default.aspx">blog</a> | <a href="http://twitter.com/AaronBertrand">twitter</a> ) and I were all working together on a <a href="http://www.englishtosql.com/english-to-sql-blog/2011/1/5/loading-microsoft-connect-items-to-a-databaseintro.html">small skunk-works project</a> to read in all of of the items on the <a href="https://connect.microsoft.com/SQLServer">SQL-Connect website</a> (more in that project in a later post).  A few hours into this process I realized <strong>“hey, I don’t even have this RSS feed in my Reader!”</strong>  I’m not sure why I didn’t; maybe I was lulled into safety by Aaron Bertrand’s “Connect Digests” but unfortunately he doesn’t do those any more. <img class="wlEmoticon wlEmoticon-cryingface" style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/wlEmoticon-cryingface.png" alt="Crying face" /></p>
<h3>So I just wanted to encourage everyone who makes their living off of SQL Server to take a minute to add these two RSS feeds to your favorite feed-reader. </h3>
<p><a title="https://connect.microsoft.com/rss/68/RecentFeedbackForConnection.xml" href="https://connect.microsoft.com/rss/68/RecentFeedbackForConnection.xml">https://connect.microsoft.com/rss/68/RecentFeedbackForConnection.xml</a></p>
<p><a title="https://connect.microsoft.com/rss/68/RecentlyModifiedFeedbackForConnection.xml" href="https://connect.microsoft.com/rss/68/RecentlyModifiedFeedbackForConnection.xml">https://connect.microsoft.com/rss/68/RecentlyModifiedFeedbackForConnection.xml</a></p>
<p>If you haven’t been on Connect for a while and wonder what’s out there, well I’ve got a PowerShell script for you <img class="wlEmoticon wlEmoticon-openmouthedsmile" style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/wlEmoticon-openmouthedsmile.png" alt="Open-mouthed smile" /> </p>
<pre class="PowerShellColorizedScript"><span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #8a2be2;">denali.db.5026258.hostedresource.com</span> <span style="color: #000000;">`
</span><span style="color: #000080;">-Database</span> <span style="color: #8a2be2;">denali</span> <span style="color: #000080;">-Username</span> <span style="color: #8a2be2;">denaliconnect</span> <span style="color: #000080;">-Password</span> <span style="color: #8a2be2;">Wide0pen</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">"
SELECT ID
        , Title
        , ItemStatus
        , UpVoteCount
        , DownVoteCount
        , ItemDescription
        , Author
        , Modified
        , ValidationCount
        , WorkAroundCount
        , URL
        , OpenedDate
  FROM denali.dbo.ConnectItems"</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">out-gridview</span></pre>
<p>OK, you can totally take that login info and use <span style="text-decoration: underline;">your</span> SQL Management Studio to connect to this database too but I wanted to show you a REALLY cool use for the <span style="color: #0000ff;">Out-GridView</span> command.  When run the PowerShell script and the window pops up Just Click on + Add Criteria &gt; ItemDescription &gt; Add.</p>
<p>Like this:</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/image3.png"><img style="background-image: none; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/image_thumb1.png" border="0" alt="image" width="194" height="244" /></a></p>
<p>Then just type in a search term like “SSIS” and see what you get back…</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/image4.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/image_thumb2.png" border="0" alt="image" width="355" height="370" /></a></p>
<p>Rob has also put together a way to search the data that is <a href="http://pivot.lobsterpot.com.au/ConnectItems">much better</a> and where we hope to ultimately go with it.  Again, that’s all for another post.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/01/is-the-connect-feed-for-sql-server-in-your-reader/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Guest Posts for Hey Scripting Guy Blog on TechNet</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/01/guest-posts-for-hey-scripting-guy-blog-on-technet/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/01/guest-posts-for-hey-scripting-guy-blog-on-technet/#comments</comments>
		<pubDate>Tue, 04 Jan 2011 18:08:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[cmdlet]]></category>
		<category><![CDATA[Guest Blogger]]></category>
		<category><![CDATA[Hey Scripting Guy]]></category>
		<category><![CDATA[SMO]]></category>
		<category><![CDATA[SQL Provider]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2011/01/guest-posts-for-hey-scripting-guy-blog-on-technet/</guid>
		<description><![CDATA[Late last year I contributed three guest blogger posts to a full week of posts about PowerShell and SQL Server. The posts were published a week before the PASS Summit. In them I tried to not only cover how useful PowerShell is for automating your every day SQL tasks but also the different approaches you have for accomplishing them: PowerShell cmdlet, WMI, SMO, SQL Provider, and .Net. It’s a huge honor to get the chance to be a guest blogger on Hey Scripting Guy! and I hope these posts were able to make some people’s (o.k. A Lot of People’s) lives easier. Given the number of people checking out PowerShell for the first time based on the comments to my MCM Videos download script I figured I’d call these out today: Use PowerShell to Obtain SQL Server Database Sizes Use PowerShell to Change SQL Server Service Accounts Use PowerShell to Script SQL Database Objects I know that the Hey Scripting Guy! blog is the #1 blog on TechNet but I’m not allowed to know any specifics beyond that. I did however catch this in yesterday’s post: “In general, the articles we published on SQL Server and on SharePoint have been really popular.” So hopefully that means we’ll get to hear some more SQL voices there in the near future. Maybe even in time for SQL Rally, who knows?]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.technet.com/b/heyscriptingguy/archive/tags/windows+powershell/sql+server/"><img title="image" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/image.png" border="0" alt="image" width="135" height="130" align="right" /></a>Late last year I contributed three guest blogger posts to a full week of posts about <strong><a href="http://blogs.technet.com/b/heyscriptingguy/archive/tags/windows+powershell/sql+server/"><span style="color: #0000ff;">PowerShell and SQL Server</span></a></strong>.  The posts were published a week before the PASS Summit.  In them I tried to not only cover how useful PowerShell is for automating your every day SQL tasks but also the different approaches you have for accomplishing them: PowerShell <strong>cmdlet</strong>, <strong>WMI</strong>, <strong>SMO</strong>, <strong>SQL Provider</strong>, and <strong>.Net</strong>.</p>
<p>It’s a huge honor to get the chance to be a guest blogger on Hey Scripting Guy! and I hope these posts were able to make some people’s (o.k. <strong>A Lot of People’s</strong>) lives easier.  Given the number of people checking out PowerShell for the first time based on the comments to my <a href="http://sqlvariant.com/index.php/2010/12/powershell-script-to-download-sql-mcm-videos"><strong>MCM Videos download script</strong></a> I figured I’d call these out today:</p>
<h3><a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/02/use-powershell-to-obtain-sql-server-database-sizes.aspx"><span style="color: #1111b5;"><span style="font-weight: bold;">Use PowerShell to Obtain SQL Server Database Sizes</span></span></a><span style="color: #1111b5;"><span style="font-weight: bold;"> </span></span></h3>
<h3><a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/03/use-powershell-to-change-sql-server-s-service-accounts.aspx"><span style="color: #1111b5;"><span style="font-weight: bold;">Use PowerShell to Change SQL Server Service Accounts</span></span></a><span style="color: #1111b5;"><span style="font-weight: bold;"> </span></span></h3>
<h3><a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/04/use-powershell-to-script-sql-database-objects.aspx"><span style="color: #1111b5;"><span style="font-weight: bold;">Use PowerShell to Script SQL Database Objects</span></span></a></h3>
<h5><span style="font-weight: normal;"><a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/01/03/the-most-popular-hey-scripting-guy-blog-articles.aspx"><img title="image" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/image1.png" border="0" alt="image" width="244" height="50" align="right" /></a></span></h5>
<p><span style="font-weight: normal;">I know that the Hey Scripting Guy! blog is the #1 blog on <a href="http://blogs.technet.com/"><strong>TechNet</strong></a> but I’m not allowed to know any specifics beyond that.  I did however catch this in yesterday’s post: “<em>In general, the articles we published on<strong> </strong></em></span><a href="http://blogs.technet.com/b/heyscriptingguy/archive/tags/windows+powershell/sql+server/"><em><strong>SQL Server</strong></em></a><span style="font-weight: normal;"><em><span style="font-weight: bold;"> </span>and on </em></span><a href="http://blogs.technet.com/b/heyscriptingguy/archive/tags/windows+powershell/sharepoint/"><em><strong>SharePoint</strong></em></a><span style="font-weight: normal;"><em><strong> have been really popular</strong>.” </em>So hopefully that means we’ll get to hear some more SQL voices there in the near future.  Maybe even in time for <span style="font-weight: bold;"><a href="http://www.sqlpass.org/sqlrally/2011/"><strong>SQL Rally</strong></a></span>, who knows?  <img style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/wlEmoticon-winkingsmile.png" alt="Winking smile" class="wlEmoticon wlEmoticon-winkingsmile" /></span></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/01/guest-posts-for-hey-scripting-guy-blog-on-technet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick Blog: What’s Missing From SQLPS</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/12/quick-blog-whats-missing-from-sqlps/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/12/quick-blog-whats-missing-from-sqlps/#comments</comments>
		<pubDate>Sun, 26 Dec 2010 20:14:54 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[cmdlets]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLPS.exe]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/12/quick-blog-whats-missing-from-sqlps/</guid>
		<description><![CDATA[Last week Norm Kelm ( blog &#124; twitter ) asked me on twitter ‘What cmdlets/features are missing from SQLPS.exe? Get-Snapin, etc. Where&#8217;s a doc that explains?’   To get the cmdlet half of this answer is somewhat easy in PowerShell using Compare-Object but it made me realize this is one of the many PowerShell tips that I have failed to blog about yet!  I plan to fix that next year with a deluge of blog posts but why wait until next year right? To get a very fast answer to this answer I opened up PowerShell.exe because while I normally demo in PowerShell_ISE.exe, I don’t use a profile in PowerShell.exe (more on that in a later post).  I ran this command to get the count of just the cmdlets. (get-command -CommandType Cmdlet).count Then I fired up SQLPS.exe (typically found in C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn) and ran the same command (after switching out of SQL Server and over to the C drive; no idea why that was necessary). The only problem here is that it’s not really 236 – 130 = 106 because SQLPS.exe adds 5 cmdlets that I made sure to exclude (along with everything else I normally use) from PowerShell.exe.  To get a more accurate list of the cmdlets and which one has what I decided to write a script that everyone con run on their own machine.  One of the many cool features of PowerShell is that you call call it’s executable and pass it a -command or even a –file.  I went ahead and threw together this simple command below so that you can see the differences yourself. Note: I assume you are running Windows 7 which comes with PowerShell 2.0 $SQLPS=SQLPS.exe -command "CD C:\; get-command -CommandType Cmdlet &#124; select CommandType, Name; exit"; $PSTwo=powershell.exe -command "get-command -CommandType Cmdlet &#124; select CommandType, Name; exit"; Compare-Object -ReferenceObject $SQLPS -DifferenceObject $PSTwo&#124; Export-CSV C:\temp\SQLPSCommandDifferences.csv -NoTypeInformation Now all that you have to do is open up that csv file that was just created (C:\temp\SQLPSCommandDifferences.csv) and have a look.  Note: I could have just displayed the info inside of my PowerShell window by leaving off the last line and the pipe but then I would have needed to do something to format the output so I went with the CSV file instead. For more information on this topic be sure to check out Chad Miller’s post on it.]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/12/image11.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/12/image_thumb11.png" border="0" alt="image" width="118" height="48" align="right" /></a>Last week Norm Kelm ( <a href="http://www.gerasus.com/">blog</a> | <a href="http://twitter.com/normankelm">twitter</a> ) asked me on <a href="http://twitter.com/#!/normankelm/statuses/18042366854176768">twitter</a> <em>‘What cmdlets/features are missing from SQLPS.exe? Get-Snapin, etc. Where&#8217;s a doc that explains?’</em>   To get the cmdlet half of this answer is somewhat easy in PowerShell using <span style="color: #0000ff;"><strong>Compare-Object</strong></span> but it made me realize this is one of the many PowerShell tips that I have failed to blog about yet!  I plan to fix that next year with a deluge of blog posts but why wait until next year right?</p>
<p>To get a very fast answer to this answer I opened up <span style="color: #0000ff;">PowerShell.exe</span> because while I normally demo in PowerShell_ISE.exe, I don’t use a <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2009/11/23/hey-scripting-guy-how-can-i-use-profiles-with-windows-powershell.aspx">profile</a> in PowerShell.exe (more on that in a later post).  I ran this command to get the count of just the cmdlets.</p>
<pre class="PowerShellColorizedScript"><span style="color: #000000;">(</span><span style="color: #0000ff;">get-command</span> <span style="color: #000080;">-CommandType</span> <span style="color: #8a2be2;">Cmdlet</span><span style="color: #000000;">)</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">count</span></pre>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/12/image21.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/12/image_thumb21.png" border="0" alt="image" width="414" height="72" /></a></p>
<p>Then I fired up <span style="color: #0000ff;">SQLPS.exe</span> (typically found in <span style="color: #000080;">C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn</span>) and ran the same command (after switching out of SQL Server and over to the C drive; no idea why that was necessary).</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/12/image31.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/12/image_thumb31.png" border="0" alt="image" width="457" height="129" /></a></p>
<p>The only problem here is that it’s not really 236 – 130 = 106 because SQLPS.exe adds 5 cmdlets that I made sure to exclude (along with everything else I normally use) from PowerShell.exe. </p>
<p>To get a more accurate list of the cmdlets and which one has what I decided to write a script that everyone con run on their own machine.  One of the many cool features of PowerShell is that you call call it’s executable and pass it a <span style="color: #000040;">-command</span> or even a <span style="color: #000040;">–file</span>.  I went ahead and threw together this simple command below so that you can see the differences yourself.</p>
<p><span style="text-decoration: underline;">Note: I assume you are running Windows 7 which comes with PowerShell 2.0</span></p>
<pre class="PowerShellColorizedScript" style="width: 539px; height: 138px;"><span style="color: #ff4500;">$SQLPS</span><span style="color: #a9a9a9;">=</span><span style="color: #0000ff;">SQLPS.exe</span> <span style="color: #000080;">-command</span> <span style="color: #8b0000;">"CD C:\; get-command -CommandType Cmdlet | select CommandType, Name; exit"</span><span style="color: #000000;">;</span>
<span style="color: #ff4500;">$PSTwo</span><span style="color: #a9a9a9;">=</span><span style="color: #0000ff;">powershell.exe</span> <span style="color: #000080;">-command</span> <span style="color: #8b0000;">"get-command -CommandType Cmdlet | select CommandType, Name; exit"</span><span style="color: #000000;">;</span>

<span style="color: #0000ff;">Compare-Object</span> <span style="color: #000080;">-ReferenceObject</span> <span style="color: #ff4500;">$SQLPS</span> <span style="color: #000080;">-DifferenceObject</span> <span style="color: #ff4500;">$PSTwo</span><span style="color: #a9a9a9;">|</span>
<span style="color: #0000ff;">Export-CSV</span> <span style="color: #8a2be2;">C:\temp\SQLPSCommandDifferences.csv</span> <span style="color: #000080;">-NoTypeInformation</span></pre>
<p>Now all that you have to do is open up that csv file that was just created (<span style="color: #000080;">C:\temp\SQLPSCommandDifferences.csv</span>) and have a look. </p>
<p>Note: I could have just displayed the info inside of my PowerShell window by leaving off the last line and the pipe but then I would have needed to do something to format the output so I went with the CSV file instead.</p>
<p>For more information on this topic be sure to check out <a href="http://sev17.com/2010/05/the-truth-about-sqlps-and-powershell-v2/">Chad Miller’s post on it</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/12/quick-blog-whats-missing-from-sqlps/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SQL Source Control, PowerShell, and TFS FTW!</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/11/sql-source-control-powershell-and-tfs-ftw/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/11/sql-source-control-powershell-and-tfs-ftw/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 16:41:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[DROP Statement]]></category>
		<category><![CDATA[Red-Gate]]></category>
		<category><![CDATA[Scripting Databases]]></category>
		<category><![CDATA[SQL Source Control]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/11/sql-source-control-powershell-and-tfs-ftw/</guid>
		<description><![CDATA[A few weeks back I wrote a post for the Hey Scripting Guy Blog on TechNet on scripting out databases with PowerShell. The post was inspired by an issue I had using Red-Gate’s SQL Source Control tool. (If you aren&#8217;t familiar with SQL Source Control then check it out. The tool is so full of awesome that I wrote code to get around the only problem I found with it. ) While using the product I ran into a single small problem. When I check a database into Team Foundation Server via SQL Source Control it doesn’t include the drop statements. The deployment procedures at my company just go smoother with DROP statements in each of the stored procedures. Similarly, for databases that haven’t been deployed outside of the Development environment it was better for us to drop and re-create the tables from scratch. It isn&#8217;t the kind of thing you&#8217;d ever do in production, but given the length of some development projects it is very useful if you can do this when needed. The version of SQL Source Control I used doesn’t script drops or permissions by default. If there is an option to change this I can&#8217;t find it. Rather than switch tools I used this as an excuse to learn how to work with the different scripting options available inside the SMO exposed by PowerShell. Find your options this way: $dbname="AdventureWorks" $server="WIN7NetBook" [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") &#124; out-null $SMOserver = New-Object (’Microsoft.SqlServer.Management.Smo.Server’) -argumentlist $server $db = $SMOserver.databases[$dbname] $Scriptr = new-object ('Microsoft.SqlServer.Management.Smo.Scripter') ($SMOserver) $Scriptr.Options &#124; Get-Member To work around this problem I linked my database to my TFS server (from SQL Source Control inside of SSMS). I committed all the changes to TFS so that everything was checked in. Then I opened Visual Studio, checked out out all the objects on to my local machine, generated the scripts with PowerShell just the way I wanted them, overwrote the local TFS code with the code I had just generated, and finally, I checked everything back in to TFS. Doing all this was pretty quick, worked great, and SQL Source Control didn’t care that the scripts weren’t the ones that it had generated. Be forewarned, when you include the ScriptDrops option it only generates the drop statement. To work around this see my tips here. Now all that is left is to add the Permissions option. The resulting code also does some cool things like divide objects into folders by type; put everything under a folder structure that includes the name of the database; and another folder that is simply datatime so that you can run it multiple times as you tweak the code to fit your environment, or, just keep old versions of the code laying around in case someone dropped something that hadn’t been checked into TFS yet. I’ve also included the portion of code that only adds the drop statements to objects like stored procedures but not tables. You can download the script here. Or just take a look at it here. When/if you run the script, it creates a PowerShell function. To call it all you have to do is something like this: Script-DBObjectsIntoFolders "AdventureWorks" "WIN7NetBook" And you could even call it in a loop to script out all of your user databases: foreach ($dbn in invoke-sqlcmd -query "SELECT name FROM sys.databases WHERE owner_sid !=0x01"` -database master -serverinstance WIN7NetBook ) { #Begin Loop $dbn; Script-DBObjectsIntoFolders $($dbn.name) "WIN7NetBook" } #End Loop Script-DBObjectsIntoFolders function global:Script-DBObjectsIntoFolders([string]$dbname, [string]$server){ [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") &#124; out-null $SMOserver = New-Object (’Microsoft.SqlServer.Management.Smo.Server’) -argumentlist $server $db = $SMOserver.databases[$dbname] $Objects = $db.Tables $Objects += $db.Views $Objects += $db.StoredProcedures $Objects += $db.UserDefinedFunctions #Build this portion of the directory structure out here in case scripting takes more than one minute. $SavePath = "C:\TEMP\Databases\" + $($dbname) $DateFolder = get-date -format yyyyMMddHHmm new-item -type directory -name "$DateFolder"-path "$SavePath" foreach ($ScriptThis in $Objects &#124; where {!($_.IsSystemObject)}) { #Need to Add Some mkDirs for the different $Fldr=$ScriptThis.GetType().Name $scriptr = new-object ('Microsoft.SqlServer.Management.Smo.Scripter') ($SMOserver) $scriptr.Options.AppendToFile = $True $scriptr.Options.AllowSystemObjects = $False $scriptr.Options.ClusteredIndexes = $True $scriptr.Options.DriAll = $True $scriptr.Options.ScriptDrops = $False $scriptr.Options.IncludeHeaders = $True $scriptr.Options.ToFileOnly = $True $scriptr.Options.Indexes = $True $scriptr.Options.Permissions = $True $scriptr.Options.WithDependencies = $False &#60;#Script the Drop too#&#62; $ScriptDrop = new-object ('Microsoft.SqlServer.Management.Smo.Scripter') ($SMOserver) $ScriptDrop.Options.AppendToFile = $True $ScriptDrop.Options.AllowSystemObjects = $False $ScriptDrop.Options.ClusteredIndexes = $True $ScriptDrop.Options.DriAll = $True $ScriptDrop.Options.ScriptDrops = $True $ScriptDrop.Options.IncludeHeaders = $True $ScriptDrop.Options.ToFileOnly = $True $ScriptDrop.Options.Indexes = $True $ScriptDrop.Options.WithDependencies = $False &#60;#This section builds folder structures. Remove the date folder if you want to overwrite#&#62; $TypeFolder=$ScriptThis.GetType().Name if ((Test-Path -Path "$SavePath\$DateFolder\$TypeFolder") -eq "true") ` {"Scripting Out $TypeFolder $ScriptThis"} ` else {new-item -type directory -name "$TypeFolder"-path "$SavePath\$DateFolder"} $ScriptFile = $ScriptThis -replace "\[&#124;\]" $ScriptDrop.Options.FileName = "" + $($SavePath) + "\" + $($DateFolder) + "\" + $($TypeFolder) + "\" + $($ScriptFile) + ".SQL" $scriptr.Options.FileName = "$SavePath\$DateFolder\$TypeFolder\$ScriptFile.SQL" #This is where each object actually gets scripted one at a time. IF ($ScriptThis.GetType().Name -NE "Table") { $ScriptDrop.Script($ScriptThis) } $scriptr.Script($ScriptThis) } #This ends the loop } #This completes the function]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.technet.com/b/heyscriptingguy/" target="_blank"><img title="image" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/image.png" border="0" alt="image" width="76" height="93" align="right" /></a>A few weeks back I wrote a <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/04/use-powershell-to-script-sql-database-objects.aspx"><strong>post</strong></a> for the <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/04/use-powershell-to-script-sql-database-objects.aspx">Hey Scripting Guy Blog</a> on TechNet on scripting out databases with PowerShell.  The post was inspired by an issue I had using <strong><span style="color: #ff0000;">Red-Gate’s</span></strong> <strong><a href="http://www.red-gate.com/products/SQL_Source_Control/index.htm" target="_blank">SQL Source Control</a> </strong>tool.  (If you aren&#8217;t familiar with SQL Source Control then check it out.  The tool is so full of awesome that I wrote code to get around the <span style="text-decoration: underline;">only</span> problem I found with it. )</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/image1.png"><img title="image" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/image_thumb.png" border="0" alt="image" width="98" height="113" align="right" /></a>While using the product I ran into a single small problem.  When I check a database into Team Foundation Server via SQL Source Control it doesn’t include the drop statements.  The deployment procedures at my company just go smoother with <strong><span style="color: #0000ff;">DROP</span> statements</strong> in each of the stored procedures.  Similarly, for databases that haven’t been deployed outside of the Development environment it was better for us to drop and re-create the tables from scratch.  It isn&#8217;t the kind of thing you&#8217;d ever do in production, but given the length of some development projects it is very useful if you can do this when needed.</p>
<p>The version of SQL Source Control I used doesn’t script drops or permissions by default.  If there is an option to change this I can&#8217;t find it.  Rather than switch tools I used this as an excuse to learn how to work with the different scripting options available inside the SMO exposed by PowerShell.  Find your options this way:</p>
<pre style="width: 539px; height: 217px;" class="PowerShellColorizedScript"><span style="color: #ff4500;">$dbname</span><span style="color: #a9a9a9;">=</span><span style="color: #8b0000;">"AdventureWorks"</span>
<span style="color: #ff4500;">$server</span><span style="color: #a9a9a9;">=</span><span style="color: #8b0000;">"WIN7NetBook"</span>

<span style="color: #008080;">[System.Reflection.Assembly]</span><span style="color: #a9a9a9;">::</span><span style="color: #000000;">LoadWithPartialName</span><span style="color: #000000;">(</span><span style="color: #8b0000;">"Microsoft.SqlServer.SMO"</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">out-null</span>
<span style="color: #ff4500;">$SMOserver</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">New-Object</span> <span style="color: #000000;">(</span><span style="color: #8b0000;">’Microsoft.SqlServer.Management.Smo.Server’</span><span style="color: #000000;">)</span> <span style="color: #000080;">-argumentlist</span> <span style="color: #ff4500;">$server</span>
<span style="color: #ff4500;">$db</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$SMOserver</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">databases</span><span style="color: #a9a9a9;">[</span><span style="color: #ff4500;">$dbname</span><span style="color: #a9a9a9;">]</span>

<span style="color: #ff4500;">$Scriptr</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">new-object</span> <span style="color: #000000;">(</span><span style="color: #8b0000;">'Microsoft.SqlServer.Management.Smo.Scripter'</span><span style="color: #000000;">)</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$SMOserver</span><span style="color: #000000;">)</span>
<span style="color: #ff4500;">$Scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Get-Member</span></pre>
<p>To work around this problem I linked my database to my TFS server (from SQL Source Control inside of SSMS).  I committed all the changes to TFS so that everything was checked in.  Then I opened Visual Studio, checked out out all the objects on to my local machine, generated the scripts with <a href="http://bit.ly/am4Muy">PowerShell</a> just the way I wanted them, overwrote the local TFS code with the code I had just generated, and finally, I checked everything back in to TFS.  Doing all this was pretty quick, worked great, and SQL Source Control didn’t care that the scripts weren’t the ones that it had generated.</p>
<p>Be forewarned, when you include the <strong>ScriptDrops</strong> option it only generates the drop statement.  To work around this see my tips <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/04/use-powershell-to-script-sql-database-objects.aspx">here</a>.  Now all that is left is to add the Permissions option.</p>
<p>The resulting code also does some cool things like divide objects into folders by type; put everything under a folder structure that includes the name of the database; and another folder that is simply datatime so that you can run it multiple times as you tweak the code to fit your environment, or, just keep old versions of the code laying around in case someone dropped something that hadn’t been checked into TFS yet.  I’ve also included the portion of code that only adds the drop statements to objects like stored procedures but not tables.</p>
<p>You can download the script <a href="http://bit.ly/am4Muy">here</a>.  Or just take a look at it <a href="http://bit.ly/9e9YrI">here</a>.  When/if you run the script, it creates a PowerShell function.  To call it all you have to do is something like this:</p>
<pre class="PowerShellColorizedScript"><span style="color: #0000ff;">Script-DBObjectsIntoFolders</span> <span style="color: #8b0000;">"AdventureWorks"</span> <span style="color: #8b0000;">"WIN7NetBook"</span></pre>
<p>And you could even call it in a loop to <span style="text-decoration: underline;">script out all of your user databases</span>:</p>
<pre class="PowerShellColorizedScript"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$dbn</span> <span style="color: #00008b;">in</span> <span style="color: #0000ff;">invoke-sqlcmd</span> <span style="color: #000080;">-query</span> <span style="color: #8b0000;">"SELECT name
  FROM sys.databases WHERE owner_sid !=0x01"</span><span style="color: #000000;">`
</span> <span style="color: #000080;">-database</span> <span style="color: #8a2be2;">master</span> <span style="color: #000080;">-serverinstance</span> <span style="color: #8a2be2;">WIN7NetBook</span> <span style="color: #000000;">)</span>

<span style="color: #000000;">{</span> <span style="color: #006400;">#Begin Loop</span>
<span style="color: #ff4500;">$dbn</span><span style="color: #000000;">;</span>
<span style="color: #0000ff;">Script-DBObjectsIntoFolders</span>  <span style="color: #000000;">$(</span><span style="color: #ff4500;">$dbn</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span><span style="color: #000000;">)</span> <span style="color: #8b0000;">"WIN7NetBook"</span>
<span style="color: #000000;">}</span> <span style="color: #006400;">#End Loop</span></pre>
<p><strong> </strong></p>
<p><strong><span style="color: #9b00d3;"> </span></strong></p>
<p><strong>Script-DBObjectsIntoFolders</strong></p>
<pre class="PowerShellColorizedScript"><span style="color: #00008b;">function</span> <span style="color: #8a2be2;">global:Script-DBObjectsIntoFolders</span><span style="color: #000000;">(</span><span style="color: #008080;">[string]</span><span style="color: #ff4500;">$dbname</span><span style="color: #a9a9a9;">,</span> <span style="color: #008080;">[string]</span><span style="color: #ff4500;">$server</span><span style="color: #000000;">)</span><span style="color: #000000;">{</span>
<span style="color: #008080;">[System.Reflection.Assembly]</span><span style="color: #a9a9a9;">::</span><span style="color: #000000;">LoadWithPartialName</span><span style="color: #000000;">(</span><span style="color: #8b0000;">"Microsoft.SqlServer.SMO"</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">out-null</span>
<span style="color: #ff4500;">$SMOserver</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">New-Object</span> <span style="color: #000000;">(</span><span style="color: #8b0000;">’Microsoft.SqlServer.Management.Smo.Server’</span><span style="color: #000000;">)</span> <span style="color: #000080;">-argumentlist</span> <span style="color: #ff4500;">$server</span>
<span style="color: #ff4500;">$db</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$SMOserver</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">databases</span><span style="color: #a9a9a9;">[</span><span style="color: #ff4500;">$dbname</span><span style="color: #a9a9a9;">]</span>

<span style="color: #ff4500;">$Objects</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Tables</span>
<span style="color: #ff4500;">$Objects</span> <span style="color: #a9a9a9;">+=</span> <span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Views</span>
<span style="color: #ff4500;">$Objects</span> <span style="color: #a9a9a9;">+=</span> <span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">StoredProcedures</span>
<span style="color: #ff4500;">$Objects</span> <span style="color: #a9a9a9;">+=</span> <span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">UserDefinedFunctions</span>

<span style="color: #006400;">#Build this portion of the directory structure out here in case scripting takes more than one minute.</span>
<span style="color: #ff4500;">$SavePath</span> <span style="color: #a9a9a9;">=</span> <span style="color: #8b0000;">"C:\TEMP\Databases\"</span> <span style="color: #a9a9a9;">+</span> <span style="color: #000000;">$(</span><span style="color: #ff4500;">$dbname</span><span style="color: #000000;">)</span>
<span style="color: #ff4500;">$DateFolder</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">get-date</span> <span style="color: #000080;">-format</span> <span style="color: #8a2be2;">yyyyMMddHHmm</span>
<span style="color: #0000ff;">new-item</span> <span style="color: #000080;">-type</span> <span style="color: #8a2be2;">directory</span> <span style="color: #000080;">-name</span> <span style="color: #8b0000;">"$DateFolder"</span><span style="color: #000080;">-path</span> <span style="color: #8b0000;">"$SavePath"</span>

<span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$ScriptThis</span> <span style="color: #00008b;">in</span> <span style="color: #ff4500;">$Objects</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">where</span> <span style="color: #000000;">{</span><span style="color: #a9a9a9;">!</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">IsSystemObject</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span>
<span style="color: #006400;">#Need to Add Some mkDirs for the different $Fldr=$ScriptThis.GetType().Name </span>
<span style="color: #ff4500;">$scriptr</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">new-object</span> <span style="color: #000000;">(</span><span style="color: #8b0000;">'Microsoft.SqlServer.Management.Smo.Scripter'</span><span style="color: #000000;">)</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$SMOserver</span><span style="color: #000000;">)</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">AppendToFile</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">AllowSystemObjects</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$False</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">ClusteredIndexes</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">DriAll</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">ScriptDrops</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$False</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">IncludeHeaders</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">ToFileOnly</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Indexes</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Permissions</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">WithDependencies</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$False</span>
<span style="color: #006400;">&lt;#Script the Drop too#&gt;</span>
<span style="color: #ff4500;">$ScriptDrop</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">new-object</span> <span style="color: #000000;">(</span><span style="color: #8b0000;">'Microsoft.SqlServer.Management.Smo.Scripter'</span><span style="color: #000000;">)</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$SMOserver</span><span style="color: #000000;">)</span>
<span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">AppendToFile</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">AllowSystemObjects</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$False</span>
<span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">ClusteredIndexes</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">DriAll</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">ScriptDrops</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">IncludeHeaders</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">ToFileOnly</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Indexes</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$True</span>
<span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">WithDependencies</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$False</span>

<span style="color: #006400;">&lt;#This section builds folder structures.  Remove the date folder if you want to overwrite#&gt;</span>
<span style="color: #ff4500;">$TypeFolder</span><span style="color: #a9a9a9;">=</span><span style="color: #ff4500;">$ScriptThis</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">GetType</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Name</span>
<span style="color: #00008b;">if</span> <span style="color: #000000;">(</span><span style="color: #000000;">(</span><span style="color: #0000ff;">Test-Path</span> <span style="color: #000080;">-Path</span> <span style="color: #8b0000;">"$SavePath\$DateFolder\$TypeFolder"</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">-eq</span> <span style="color: #8b0000;">"true"</span><span style="color: #000000;">)</span> <span style="color: #000000;">`
</span>        <span style="color: #000000;">{</span><span style="color: #8b0000;">"Scripting Out $TypeFolder $ScriptThis"</span><span style="color: #000000;">}</span> <span style="color: #000000;">`
</span>    <span style="color: #00008b;">else</span> <span style="color: #000000;">{</span><span style="color: #0000ff;">new-item</span> <span style="color: #000080;">-type</span> <span style="color: #8a2be2;">directory</span> <span style="color: #000080;">-name</span> <span style="color: #8b0000;">"$TypeFolder"</span><span style="color: #000080;">-path</span> <span style="color: #8b0000;">"$SavePath\$DateFolder"</span><span style="color: #000000;">}</span>
<span style="color: #ff4500;">$ScriptFile</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$ScriptThis</span> <span style="color: #a9a9a9;">-replace</span> <span style="color: #8b0000;">"\[|\]"</span>
<span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">FileName</span> <span style="color: #a9a9a9;">=</span> <span style="color: #8b0000;">""</span> <span style="color: #a9a9a9;">+</span> <span style="color: #000000;">$(</span><span style="color: #ff4500;">$SavePath</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">+</span> <span style="color: #8b0000;">"\"</span> <span style="color: #a9a9a9;">+</span> <span style="color: #000000;">$(</span><span style="color: #ff4500;">$DateFolder</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">+</span> <span style="color: #8b0000;">"\"</span> <span style="color: #a9a9a9;">+</span> <span style="color: #000000;">$(</span><span style="color: #ff4500;">$TypeFolder</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">+</span> <span style="color: #8b0000;">"\"</span> <span style="color: #a9a9a9;">+</span> <span style="color: #000000;">$(</span><span style="color: #ff4500;">$ScriptFile</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">+</span> <span style="color: #8b0000;">".SQL"</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Options</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">FileName</span> <span style="color: #a9a9a9;">=</span> <span style="color: #8b0000;">"$SavePath\$DateFolder\$TypeFolder\$ScriptFile.SQL"</span>

<span style="color: #006400;">#This is where each object actually gets scripted one at a time.</span>
<span style="color: #00008b;">IF</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$ScriptThis</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">GetType</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Name</span> <span style="color: #a9a9a9;">-NE</span> <span style="color: #8b0000;">"Table"</span><span style="color: #000000;">)</span> <span style="color: #000000;">{</span> <span style="color: #ff4500;">$ScriptDrop</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Script</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$ScriptThis</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span>
<span style="color: #ff4500;">$scriptr</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Script</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$ScriptThis</span><span style="color: #000000;">)</span>
<span style="color: #000000;">}</span> <span style="color: #006400;">#This ends the loop</span>
<span style="color: #000000;">}</span> <span style="color: #006400;">#This completes the function</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/11/sql-source-control-powershell-and-tfs-ftw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Answers for Paul Randal’s Survey FAST!</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/11/get-answers-for-paul-randals-survey-fast/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/11/get-answers-for-paul-randals-survey-fast/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 19:21:58 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Wait Types]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/11/get-answers-for-paul-randals-survey-fast/</guid>
		<description><![CDATA[You may call it ‘lazy’ but I call it ‘efficiently gathering quality results’. Last week Paul Randal (twitter) blogged and asked people to take part in a survey asking what the top Wait Type on their systems are.  Since I have 100s of SQL Servers and I wanted to give him an answer for each one. And because I’m lazy…  I modified Paul’s (or Glen’s [ blog &#124; twitter ] ) query to include a ServerName column then Select’ed the results of the query on my local machine into a table. Once I had the table set up I fired up PowerShell and used the same type of script that I showed off in today’s Hey Scripting Guy post. The only difference being that I swapped out the query and table name of course. CREATE TABLE [dbo].[TopWaitTypes](    [InstanceName] [nvarchar](128) NOT NULL,    [WaitType] [nvarchar](60) NOT NULL,    [Wait_S] [decimal](14, 2) NULL,    [Resource_S] [decimal](14, 2) NULL,    [Signal_S] [decimal](14, 2) NULL,    [WaitCount] [bigint] NOT NULL,    [Percentage] [decimal](4, 2) NULL ) ON [PRIMARY] Make sure to read to the bottom for the significantly less code version! foreach ($RegisteredSQLs in dir -recurse SQLSERVER:\SQLRegistration\'Database Engine Server Group'\Development &#124; where {$_.Mode -ne "d"} ) { $dt=invoke-sqlcmd -query "WITH Waits AS (SELECT wait_type, wait_time_ms / 1000.0 AS WaitS, (wait_time_ms - signal_wait_time_ms) / 1000.0 AS ResourceS, signal_wait_time_ms / 1000.0 AS SignalS, waiting_tasks_count AS WaitCount, 100.0 * wait_time_ms / SUM (wait_time_ms) OVER() AS Percentage, ROW_NUMBER() OVER(ORDER BY wait_time_ms DESC) AS RowNum FROM sys.dm_os_wait_stats WHERE wait_type NOT IN ( 'CLR_SEMAPHORE', 'LAZYWRITER_SLEEP', 'RESOURCE_QUEUE', 'SLEEP_TASK', 'SLEEP_SYSTEMTASK', 'SQLTRACE_BUFFER_FLUSH', 'WAITFOR', 'LOGMGR_QUEUE', 'CHECKPOINT_QUEUE', 'REQUEST_FOR_DEADLOCK_SEARCH', 'XE_TIMER_EVENT', 'BROKER_TO_FLUSH', 'BROKER_TASK_STOP', 'CLR_MANUAL_EVENT', 'CLR_AUTO_EVENT', 'DISPATCHER_QUEUE_SEMAPHORE', 'FT_IFTS_SCHEDULER_IDLE_WAIT', 'XE_DISPATCHER_WAIT', 'XE_DISPATCHER_JOIN', 'BROKER_EVENTHANDLER', 'TRACEWRITE', 'FT_IFTSHC_MUTEX', 'SQLTRACE_INCREMENTAL_FLUSH_SLEEP') ) SELECT @@ServerName AS 'ServerName', W1.wait_type AS WaitType, CAST (W1.WaitS AS DECIMAL(14, 2)) AS Wait_S, CAST (W1.ResourceS AS DECIMAL(14, 2)) AS Resource_S, CAST (W1.SignalS AS DECIMAL(14, 2)) AS Signal_S, W1.WaitCount AS WaitCount, CAST (W1.Percentage AS DECIMAL(4, 2)) AS Percentage FROM Waits AS W1 INNER JOIN Waits AS W2 ON W2.RowNum &#60;= W1.RowNum GROUP BY W1.RowNum, W1.wait_type, W1.WaitS, W1.ResourceS, W1.SignalS, W1.WaitCount, W1.Percentage HAVING SUM (W2.Percentage) - W1.Percentage &#60; 95; -- percentage threshold" -ServerInstance $RegisteredSQLs.ServerName -database master Write-DataTable -ServerInstance "Win7NetBook" -Database CentralInfo -TableName TopWaitTypes -Data $dt } After reading Chad Miller’s (Blog&#124;Twitter) excellent post yesterday though, I decided to combine our approaches.  If you haven’t done so already, you’ll need to download Chad’s invoke-sqlcmd2 and Write-DataTable functions and load them up in your environment.  You’ll also need to store the edit the query from Paul’s blog to add a ServerName column and then store it in a .sql file in the working directory of your PowerShell session.  Once that’s all done if you haven’t given up and closed your browser you can use a piece of code like this to gather up all of this information from all of the server you have in your Registered Servers list.  For safety’s sake when I put out scripts like this I always make sure to dive down into the \Development branch of my Registered Servers list so that you will always be able to start somewhere ‘safe’ when you run this for the first time.  Or just get a big red nasty error message if you don’t have a “Development” Registered Servers Group Here’s the code that I came up with for me: foreach ($RegisteredSQLs in dir -recurse SQLSERVER:\SQLRegistration\'Database Engine Server Group'\Development &#124; where {$_.Mode -ne "d"} ) { $dt=invoke-sqlcmd2 -ServerInstance $RegisteredSQLs.ServerName -database master -InputFile ./PaulAndGlensWaitQuery.sql -As 'DataTable' Write-DataTable -ServerInstance "Win7NetBook" -Database CentralInfo -TableName TopWaitTypes -Data $dt } Paul had mentioned that “The free survey system only allows a single vote per IP address &#8211; if you have any other results, send them in email (mailto:paul@SQLskills.com?Subject=Wait stats) or attach a comment below.” so I plan to send him an email with the top wait from each of my servers, minus the server name of course. I Hope this helps start some ideas in your head about how you can leverage PowerShell in your environment! By the way&#8230;  I got the idea for leveraging the Registered Servers piece from an old Buck Woody ( blog &#124; twitter ) post so pretty much none of this is my code, I just put it all together.  And THAT is why I love twitter!]]></description>
			<content:encoded><![CDATA[<p>You may call it ‘lazy’ but I call it ‘efficiently gathering quality results’. <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/wlEmoticon-smile.png" alt="Smile" /></p>
<p>Last week Paul Randal (<a href="http://twitter.com/PaulRandal">twitter</a>) blogged and asked people to take part in a survey asking what the <a href="http://www.sqlskills.com/BLOGS/PAUL/post/Survey-what-is-the-highest-wait-on-your-system.aspx">top Wait Type on their systems</a> are.  Since I have 100s of SQL Servers and I wanted to give him an answer for each one. And because I’m lazy…  I modified Paul’s (or Glen’s [ <a href="http://glennberrysqlperformance.spaces.live.com/">blog</a> | <a href="http://twitter.com/GlennAlanBerry">twitter</a> ] ) query to include a ServerName column then <span style="color: #0000ff;">Select</span>’ed the results of the query on my local machine into a table. Once I had the table set up I fired up PowerShell and used the same type of script that I showed off in today’s Hey Scripting Guy post. The only difference being that I swapped out the query and table name of course.</p>
<p><code style="font-size: 12px;"><span style="color: blue;">CREATE TABLE </span><span style="color: black;">[dbo].[TopWaitTypes]</span><span style="color: gray;">(<br />
   </span><span style="color: black;">[InstanceName] [nvarchar]</span><span style="color: gray;">(</span><span style="color: black;">128</span><span style="color: gray;">) NOT NULL,<br />
   </span><span style="color: black;">[WaitType] [nvarchar]</span><span style="color: gray;">(</span><span style="color: black;">60</span><span style="color: gray;">) NOT NULL,<br />
   </span><span style="color: black;">[Wait_S] [decimal]</span><span style="color: gray;">(</span><span style="color: black;">14</span><span style="color: gray;">, </span><span style="color: black;">2</span><span style="color: gray;">) NULL,<br />
   </span><span style="color: black;">[Resource_S] [decimal]</span><span style="color: gray;">(</span><span style="color: black;">14</span><span style="color: gray;">, </span><span style="color: black;">2</span><span style="color: gray;">) NULL,<br />
   </span><span style="color: black;">[Signal_S] [decimal]</span><span style="color: gray;">(</span><span style="color: black;">14</span><span style="color: gray;">, </span><span style="color: black;">2</span><span style="color: gray;">) NULL,<br />
   </span><span style="color: black;">[WaitCount] [bigint] </span><span style="color: gray;">NOT NULL,<br />
   </span><span style="color: black;">[Percentage] [decimal]</span><span style="color: gray;">(</span><span style="color: black;">4</span><span style="color: gray;">, </span><span style="color: black;">2</span><span style="color: gray;">) NULL<br />
) </span><span style="color: blue;">ON </span><span style="color: black;">[PRIMARY]</span></code></p>
<blockquote><p><strong><em>Make sure to read to the bottom for the <span style="text-decoration: underline;">significantly less code version</span>!</em></strong></p></blockquote>
<pre class="PowerShellColorizedScript"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$RegisteredSQLs</span> <span style="color: #00008b;">in</span> <span style="color: #0000ff;">dir</span> <span style="color: #000080;">-recurse</span> <span style="color: #8a2be2;">SQLSERVER:\SQLRegistration\'Database Engine Server Group'\Development</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">where</span> <span style="color: #000000;">{</span><span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Mode</span> <span style="color: #a9a9a9;">-ne</span> <span style="color: #8b0000;">"d"</span><span style="color: #000000;">}</span> <span style="color: #000000;">)</span>
<span style="color: #000000;">{</span>
<span style="color: #ff4500;">$dt</span><span style="color: #a9a9a9;">=</span><span style="color: #0000ff;">invoke-sqlcmd</span> <span style="color: #000080;">-query</span> <span style="color: #8b0000;">"WITH Waits AS
    (SELECT
        wait_type,
        wait_time_ms / 1000.0 AS WaitS,
        (wait_time_ms - signal_wait_time_ms) / 1000.0 AS ResourceS,
        signal_wait_time_ms / 1000.0 AS SignalS,
        waiting_tasks_count AS WaitCount,
        100.0 * wait_time_ms / SUM (wait_time_ms) OVER() AS Percentage,
        ROW_NUMBER() OVER(ORDER BY wait_time_ms DESC) AS RowNum
    FROM sys.dm_os_wait_stats
    WHERE wait_type NOT IN (
        'CLR_SEMAPHORE', 'LAZYWRITER_SLEEP', 'RESOURCE_QUEUE', 'SLEEP_TASK',
        'SLEEP_SYSTEMTASK', 'SQLTRACE_BUFFER_FLUSH', 'WAITFOR', 'LOGMGR_QUEUE',
        'CHECKPOINT_QUEUE', 'REQUEST_FOR_DEADLOCK_SEARCH', 'XE_TIMER_EVENT', 'BROKER_TO_FLUSH',
        'BROKER_TASK_STOP', 'CLR_MANUAL_EVENT', 'CLR_AUTO_EVENT', 'DISPATCHER_QUEUE_SEMAPHORE',
        'FT_IFTS_SCHEDULER_IDLE_WAIT', 'XE_DISPATCHER_WAIT', 'XE_DISPATCHER_JOIN', 'BROKER_EVENTHANDLER',
        'TRACEWRITE', 'FT_IFTSHC_MUTEX', 'SQLTRACE_INCREMENTAL_FLUSH_SLEEP')
     )
SELECT @@ServerName AS 'ServerName',
     W1.wait_type AS WaitType,
     CAST (W1.WaitS AS DECIMAL(14, 2)) AS Wait_S,
     CAST (W1.ResourceS AS DECIMAL(14, 2)) AS Resource_S,
     CAST (W1.SignalS AS DECIMAL(14, 2)) AS Signal_S,
     W1.WaitCount AS WaitCount,
     CAST (W1.Percentage AS DECIMAL(4, 2)) AS Percentage
FROM Waits AS W1
INNER JOIN Waits AS W2
     ON W2.RowNum &lt;= W1.RowNum
GROUP BY W1.RowNum, W1.wait_type, W1.WaitS, W1.ResourceS, W1.SignalS, W1.WaitCount, W1.Percentage
HAVING SUM (W2.Percentage) - W1.Percentage &lt; 95; -- percentage threshold"</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #ff4500;">$RegisteredSQLs</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">ServerName</span> <span style="color: #000080;">-database</span> <span style="color: #8a2be2;">master</span>
<span style="color: #0000ff;">Write-DataTable</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #8b0000;">"Win7NetBook"</span> <span style="color: #000080;">-Database</span> <span style="color: #8a2be2;">CentralInfo</span> <span style="color: #000080;">-TableName</span> <span style="color: #8a2be2;">TopWaitTypes</span> <span style="color: #000080;">-Data</span> <span style="color: #ff4500;">$dt</span>
<span style="color: #000000;">}</span></pre>
<p>After reading Chad Miller’s (<a href="http://sev17.com/">Blog</a>|<a href="http://www.twitter.com/cmille19">Twitter</a>) excellent <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/11/01/use-powershell-to-collect-server-data-and-write-to-sql.aspx">post yesterday</a> though, I decided to combine our approaches.  If you haven’t done so already, you’ll need to download Chad’s <a href="http://gallery.technet.microsoft.com/ScriptCenter/en-us/7985b7ef-ed89-4dfd-b02a-433cc4e30894"><strong>invoke-sqlcmd2 </strong></a>and <a href="http://gallery.technet.microsoft.com/ScriptCenter/en-us/2fdeaf8d-b164-411c-9483-99413d6053ae"><strong>Write-DataTable</strong> </a>functions and load them up in your environment.  You’ll also need to store the edit the query from Paul’s blog to add a ServerName column and then store it in a <a href="http://sqlvariant.com/BlogSupport/Scripts/SQL/OtherPeoplesCode/PaulAndGlensWaitQuery.txt">.sql file</a> in the working directory of your PowerShell session.  Once that’s all done if you haven’t given up and closed your browser you can use a piece of code like this to gather up all of this information from all of the server you have in your Registered Servers list. </p>
<p>For safety’s sake when I put out scripts like this I always make sure to dive down into the <span style="line-height: 14pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: &amp;#39;Lucida Console&amp;#39;; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;"><span style="font-family: Lucida Console;"><span style="color: #8a2be2; font-size: 12pt;"><strong>\Development</strong></span></span></span> branch of my Registered Servers list so that you will always be able to start somewhere ‘safe’ when you run this for the first time.  Or just get a big red nasty error message if you don’t have a “Development” Registered Servers Group <img class="wlEmoticon wlEmoticon-openmouthedsmile" style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/wlEmoticon-openmouthedsmile.png" alt="Open-mouthed smile" /></p>
<p>Here’s the code that I came up with for me:</p>
<pre class="PowerShellColorizedScript"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$RegisteredSQLs</span> <span style="color: #00008b;">in</span> <span style="color: #0000ff;">dir</span> <span style="color: #000080;">-recurse</span> <span style="color: #8a2be2;">SQLSERVER:\SQLRegistration\'Database Engine Server Group'\Development</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">where</span> <span style="color: #000000;">{</span><span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Mode</span> <span style="color: #a9a9a9;">-ne</span> <span style="color: #8b0000;">"d"</span><span style="color: #000000;">}</span> <span style="color: #000000;">)</span>
<span style="color: #000000;">{</span>
<span style="color: #ff4500;">$dt</span><span style="color: #a9a9a9;">=</span><span style="color: #0000ff;">invoke-sqlcmd2</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #ff4500;">$RegisteredSQLs</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">ServerName</span> <span style="color: #000080;">-database</span> <span style="color: #8a2be2;">master</span> <span style="color: #000080;">-InputFile</span> <span style="color: #8a2be2;">./PaulAndGlensWaitQuery.sql</span> <span style="color: #000080;">-As</span> <span style="color: #8b0000;">'DataTable'</span>
<span style="color: #0000ff;">Write-DataTable</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #8b0000;">"Win7NetBook"</span> <span style="color: #000080;">-Database</span> <span style="color: #8a2be2;">CentralInfo</span> <span style="color: #000080;">-TableName</span> <span style="color: #8a2be2;">TopWaitTypes</span> <span style="color: #000080;">-Data</span> <span style="color: #ff4500;">$dt</span>
<span style="color: #000000;">}</span></pre>
<p>Paul had mentioned that <em>“<span style="text-decoration: underline;"><strong>The free survey system only allows a single vote per IP address</strong></span> &#8211; if you have any other results, send them in email (</em><a href="mailto:paul@SQLskills.com?Subject=Wait stats"><em>mailto:paul@SQLskills.com?Subject=Wait stats</em></a><em>) or attach a comment below.”</em> so I plan to send him an email with the top wait from each of my servers, minus the server name of course.</p>
<p>I Hope this helps start some ideas in your head about how you can leverage PowerShell in your environment!</p>
<p>By the way&#8230;  I got the idea for leveraging the Registered Servers piece from an old Buck Woody ( <a href="http://blogs.msdn.com/b/buckwoody/">blog</a> | <a href="http://twitter.com/BuckWoody">twitter</a> ) <a href="http://blogs.msdn.com/b/buckwoody/archive/2008/12/31/using-powershell-and-ssms-registered-servers.aspx">post</a> so pretty much none of this is my code, I just put it all together.  And <strong>THAT</strong> is why I love twitter!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/11/get-answers-for-paul-randals-survey-fast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;ll be Speaking at SQL Saturday #48 in Columbia, SC</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/09/ill-be-speaking-at-sql-saturday-48-in-columbia-sc/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/09/ill-be-speaking-at-sql-saturday-48-in-columbia-sc/#comments</comments>
		<pubDate>Wed, 29 Sep 2010 19:31:33 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Saturday]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[Free Training]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1494</guid>
		<description><![CDATA[I’ll be speaking at SQL Saturday #48 this weekend and I am happy to announce I will be unveiling my more advanced PowerShell session to help people customize scripts for their own environment.  I will be showing off several new scripts that I built for my session at the PASS Summit this year.  Please be ready to give plenty of brutal feedback on these scripts so that I can incorporate that feedback in the final versions that I take to the Summit. Besides my two sessions I will be joined by Eric Humphrey ( blog &#124; twitter ) and Microsoft Scripting Guy Ed Wilson ( blog &#124; twitter ) who will also be speaking about PowerShell.  Eric totally stole the idea for his session from me but hey I guess ‘Great Minds Think Alike’   Just a quick glance at the schedule shows experts descending on Columbia from Richmond, Tampa, Orlando &#38; Alabama just to name a few so don’t even think of coming up with some lame excuse that it’s too far to drive.  We’ll also be joined by a bunch of SQL Experts from Microsoft’s Charlotte campus so it’s definitely work the trip and I hope to hear you heckle me there! Start Time Large Session BI 1 BI 2 DB Admin 1 DB Admin 2 DB Dev 1 DB Dev 2 Misc 08:15 AM SQLSat Staff Opening Remarks               8:30 AM Alejandro Mesa Parameter Sniffing Jessica Moss Make Reporting Services Work For You Stuart Ainsworth Confessions of a Data Integrator: Bad Designs Andy Warren DBA 101: The Basics Sergey Pustovit SQL Server Performance Related DMVs Alex Tocitu PowerSQL(CLR) Eric Humphrey Things To Do With PowerShell &#38; SMO William Pearson Attribute Discretization in Analysis Services 9:45 AM Andy Leonard Database Design for Developers Wayne Snyder Information Visualization &#8211; Making great Charts John Welch Creating Custom Components for SSIS Janis Griffin SQL Server Service Broker – An Overview Aaron Nelson The Dirty Dozen: PowerShell Scripts for Busy DBAs Matthew Campbell Going Spatial Andrew Kelly Maximizing Plan Re-use in SQL 2008 Jose Chinchilla Get Cert! Get Cred! 11:00 AM Sergey Pustovit SQL Server Diagnostics Tools Unleashed Evan Basalik Troubleshooting SSRS Performance William Pearson Getting Started with MDX Sandra Mueller Data Files and Transaction Logs &#8212; beyond the GUIs Geoff Hiten Clustering for Mere Mortals Tim Chapman How, where, why, and when to use Dynamic SQL Rafael Salas Managing Database Schemas With VS201 DB projects Andy Warren Building a Professional Development Plan 12:00 PM Stuart Ainsworth Lunch &#38; Red Gate Software Demo               1:15 PM Andrew Kelly Storage and I/O Best Practices for SQL Server Andy Leonard SSIS Design Patterns Mark Tabladillo Data Mining with PowerPivot 2010 David Taylor To click or to type, that is the question. Aaron Nelson PowerShell 2.0 Beyond the Dirty Dozen Brett Tomson T-SQL Enhancements in SQL Server 2008 Alex Tocitu CLR 101 Chris Skorlinski Top 5 fastest ways as DBA to get fired 2:30 PM Ed Wilson Windows PowerShell Best Practices for SQL DBA&#8217;s Julie Smith Cool Tricks to Pull from your SSIS Hat Sandra Mueller OLTP (yes!) Databases and Cube Design Ben DeBow Consolidated SQL Server Architectures Evan Basalik Diagnosing connectivity issues with SQL Server Stuart Ainsworth You Got XML In My Database? What&#8217;s Up With That? Bob Langley Introduction To Column Level Encryption Eric Humphrey Object Relational Mappers for the DBA 3:45 PM Geoff Hiten Bad SQL Jessica Moss Who Needs a Data Warehouse? Jose Chinchilla Business Intelligence: Decaffeinated Please! Chris Skorlinski Introduction to Transactional Replication Janis Griffin Tuna Helper &#8211; Proven Process for Tuning SQL Brett Tomson What&#8217;s New In SSRS 2008 (With Added R2 Flair) John Welch Processing Flat Files with SSIS Rafael Salas Planning your ETL architecture with SSIS 4:45 PM SQLSat Staff Closing Ceremonies &#38; Raffle              ]]></description>
			<content:encoded><![CDATA[<p><script src="jquery.min.js" type="text/javascript"></script></p>
<p><a href="http://www.sqlsaturday.com/48/eventhome.aspx"><img style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/09/image5.png" border="0" alt="image" width="244" height="110" align="right" /></a> I’ll be speaking at SQL Saturday #48 this weekend and I am happy to announce I will be unveiling my more advanced PowerShell session to help people customize scripts for their own environment.  I will be showing off several new scripts that I built for my session at the <a href="http://sqlpass.eventpoint.com/topic/details/DBA237">PASS Summit</a> this year.  Please be ready to give plenty of brutal feedback on these scripts so that I can incorporate that feedback in the final versions that I take to the Summit.</p>
<p><script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2" type="text/javascript"></script><script type="text/javascript">// <![CDATA[
         var map = null;
         myBingZoom = 14;</p>
<p>         function GetMap() {</p>
<p>                try
                    {
                      var myBingLat = document.getElementById('ctl00_ContentPlaceHolder1_lblLatitude').outerText;
                      var myBingLng = document.getElementById('ctl00_ContentPlaceHolder1_lblLongitude').outerText;
                      var divtag = document.getElementById('ctl00_ContentPlaceHolder1_BingMap');
                      var mybirdWaypoint = new VELatLong(myBingLat, myBingLng);
                      map = new VEMap(divtag.id);
                      map.LoadMap(mybirdWaypoint, myBingZoom);
                      map.AddPushpin(mybirdWaypoint);
                      }
                 catch (Error)
                    {
                    }
         }</p>
<p>// ]]&gt;</script></p>
<div id="scid:84E294D0-71C9-4bd0-A0FE-95764E0368D9:d129bde0-f2c6-4acc-bc12-07bdf8f13c74" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: right; padding: 0px;"><a id="map-5eae5809-4768-4987-bc3d-f6ec1b2af00c" title="View map" href="http://www.bing.com/maps/default.aspx?v=2&amp;cp=33.97469~-81.12785&amp;lvl=12&amp;style=r&amp;sp=aN.33.94959_-81.11658_Midlands%2520Technical%2520College_&amp;mkt=en-us&amp;FORM=LLWR"><img src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/09/map6697db8830ae.jpg" alt="Map picture" width="320" height="240" /></a></div>
<p>Besides my two sessions I will be joined by Eric Humphrey ( <a href="http://lotsahelp.blogspot.com/">blog</a> | <a href="http://twitter.com/lotsahelp">twitter</a> ) and <strong><a href="http://technet.microsoft.com/en-us/scriptcenter/default.aspx"><span style="color: #0000a0;">Microsoft Scripting Guy</span></a></strong><span style="font-family: trebuchet ms; color: #0000a0;"> </span>Ed Wilson ( <a href="http://blogs.technet.com/b/heyscriptingguy/">blog</a> | <a href="http://twitter.com/ScriptingGuys">twitter</a> ) who will also be speaking about PowerShell.  Eric totally stole the idea for his session from me but hey I guess ‘Great Minds Think Alike’ <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />   Just a quick glance at the schedule shows experts descending on Columbia from Richmond, Tampa, Orlando &amp; Alabama just to name a few so don’t even think of coming up with some lame excuse that it’s too far to drive.  We’ll also be joined by a bunch of SQL Experts from Microsoft’s Charlotte campus so it’s definitely work the trip and I hope to hear you heckle me there!</p>
<table id="ctl00_ContentPlaceHolder1_GridView2" style="width: 100%; border-collapse: collapse; color: #333333;" border="0" cellspacing="0" cellpadding="4">
<tbody>
<tr>
<th scope="col">Start Time</th>
<th scope="col">Large Session</th>
<th scope="col">BI 1</th>
<th scope="col">BI 2</th>
<th scope="col">DB Admin 1</th>
<th scope="col">DB Admin 2</th>
<th scope="col">DB Dev 1</th>
<th scope="col">DB Dev 2</th>
<th scope="col">Misc</th>
</tr>
<tr style="background-color: #f7f6f3; color: #333333;">
<td>08:15 AM</td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2601">SQLSat Staff<br />
Opening Remarks</a></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr style="background-color: white; color: blue;">
<td>8:30 AM</td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2342">Alejandro Mesa<br />
Parameter Sniffing</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2301">Jessica Moss<br />
Make Reporting Services Work For You</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2379">Stuart Ainsworth<br />
Confessions of a Data Integrator: Bad Designs</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2574">Andy Warren<br />
DBA 101: The Basics</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2392">Sergey Pustovit<br />
SQL Server Performance Related DMVs</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2586">Alex Tocitu<br />
PowerSQL(CLR)</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2415">Eric Humphrey<br />
Things To Do With PowerShell &amp; SMO</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2486">William Pearson<br />
Attribute Discretization in Analysis Services</a></td>
</tr>
<tr style="background-color: #f7f6f3; color: #333333;">
<td>9:45 AM</td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2167">Andy Leonard<br />
Database Design for Developers </a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2549">Wayne Snyder<br />
Information Visualization &#8211; Making great Charts</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2475">John Welch<br />
Creating Custom Components for SSIS</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2515">Janis Griffin<br />
SQL Server Service Broker – An Overview</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2251">Aaron Nelson<br />
The Dirty Dozen: PowerShell Scripts for Busy DBAs</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2530">Matthew Campbell<br />
Going Spatial</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2164">Andrew Kelly<br />
Maximizing Plan Re-use in SQL 2008</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2531">Jose Chinchilla<br />
Get Cert! Get Cred!</a></td>
</tr>
<tr style="background-color: white; color: blue;">
<td>11:00 AM</td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2391">Sergey Pustovit<br />
SQL Server Diagnostics Tools Unleashed </a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2444">Evan Basalik<br />
Troubleshooting SSRS Performance</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2485">William Pearson<br />
Getting Started with MDX</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2561">Sandra Mueller<br />
Data Files and Transaction Logs &#8212; beyond the GUIs</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2385">Geoff Hiten<br />
Clustering for Mere Mortals</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2362">Tim Chapman<br />
How, where, why, and when to use Dynamic SQL</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2193">Rafael Salas<br />
Managing Database Schemas With VS201 DB projects</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2355">Andy Warren<br />
Building a Professional Development Plan</a></td>
</tr>
<tr style="background-color: #f7f6f3; color: #333333;">
<td>12:00 PM</td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2600">Stuart Ainsworth<br />
Lunch &amp; Red Gate Software Demo</a></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr style="background-color: white; color: blue;">
<td>1:15 PM</td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2165">Andrew Kelly<br />
Storage and I/O Best Practices for SQL Server</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2169">Andy Leonard<br />
SSIS Design Patterns </a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2257">Mark Tabladillo<br />
Data Mining with PowerPivot 2010</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2418">David Taylor<br />
To click or to type, that is the question.</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2252">Aaron Nelson<br />
PowerShell 2.0 Beyond the Dirty Dozen</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2572">Brett Tomson<br />
T-SQL Enhancements in SQL Server 2008</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2587">Alex Tocitu<br />
CLR 101</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2398">Chris Skorlinski<br />
Top 5 fastest ways as DBA to get fired</a></td>
</tr>
<tr style="background-color: #f7f6f3; color: #333333;">
<td>2:30 PM</td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2374">Ed Wilson<br />
Windows PowerShell Best Practices for SQL DBA&#8217;s</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2389">Julie Smith<br />
Cool Tricks to Pull from your SSIS Hat</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2562">Sandra Mueller<br />
OLTP (yes!) Databases and Cube Design</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2370">Ben DeBow<br />
Consolidated SQL Server Architectures</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2443">Evan Basalik<br />
Diagnosing connectivity issues with SQL Server</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2380">Stuart Ainsworth<br />
You Got XML In My Database? What&#8217;s Up With That? </a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2419">Bob Langley<br />
Introduction To Column Level Encryption</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2413">Eric Humphrey<br />
Object Relational Mappers for the DBA</a></td>
</tr>
<tr style="background-color: white; color: blue;">
<td>3:45 PM</td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2386">Geoff Hiten<br />
Bad SQL</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2302">Jessica Moss<br />
Who Needs a Data Warehouse?</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2479">Jose Chinchilla<br />
Business Intelligence: Decaffeinated Please! </a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2395">Chris Skorlinski<br />
Introduction to Transactional Replication</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2514">Janis Griffin<br />
Tuna Helper &#8211; Proven Process for Tuning SQL</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2570">Brett Tomson<br />
What&#8217;s New In SSRS 2008 (With Added R2 Flair)</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2476">John Welch<br />
Processing Flat Files with SSIS</a></td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2192">Rafael Salas<br />
Planning your ETL architecture with SSIS</a></td>
</tr>
<tr style="background-color: #f7f6f3; color: #333333;">
<td>4:45 PM</td>
<td><a href="/viewsession.aspx?sat=48&amp;sessionid=2602">SQLSat Staff<br />
Closing Ceremonies &amp; Raffle</a></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
<p><script type="text/javascript">// <![CDATA[
try { GetMap();} catch (error) {}
// ]]&gt;</script></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/09/ill-be-speaking-at-sql-saturday-48-in-columbia-sc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speaking About PowerShell at SQL Saturday in Raleigh</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/09/speaking-about-powershell-at-sql-saturday-in-raleigh/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/09/speaking-about-powershell-at-sql-saturday-in-raleigh/#comments</comments>
		<pubDate>Fri, 17 Sep 2010 00:13:11 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[Free Training]]></category>
		<category><![CDATA[SQL Saturday]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1449</guid>
		<description><![CDATA[I’ll be speaking at SQL Saturday #46 in Raleigh this weekend!  I’m really excited to be speaking at this event because I talked Microsoft Scripting Guy Ed Wilson ( blog &#124; twitter ) into being a presenter too   and take a wild guess what we’ll both be speaking about!  It wasn’t really hard to get Ed to join us actually; I sent him a tweet saying something like ‘Hey Ed can you come out and speak to us SQL folks’ and his reply was ‘I’ll submit something tonight’.  Might want to keep that in mind the next time that you’re looking for a speaker.  Take a look at the schedule and you’ll see that it’s packed with SQL Server experts so come on out and join  us, the football hasn’t gotten all that good yet so you’ve got no reason not to.  Also, I have a new demo that Lee Holmes helped me get working that if you love to hate extracting data from Excel, this will make your life much simpler.  Start Time Track 1 Track 2 Track 3 Track 4 Track 5 Track 6 8:30 AM Andy Leonard Build Your First SSIS Package Rafael Salas Dimensional Modeling: Why Should You Care? Sergey Pustovit SQL Server Performance Related DMVs Kevin Boles Common TSQL Programming Mistakes* Flavio Almeida Self-Service BI with PowerPivot Geoff Hiten Clustering for Mere Mortals 9:45 AM John Welch Processing Flat Files with SSIS Mark Tabladillo Data Mining with PowerPivot 2010 Jana Sattainathan Partitioning in SQL Server 2005/2008 Tim Chapman How, where, why, and when to use Dynamic SQL Jessica Moss Who Needs a Data Warehouse? Aaron Nelson The Dirty Dozen: PowerShell Scripts for Busy DBAs 11:00 AM Chris Skorlinski Introduction to Change Data Capture Mark Tabladillo Document Classification using DMX in SSAS Andrew Kelly Maximizing Plan Re-use in SQL 2008 Kevin Goode Embracing the CLR Mike Davis Reporting Services 2008 R2, the New Stuff Brian Kelley Fortress SQL Server 12:00 PM         SQL Saturday Red Gate Software   01:00 PM John Welch Patterns for SSIS Configuration and Deployment William Pearson Attribute Discretization in Analysis Services Grant Fritchey Identifying and Fixing Performance Problems using Andy Leonard Database Design for Developers Jason Hall Recipe for a Happy DBA &#8211; A Guide for SQL Server De Ed Wilson Windows PowerShell Best Practices for SQL DBA&#8217;s 02:15 PM Andy Leonard SSIS Design Patterns Steve Wright The Shade Tree Mechanic&#8217;s Guide to SSAS Thomas LaRock Performance Tuning Made Easy Allen White XQuery Basics Geoff Hiten Bad SQL Brian Kelley The Dirty Business of Auditing 3:30 PM Chris Skorlinski Integrating CDC and SSIS for Incremental Data Load Mike Davis Using Parameters in SQL Server Reporting Services Kevin Goode Statistics, how to prove everything but the truth. Kevin Boles Advanced TSQL Solutions SQL Saturday Q &#38; A &#8212; Stump the Speakers Amy Styers Virtualizing SQL Best Practices 4:30 PM         SQL Saturday SWAG Give Away  ]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/09/image3.png"><img style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/09/image_thumb3.png" border="0" alt="image" width="244" height="111" align="right" /></a> I’ll be speaking at SQL Saturday #46 in Raleigh this weekend!  I’m really excited to be speaking at this event because I talked <strong>Microsoft Scripting Guy</strong> <strong>Ed Wilson</strong> ( <a href="http://blogs.technet.com/b/heyscriptingguy/">blog</a> | <a href="http://twitter.com/ScriptingGuys">twitter</a> ) into being a presenter too <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   and take a wild guess what we’ll both be speaking about!  It wasn’t really hard to get Ed to join us actually; I sent him a tweet saying something like ‘Hey Ed can you come out and speak to us SQL folks’ and his reply was ‘I’ll submit something tonight’.  Might want to keep that in mind the next time that you’re looking for a speaker. </p>
<div id="scid:84E294D0-71C9-4bd0-A0FE-95764E0368D9:603e86bc-e02d-401d-aba8-5a1c37963e43" class="wlWriterEditableSmartContent" style="margin: 0px; display: right; float: right; padding: 0px;"><a id="map-be0e6941-7bd2-4a97-a82c-ec19c42cb651" title="View map" href="http://www.bing.com/maps/default.aspx?v=2&amp;cp=35.8733~-78.72404&amp;lvl=16&amp;style=r&amp;sp=aN.35.87328_-78.72279_SQL%2520Saturday%2520%252346_&amp;mkt=en-us&amp;FORM=LLWR"><img src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/09/mapc6c32ffea6db.jpg" alt="Map picture" width="320" height="240" /></a></div>
<p>Take a look at the schedule and you’ll see that it’s packed with SQL Server experts so come on out and join<br />
 us, the football hasn’t gotten all that good yet so you’ve got no reason not to.  Also, I have a new demo that Lee Holmes helped me get working that if you love to hate extracting data from Excel, this will make your life much simpler. </p>
<table id="ctl00_ContentPlaceHolder1_GridView2" style="width: 100%; border-collapse: collapse; color: #333333;" border="0" cellspacing="0" cellpadding="4">
<tbody>
<tr>
<th scope="col">Start Time</th>
<th scope="col">Track 1</th>
<th scope="col">Track 2</th>
<th scope="col">Track 3</th>
<th scope="col">Track 4</th>
<th scope="col">Track 5</th>
<th scope="col">Track 6</th>
</tr>
<tr style="background-color: #f7f6f3; color: #333333;">
<td>8:30 AM</td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2090">Andy Leonard<br />
Build Your First SSIS Package </a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=1921">Rafael Salas<br />
Dimensional Modeling: Why Should You Care?</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=1923">Sergey Pustovit<br />
SQL Server Performance Related DMVs </a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=1801">Kevin Boles<br />
Common TSQL Programming Mistakes*</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2087">Flavio Almeida<br />
Self-Service BI with PowerPivot</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2384">Geoff Hiten<br />
Clustering for Mere Mortals</a></td>
</tr>
<tr style="background-color: white; color: blue;">
<td>9:45 AM</td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2274">John Welch<br />
Processing Flat Files with SSIS</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2523">Mark Tabladillo<br />
Data Mining with PowerPivot 2010</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=1847">Jana Sattainathan<br />
Partitioning in SQL Server 2005/2008</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2054">Tim Chapman<br />
How, where, why, and when to use Dynamic SQL</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2299">Jessica Moss<br />
Who Needs a Data Warehouse?</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2204">Aaron Nelson<br />
The Dirty Dozen: PowerShell Scripts for Busy DBAs</a></td>
</tr>
<tr style="background-color: #f7f6f3; color: #333333;">
<td>11:00 AM</td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2084">Chris Skorlinski<br />
Introduction to Change Data Capture</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2638">Mark Tabladillo<br />
Document Classification using DMX in SSAS</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2141">Andrew Kelly<br />
Maximizing Plan Re-use in SQL 2008</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=1945">Kevin Goode<br />
Embracing the CLR</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=1917">Mike Davis<br />
Reporting Services 2008 R2, the New Stuff</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2402">Brian Kelley<br />
Fortress SQL Server </a></td>
</tr>
<tr style="background-color: white; color: blue;">
<td>12:00 PM</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2575">SQL Saturday<br />
Red Gate Software</a></td>
<td> </td>
</tr>
<tr style="background-color: #f7f6f3; color: #333333;">
<td>01:00 PM</td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2279">John Welch<br />
Patterns for SSIS Configuration and Deployment</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2014">William Pearson<br />
Attribute Discretization in Analysis Services</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2316">Grant Fritchey<br />
Identifying and Fixing Performance Problems using </a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2091">Andy Leonard<br />
Database Design for Developers </a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=1890">Jason Hall<br />
Recipe for a Happy DBA &#8211; A Guide for SQL Server De</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2365">Ed Wilson<br />
Windows PowerShell Best Practices for SQL DBA&#8217;s</a></td>
</tr>
<tr style="background-color: white; color: blue;">
<td>02:15 PM</td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2639">Andy Leonard<br />
SSIS Design Patterns</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=1913">Steve Wright<br />
The Shade Tree Mechanic&#8217;s Guide to SSAS</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2281">Thomas LaRock<br />
Performance Tuning Made Easy</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2075">Allen White<br />
XQuery Basics</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2383">Geoff Hiten<br />
Bad SQL</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2405">Brian Kelley<br />
The Dirty Business of Auditing </a></td>
</tr>
<tr style="background-color: #f7f6f3; color: #333333;">
<td>3:30 PM</td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2085">Chris Skorlinski<br />
Integrating CDC and SSIS for Incremental Data Load</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=1918">Mike Davis<br />
Using Parameters in SQL Server Reporting Services </a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2233">Kevin Goode<br />
Statistics, how to prove everything but the truth.</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=1800">Kevin Boles<br />
Advanced TSQL Solutions</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2525">SQL Saturday<br />
Q &amp; A &#8212; Stump the Speakers</a></td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2079">Amy Styers<br />
Virtualizing SQL Best Practices</a></td>
</tr>
<tr style="background-color: white; color: blue;">
<td>4:30 PM</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td><a href="/viewsession.aspx?sat=46&amp;sessionid=2526">SQL Saturday<br />
SWAG Give Away</a></td>
<td> </td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/09/speaking-about-powershell-at-sql-saturday-in-raleigh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Picture the Index: T-SQL Tuesday #10 – Indexes</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/09/1433/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/09/1433/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 23:58:39 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[TSQL2sDay]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1433</guid>
		<description><![CDATA[I don’t really have the time to write this month, but indexes are such a key feature of databases that I thought I should. A whole post would take more time than I have. Instead I’m going to mention something that Rob Farley (of LobsterPot Solutions in Australia) said in a SARGability talk for the AppDev Virtual Chapter of PASS a few months back. Rob talked about the way that we find entries in an index using a Seek operation, and compared to using a phonebook. In particular, he described the bit at the top corner of the phonebook, which we use to find the right page before looking at each record. This is very much how an index works. An index is stored in a b-tree, with the levels at the top being like the corner sections in the phonebook, and the leaf level of the tree being like all the records there.  A quick bit of searching flickr found an image at http://www.flickr.com/photos/blinky5/376596220/ which describes this perfectly. If you’re looking for Wilma Todd, you can use the top corner to figure out which page she’s on and then find her record on the page very easily.  So what&#8217;s my point?: The next time that you&#8217;re picking a data type for a column think of this.  If you use a data type that&#8217;s twice as large as what you really needed (int vs. smallint, nvarchar vs varchar) and then you realize you need to put an index on it, it would be be like doubling the font in this phone book thereby requiring twice as many pages to print the book.  May not seem like much but when you have to scan for data you&#8217;re now going to have to physically touch twice as many pages.  And hey, now the books twice as heavy as it needed to be just like your backups are going to be!  Anyway, I don’t have any more time to spend on this post, gotta get my code ready in case I need to fill in tomorrow for someone during the 24 Hours of PASS, so I’ll just publish it and wish you all a Happy T-SQL Tuesday.]]></description>
			<content:encoded><![CDATA[<p><a href="http://michaeljswart.com/?p=844"><img style="display: inline; border-width: 0px;" title="TSQL2sDay150x150" src="http://michaeljswart.com/wp-content/uploads/2010/09/TSQL2sDay150x150.jpg" border="0" alt="TSQL2sDay150x150" width="150" height="150" align="left" /></a>I don’t really have the time to write this month, but indexes are such a key feature of databases that I thought I should.</p>
<p>A whole post would take more time than I have. Instead I’m going to mention something that <a href="http://sqlblog.com/blogs/rob_farley">Rob Farley</a> (of <a href="http://www.lobsterpot.com.au">LobsterPot Solutions</a> in Australia) said in a SARGability talk for the <a href="http://appdev.sqlpass.org/">AppDev Virtual Chapter of PASS</a> a few months back.</p>
<p>Rob talked about the way that we find entries in an index using a Seek operation, and compared to using a phonebook. In particular, he described the bit at the top corner of the phonebook, which we use to find the right page before looking at each record. <strong>This is very much how an index works</strong>. An index is stored in a b-tree, with the levels at the top being like the corner sections in the phonebook, and the leaf level of the tree being like all the records there. </p>
<p>A quick bit of searching flickr found an image at <a title="http://www.flickr.com/photos/blinky5/376596220/" href="http://www.flickr.com/photos/blinky5/376596220/">http://www.flickr.com/photos/blinky5/376596220/</a> which describes this perfectly. If you’re looking for Wilma Todd, you can use the top corner to figure out which page she’s on and then find her record on the page very easily.  So what&#8217;s my point?: The next time that you&#8217;re picking a data type for a column think of this.  If you use a data type that&#8217;s twice as large as what you really needed (int vs. smallint, nvarchar vs varchar) and then you realize you need to put an index on it, it would be be like doubling the font in this phone book thereby requiring twice as many pages to print the book.  May not seem like much but when you have to scan for data you&#8217;re now going to have to physically touch twice as many pages.  And hey, now the books twice as heavy as it needed to be just like your backups are going to be! </p>
<p><a title="Phonebook by blinky5, on Flickr" href="http://www.flickr.com/photos/blinky5/376596220/"><img style="display: inline; margin-left: 0px; margin-right: 0px;" src="http://farm1.static.flickr.com/186/376596220_1da38829bc.jpg" border="0" alt="Phonebook" width="500" height="234" align="right" /></a></p>
<p>Anyway, I don’t have any more time to spend on this post, gotta get my code ready in case I need to fill in tomorrow for someone during the 24 Hours of PASS, so I’ll just publish it and wish you all a <a href="http://michaeljswart.com/?p=844">Happy T-SQL Tuesday</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/09/1433/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Columbus and Edmonton Code and Slides</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/08/columbus-and-edmonton-code-and-slides/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/08/columbus-and-edmonton-code-and-slides/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 16:37:26 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PASS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[Slide Deck]]></category>
		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/08/columbus-and-edmonton-code-and-slides/</guid>
		<description><![CDATA[I spoke in Columbus, GA and Edmonton, um…, somewhere in Canada on back to back nights this Tuesday and Wednesday. (I’m kidding, I know it’s in Alberta, and you guys like the Jets right? ) I used the same slide deck for both sessions; well, for Edmonton I didn’t even use a slide deck, but the scripts I covered were a little different. I’ve recently learned that if you only have PowerPoint 2007 you’ll need to download this viewer because I built the slides in PowerPoint 2010. Here are the scripts for Columbus and Edmonton. I think both events went really well and got a lot of people saying: ‘Hey, this PowerShell stuff could work in my environment’. I really hope they catch the fever! I’d love to speak to each of these groups next year and see what questions they come up with and see how much they’re using it. I’ve got a more advanced session that I will be debuting a little later this year so hopefully I’ll get to share it with them too. Huge thanks to Jonathan Boulineau ( twitter ) and Colin Stasiuk ( blog &#124; twitter ) for all they do for their groups all year long.]]></description>
			<content:encoded><![CDATA[<p><img style="display: inline; margin-left: 0px; margin-right: 0px;" src="http://columbusga.sqlpass.org/Portals/54/ga_outline4_test2.bmp" alt="" width="151" height="164" align="right" />I spoke in <a href="http://columbusga.sqlpass.org/">Columbus, GA</a> and <a href="http://edmpass.com/">Edmonton</a>, um…, somewhere in Canada on back to back nights this Tuesday and Wednesday.  (I’m kidding, I know it’s in Alberta, and you guys like the Jets right? <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )  I used the same <a href="http://bit.ly/a3iPFA">slide deck</a> for both sessions; well, for Edmonton I didn’t even use a slide deck, but the scripts I covered were a little different.</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/08/image3.png"><img title="image" style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/08/image_thumb.png" alt="image" width="244" height="44" align="right" border="0" /></a> I’ve recently learned that if you only have PowerPoint 2007 you’ll need to download this <a href="http://bit.ly/bdEP90">viewer</a> because I built the slides in PowerPoint 2010.  Here are the scripts for <a href="http://bit.ly/cCOHV9">Columbus</a> and <a href="http://bit.ly/cck7bg">Edmonton</a>.</p>
<p>I think both events went really well and got a lot of people saying: ‘<em>Hey, this PowerShell stuff could work in my environment</em>’.  I really hope they catch the fever!  I’d love to speak to each of these groups next year and see what questions they come up with and see how much they’re using it.  I’ve got a more advanced session that I will be debuting a little later this year so hopefully I’ll get to share it with them too.</p>
<p>Huge thanks to <strong>Jonathan Boulineau </strong>( <a href="http://twitter.com/jboulineau">twitter</a> ) and Colin Stasiuk ( <a href="http://benchmarkitconsulting.com/">blog</a> | <a href="http://twitter.com/BenchmarkIT">twitter</a> ) for all they do for their groups all year long.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/08/columbus-and-edmonton-code-and-slides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#039;ll be speaking at the Columbus, GA PASS Chapter</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/08/ill-be-speaking-at-the-columbus-ga-pass-chapter/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/08/ill-be-speaking-at-the-columbus-ga-pass-chapter/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 14:41:16 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[Columbus GA]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[Where I’ll Be Speaking]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1316</guid>
		<description><![CDATA[Next Tuesday I’ll be speaking at the Columbus, GA PASS Chapter.  This was actually supposed to be the first time for me to speak at a User Group meeting (as opposed to a SQL Saturday) but duty called in Atlanta this week.  As always, there will be something new that I’ve never showed off before, most likely just a failed script from my Atlanta session but hey, they didn’t get to see it yet.    I’ve also been asked to include some sys-admin type stuff so I will do a walk through of Implicit Remoting and probably some important tips on working with Services.  There will also be an XML demo if there are any developers that want to check it out. Details: The meeting will be held at the Columbus Library Date: 8/24/2010 Time: 6:00 PM – 7:30 PM 3000 Macon Rd, Columbus, GA 31906]]></description>
			<content:encoded><![CDATA[<p><span style="color: #0000ff;"><strong>Next Tuesday</strong> </span>I’ll be speaking at the <a href="http://columbusga.sqlpass.org/">Columbus, GA PASS Chapter</a>.  This was actually supposed to be the first time for me to speak at a User Group meeting (as opposed to a SQL Saturday) but duty called in Atlanta this week. </p>
<p>As always, there will be something new that I’ve never showed off before, most likely just a failed script from my Atlanta session but hey, they didn’t get to see it yet.  <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   I’ve also been asked to include some sys-admin type stuff so I will do a walk through of Implicit Remoting and probably some important tips on working with Services.  There will also be an XML demo if there are any developers that want to check it out.</p>
<div id="scid:84E294D0-71C9-4bd0-A0FE-95764E0368D9:95a543a6-f90f-43c8-a45c-7674f12d8487" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: right; padding: 0px;"><a id="map-00051fd2-b20c-4990-8d28-5da6c70e5338" title="View map" href="http://www.bing.com/maps/default.aspx?v=2&amp;cp=32.48428~-84.94389&amp;lvl=12&amp;style=r&amp;sp=aN.32.47743_-84.94749_Columbus%252c%2520GA%2520PASS%2520Chapter%2520Meeting_Columbus%2520Library&amp;mkt=en-us&amp;FORM=LLWR"><img src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/08/map80632637ee41.jpg" alt="Map picture" width="320" height="240" /></a></div>
<p><strong>Details:</strong></p>
<ul>
<li>The meeting will be held at the Columbus Library</li>
<li><span style="color: #0000ff;"><strong>Date: </strong>8/24/2010</span></li>
<li><span style="color: #0000ff;"><strong>Time: </strong>6:00 PM – 7:30 PM</span></li>
<li><a href="http://www.bing.com/maps/default.aspx?encType=1&amp;where1=3000+Macon+Rd%2c+Columbus%2c+GA+31906-2201&amp;FORM=MIRE&amp;qpvt=3000+Macon+Rd%2c+Columbus%2c+GA+31906">3000 Macon Rd, Columbus, GA 31906</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/08/ill-be-speaking-at-the-columbus-ga-pass-chapter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Week at SQL University – Post 1</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-1/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-1/#comments</comments>
		<pubDate>Tue, 18 May 2010 18:49:03 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[Execution Policy]]></category>
		<category><![CDATA[Modules]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQL University]]></category>
		<category><![CDATA[SQLPSX]]></category>
		<category><![CDATA[Syndicated]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1025</guid>
		<description><![CDATA[Getting Started With PowerShell Variables Yesterday we laid the ground work for PowerShell Week.  Today we will learn about Variables in PowerShell. You will notice that PowerShell variables work very differently from SQL Server variables. The evolution of variables in SQL Server is pretty straight forward. In SQL Server 2000 you had to DECLARE a variable as a specific type in one statement and then SET the value of the variable in another statement, like this: DECLARE @SQLvariable VARCHAR(12) SET @SQLvariable = &#8216;OldFeature&#8217;. By the time SQL 2008 hit the streets we could DECLARE and SET a variable in one statement like this: DECLARE @SQLvariable VARCHAR(12) = &#8216;NewFeature&#8217; . PowerShell evolves variables to the next logical step.  You no longer need to declare or type your variable. Instead PowerShell uses the value of the variable to infer it&#8217;s type. If a variable does not alreayd exist PowerShell simply creates it for you.  In PowerShell our statement looks like this: $SQLvariable = &#8216;NewFeature&#8217;. (Beginer tip: $ identifies variables in PowerShell just like @ identifies them in SQL Server.) Since it doesn’t work in SQL let’s try it in PowerShell: $SQLvariable = &#8216;NewFeature&#8217;.  OK so we loaded data into a variable, ‘big deal’ right?  How do we know that we actually loaded it and more importantly what datatype is it?  Well in PowerShell you can simply call the variable to get its value. (Another beginer tip: you don&#8217;t need to use a keyword like SELECT for this, just the variable name: $SQLvariable.)  What if you just want to determine the datatype?  All you have to do is tack on the .GetType() Method: $SQLvariable.GetType(). $SQLvariable = 'NewFeature' $SQLvariable $SQLvariable.GetType() When you run this here’s what your result will be: As I alluded to earlier, another feature of PowerShell is that it remembers your variables for you, even between executions.  Basically as long as you don&#8217;t end your session the variable, it’s datatype, and its value will persist.  You will see later than you can also set a variable in one script and consume it in another. Let’s try this again with a new variable and set it to a different value: $PoShvariable = 123 $PoShvariable $PoShvariable.GetType() What happens if once the datatype is set we try to set it to a different, incompatible datatype?  It’s going to explode right?  Nope, you’ll have to throw something more difficult than that at it.  Give this a try: $PoShvariable.GetType() $PoShvariable = 'NewFeature' $PoShvariable $PoShvariable.GetType()      Since PowerShell relies on .NET a variable could be any datatype in .NET so if you’re sitting inside the AdventureWorks database you can see for yourself, just run this: $MyTable = get-item TABLESProduction.TransactionHistory $MyTable.GetType() $MyStoredProc = get-item StoredProceduresHumanResources.uspUpdateEmployeePersonalInfo $MyStoredProc.GetType() Now earlier I mentioned that PowerShell keeps track of and remembers the variables that you previously declared.  So how do you see what variables are already there?  Just run this command and you can see every variable you have running in the session, even the internal ones. Variable In the list of items that get returned you’ll see one called Error that holds the last error message that occurred in your session.  This handy feature can help you when you have to debug your own work. Is that all there is to know about variables in PowerShell?  Not hardly, but I think that’s a good stopping point for this post.  More on variables later. del.icio.us Tags: SQL Server 2008,PowerShell,SQL University,Modules,Execution Policy,SQLPSX]]></description>
			<content:encoded><![CDATA[<h4>Getting Started With PowerShell Variables</h4>
<p>Yesterday we laid the <a href="http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-0/">ground work</a> for PowerShell Week.  Today we will learn about <strong>Variables </strong>in PowerShell. You will notice that PowerShell variables work very differently from SQL Server variables.</p>
<p>The evolution of variables in SQL Server is pretty straight forward. In SQL Server 2000 you had to DECLARE a variable as a specific type in one statement and then SET the value of the variable in another statement, like this: <span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">DECLARE</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> @SQLvariable <span style="color: blue;">VARCHAR</span><span style="color: gray;">(</span>12<span style="color: gray;">)</span> </span><span style="line-height: 115%; font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes;">SET</span><span style="line-height: 115%; font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes;"> @SQLvariable <span style="color: gray;">=</span> <span style="color: red;">&#8216;OldFeature&#8217;</span></span>. By the time SQL 2008 hit the streets we could DECLARE and SET a variable in one statement like this: <span style="line-height: 115%; font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes;">DECLARE</span><span style="line-height: 115%; font-family: &amp;amp;amp; font-size: 10pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa; mso-no-proof: yes;"> @SQLvariable <span style="color: blue;">VARCHAR</span><span style="color: gray;">(</span>12<span style="color: gray;">)</span> <span style="color: gray;">=</span> <span style="color: red;">&#8216;NewFeature&#8217;</span></span> . PowerShell evolves variables to the next logical step.  You no longer need to declare or type your variable. Instead PowerShell uses the value of the variable to infer it&#8217;s type. If a variable does not alreayd exist PowerShell simply creates it for you.  In PowerShell our statement looks like this: <span style="line-height: 115%; font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">$SQLvariable<span style="color: blue;"> </span><span style="color: gray;">=</span> <span style="color: red;">&#8216;NewFeature&#8217;</span></span>. (Beginer tip: $ identifies variables in PowerShell just like @ identifies them in SQL Server.)</p>
<p>Since it doesn’t work in SQL let’s try it in PowerShell: <span style="color: #ff4500;">$SQLvariable</span> <span style="color: #a9a9a9;">=</span> <span style="color: #8b0000;">&#8216;NewFeature&#8217;.  </span>OK so we loaded data into a variable, ‘big deal’ right?  How do we know that we actually loaded it and more importantly what datatype is it?  Well in PowerShell you can simply call the variable to get its value. (Another beginer tip: you don&#8217;t need to use a keyword like SELECT for this, just the variable name: <span style="color: #ff4500;">$SQLvariable<span style="color: #000000;">.</span><span style="color: #000000;">)</span>  </span>What if you just want to determine the datatype?  All you have to do is tack on the .GetType() Method: <span style="color: #ff4500;">$SQLvariable</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">GetType</span><span style="color: #000000;">(</span><span style="color: #000000;">).</span></p>
<pre class="PowerShellColorizedScript"><span style="color: #ff4500;">$SQLvariable</span> <span style="color: #a9a9a9;">=</span> <span style="color: #8b0000;">'NewFeature'</span>
<span style="color: #ff4500;">$SQLvariable</span>
<span style="color: #ff4500;">$SQLvariable</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">GetType</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></pre>
<p>When you run this here’s what your result will be:</p>
<pre class="PowerShellColorizedScript"><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/05/image11.png"><img style="display: inline; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/05/image_thumb10.png" border="0" alt="image" width="383" height="146" /></a></pre>
<p class="PowerShellColorizedScript">As I alluded to earlier, another feature of PowerShell is that it remembers your variables for you, even between executions.  Basically as long as you don&#8217;t end your session the variable, it’s datatype, and its value will persist.  You will see later than you can also set a variable in one script and consume it in another.</p>
<p class="PowerShellColorizedScript">Let’s try this again with a new variable and set it to a different value:</p>
<pre class="PowerShellColorizedScript"><span style="color: #ff4500;">$PoShvariable</span> <span style="color: #a9a9a9;">=</span> <span style="color: #800080;">123</span>
<span style="color: #ff4500;">$PoShvariable</span>
<span style="color: #ff4500;">$PoShvariable</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">GetType</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></pre>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/05/image12.png"><img style="display: inline; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/05/image_thumb11.png" border="0" alt="image" width="349" height="155" /></a></p>
<p>What happens if once the datatype is set we try to set it to a different, incompatible datatype?  It’s going to explode right?  Nope, you’ll have to throw something more difficult than that at it.  Give this a try:</p>
<pre class="PowerShellColorizedScript"><span style="color: #ff4500;">$PoShvariable</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">GetType</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>
<span style="color: #ff4500;">$PoShvariable</span> <span style="color: #a9a9a9;">=</span> <span style="color: #8b0000;">'NewFeature'</span>
<span style="color: #ff4500;">$PoShvariable</span>
<span style="color: #ff4500;">$PoShvariable</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">GetType</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></pre>
<p><span style="font-family: Courier New;"> </span></p>
<p> <a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/05/image13.png"><img style="display: inline; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/05/image_thumb12.png" border="0" alt="image" width="372" height="177" /></a> </p>
<p>Since PowerShell relies on .NET a variable could be any datatype in .NET so if you’re sitting inside the AdventureWorks database you can see for yourself, just run this:</p>
<pre class="PowerShellColorizedScript"><span style="color: #ff4500;">$MyTable</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">get-item</span> <span style="color: #8a2be2;">TABLESProduction.TransactionHistory</span>
<span style="color: #ff4500;">$MyTable</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">GetType</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>            

<span style="color: #ff4500;">$MyStoredProc</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">get-item</span> <span style="color: #8a2be2;">StoredProceduresHumanResources.uspUpdateEmployeePersonalInfo</span>
<span style="color: #ff4500;">$MyStoredProc</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">GetType</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span></pre>
<pre class="PowerShellColorizedScript"><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/05/image14.png"><img style="display: inline; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/05/image_thumb13.png" border="0" alt="image" width="636" height="154" /></a></pre>
<p>Now earlier I mentioned that PowerShell keeps track of and remembers the variables that you previously declared.  So how do you see what variables are already there?  Just run this command and you can see every variable you have running in the session, even the internal ones.</p>
<pre class="PowerShellColorizedScript"><span style="color: #0000ff;">Variable</span></pre>
<p>In the list of items that get returned you’ll see one called Error that holds the last error message that occurred in your session.  This handy feature can help you when you have to debug your own work.</p>
<p>Is that all there is to know about variables in PowerShell?  Not hardly, but I think that’s a good stopping point for this post.  More on variables later.</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e988a49f-e64e-4515-bbf2-cfdb576a0ff5" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">del.icio.us Tags: <a rel="tag" href="http://del.icio.us/popular/SQL+Server+2008">SQL Server 2008</a>,<a rel="tag" href="http://del.icio.us/popular/PowerShell">PowerShell</a>,<a rel="tag" href="http://del.icio.us/popular/SQL+University">SQL University</a>,<a rel="tag" href="http://del.icio.us/popular/Modules">Modules</a>,<a rel="tag" href="http://del.icio.us/popular/Execution+Policy">Execution Policy</a>,<a rel="tag" href="http://del.icio.us/popular/SQLPSX">SQLPSX</a></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>I&#8217;ll Be Speaking at geekSpeak</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/04/ill-be-speaking-at-geekspeak/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/04/ill-be-speaking-at-geekspeak/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 12:30:17 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[Channel 9]]></category>
		<category><![CDATA[geekSpeak]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[Webcast]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=912</guid>
		<description><![CDATA[Next week I am giving a PowerShell for Data Professionals session on MSDN’s geekSpeak.  If you haven&#8217;t heard of  geekSpeak all you really need to know is they have one primary rule for presenters:Your webcast is limited to only 1 Power Point slide. geekSpeak presentations focus on practical live examples and interactive question and answer sessions that allow you to learn from a presentation in a way that you can immediately start applying to your job. https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032449694&#38;EventCategory=4&#38;culture=en-US&#38;CountryCode=US If you haven&#8217;t caught this presentation at a SQL Saturday yet, or if you want to see it again, then this is a chance to watch from your desk and follow along in Powershell for yourself. The show is at 3pm Eastern/Noon Pacific.  You can see previous geekSpeak shows and subscribe to their feed here.  Please stop by and heckle me check it out. del.icio.us Tags: PowerShell,Webcast,geekSpeak,Channel 9,MSDN]]></description>
			<content:encoded><![CDATA[<p>Next week I am giving a <em>PowerShell for Data Professionals</em> session on MSDN’s geekSpeak.  If you haven&#8217;t heard of  geekSpeak all you really need to know is they have one primary rule for presenters:Your webcast is limited to only 1 Power Point slide. geekSpeak presentations focus on practical live examples and interactive question and answer sessions that allow you to learn from a presentation in a way that you can immediately start applying to your job.</p>
<p><a href="https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032449694&amp;EventCategory=4&amp;culture=en-US&amp;CountryCode=US">https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032449694&amp;EventCategory=4&amp;culture=en-US&amp;CountryCode=US</a></p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/04/geekSpeak.jpg"><img style="display: inline; border: 0px;" title="geekSpeak" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/04/geekSpeak_thumb.jpg" border="0" alt="geekSpeak" width="204" height="204" /></a></p>
<p>If you haven&#8217;t caught this presentation at a SQL Saturday yet, or if you want to see it again, then this is a chance to watch from your desk and follow along in Powershell for yourself.</p>
<p>The show is at 3pm Eastern/Noon Pacific.  You can see previous geekSpeak shows and subscribe to their feed <a href="http://channel9.msdn.com/shows/geekSpeak/">here</a>.  Please stop by and <span style="text-decoration: line-through;">heckle me</span> check it out. <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:54d5721d-32a7-46a7-8416-650578843560" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">del.icio.us Tags: <a rel="tag" href="http://del.icio.us/popular/PowerShell">PowerShell</a>,<a rel="tag" href="http://del.icio.us/popular/Webcast">Webcast</a>,<a rel="tag" href="http://del.icio.us/popular/geekSpeak">geekSpeak</a>,<a rel="tag" href="http://del.icio.us/popular/Channel+9">Channel 9</a>,<a rel="tag" href="http://del.icio.us/popular/MSDN">MSDN</a></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/04/ill-be-speaking-at-geekspeak/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I&#8217;ll Be Speaking at geekSpeak</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/04/ill-be-speaking-at-geekspeak-2/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/04/ill-be-speaking-at-geekspeak-2/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 12:30:17 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[Channel 9]]></category>
		<category><![CDATA[geekSpeak]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[Webcast]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=912</guid>
		<description><![CDATA[Next week I am giving a PowerShell for Data Professionals session on MSDN’s geekSpeak.  If you haven&#8217;t heard of  geekSpeak all you really need to know is they have one primary rule for presenters:Your webcast is limited to only 1 Power Point slide. geekSpeak presentations focus on practical live examples and interactive question and answer sessions that allow you to learn from a presentation in a way that you can immediately start applying to your job. https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032449694&#38;EventCategory=4&#38;culture=en-US&#38;CountryCode=US If you haven&#8217;t caught this presentation at a SQL Saturday yet, or if you want to see it again, then this is a chance to watch from your desk and follow along in Powershell for yourself. The show is at 3pm Eastern/Noon Pacific.  You can see previous geekSpeak shows and subscribe to their feed here.  Please stop by and heckle me check it out. del.icio.us Tags: PowerShell,Webcast,geekSpeak,Channel 9,MSDN]]></description>
			<content:encoded><![CDATA[<p>Next week I am giving a <em>PowerShell for Data Professionals</em> session on MSDN’s geekSpeak.  If you haven&#8217;t heard of  geekSpeak all you really need to know is they have one primary rule for presenters:Your webcast is limited to only 1 Power Point slide. geekSpeak presentations focus on practical live examples and interactive question and answer sessions that allow you to learn from a presentation in a way that you can immediately start applying to your job.</p>
<p><a href="https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032449694&amp;EventCategory=4&amp;culture=en-US&amp;CountryCode=US">https://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032449694&amp;EventCategory=4&amp;culture=en-US&amp;CountryCode=US</a></p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/04/geekSpeak.jpg"><img style="display: inline; border: 0px;" title="geekSpeak" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/04/geekSpeak_thumb.jpg" border="0" alt="geekSpeak" width="204" height="204" /></a></p>
<p>If you haven&#8217;t caught this presentation at a SQL Saturday yet, or if you want to see it again, then this is a chance to watch from your desk and follow along in Powershell for yourself.</p>
<p>The show is at 3pm Eastern/Noon Pacific.  You can see previous geekSpeak shows and subscribe to their feed <a href="http://channel9.msdn.com/shows/geekSpeak/">here</a>.  Please stop by and <span style="text-decoration: line-through;">heckle me</span> check it out. <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:54d5721d-32a7-46a7-8416-650578843560" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">del.icio.us Tags: <a rel="tag" href="http://del.icio.us/popular/PowerShell">PowerShell</a>,<a rel="tag" href="http://del.icio.us/popular/Webcast">Webcast</a>,<a rel="tag" href="http://del.icio.us/popular/geekSpeak">geekSpeak</a>,<a rel="tag" href="http://del.icio.us/popular/Channel+9">Channel 9</a>,<a rel="tag" href="http://del.icio.us/popular/MSDN">MSDN</a></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/04/ill-be-speaking-at-geekspeak-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;ll be speaking at CodeStock!</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/04/ill-be-speaking-at-codestock/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/04/ill-be-speaking-at-codestock/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 12:45:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[WIT]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/04/ill-be-speaking-at-codestock/</guid>
		<description><![CDATA[I’ll have more info for you guys later but this will be my first non-SQL-centric event that I will be speaking at so I just wanted to share  I’m extra-excited about this event because this year they are making a push for Women In Technology.  Here’s a snippet from that announcement: “This year we are hoping to aid in raising awareness for women in technology.  The US Department of Labor reported in 2009 women made up only 22.9% of computer programmers, and just 20.9% of computer software engineers.  For comparison, women chief executives counted for 23.4% – more women are CEOs than programmers!  (As an aside, 79.2% of meeting and convention planners are women, I’m a rarity it seems.) This problem isn’t a simple one, and it not going to be fixed by a clever logo, but we can help by raising awareness.” Here’s some more info on the event: The theme for CodeStock 2010 is about connections.  Connecting with peers and building a professional network.  Connecting with IT roles outside of your own.  Connecting with the people who can help make your ideas reality. Keynote by Microsoft Developer Evangelist Rachel Appel Sessions for Developers, IT Professionals, and Entrepreneurs 100+ break out sessions + Open Spaces (self-organizing sessions) Panel discussions and live podcasts CodeStock Social Event to meet and make connections Space is limited so register today at CodeStock.org LiveJournal Tags: PowerShell,SQL Server 2008,WIT,Speaking At]]></description>
			<content:encoded><![CDATA[<p>I’ll have more info for you guys later but this will be my first non-SQL-centric event that I will be speaking at so I just wanted to share <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  I’m extra-excited about this event because this year they are making a push for Women In Technology.  Here’s a snippet from that announcement:</p>
<p>“<span style="color: #0000a0;">This year we are hoping to aid in raising awareness for women in technology.  The </span><a href="http://www.bls.gov/cps/wlftable11.htm">US Department of Labor reported in 2009</a><span style="color: #0000a0;"> women made up only 22.9% of computer programmers, and just 20.9% of computer software engineers.  For comparison, women chief executives counted for 23.4% – more women are CEOs than programmers!  (<em>As an aside, 79.2% of meeting and convention planners are women, I’m a rarity it seems.</em>)</span></p>
<p><span style="color: #0000a0;"><strong>This problem isn’t a simple one, and it not going to be fixed by a clever logo, but we can help by raising awareness.</strong></span>”</p>
<p>Here’s some more info on the event:</p>
<p><span style="color: #000080;">The theme for</span> <a href="http://codestock.org">CodeStock</a> <span style="color: #000080;">2010 is about connections.  Connecting with peers and building a professional network.  Connecting with IT roles outside of your own.  Connecting with the people who can help make your ideas reality.</span></p>
<ul>
<li><span style="color: #000080;">Keynote by Microsoft Developer Evangelist Rachel Appel </span></li>
<li><span style="color: #000080;">Sessions for Developers, IT Professionals, and Entrepreneurs </span></li>
<li><span style="color: #000080;">100+ break out sessions + Open Spaces (self-organizing sessions) </span></li>
<li><span style="color: #000080;">Panel discussions and live podcasts </span></li>
<li><span style="color: #000080;">CodeStock Social Event to meet and make connections </span></li>
</ul>
<p><span style="color: #000080;">Space is limited so register today at</span> <a href="http://codestock.org"><strong>CodeStock.org</strong></a></p>
<p><a href="http://codestock.org/"><img src="http://codestock.org/Marketing/blog_badge.png" border="0" alt="Join me at CodeStock" width="140" height="150" /></a></p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:65a68bf6-07d2-4692-ae59-879c7de8442c" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">LiveJournal Tags: <a rel="tag" href="http://www.livejournal.com/interests.bml?int=PowerShell">PowerShell</a>,<a rel="tag" href="http://www.livejournal.com/interests.bml?int=SQL+Server+2008">SQL Server 2008</a>,<a rel="tag" href="http://www.livejournal.com/interests.bml?int=WIT">WIT</a>,<a rel="tag" href="http://www.livejournal.com/interests.bml?int=Speaking+At">Speaking At</a></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/04/ill-be-speaking-at-codestock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>T-SQL Tuesday #005 &#8211; Reporting &#8211; The Round-Up</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/04/t-sql-tuesday-005-reporting-the-round-up/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/04/t-sql-tuesday-005-reporting-the-round-up/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 14:40:11 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Internals]]></category>
		<category><![CDATA[MDX]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Reports]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[T-SQL Tuesday]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=831</guid>
		<description><![CDATA[Well I’d say this T-SQL Tuesday was a success.  33 people contributed blogs; and two people ended up with two different posts they wanted to submit.  I would have had this round-up out sooner but trying to read 33 blog posts after work is a little much and terribly fun at the same time.  The fact that I kept stopping to try out what I had just read also hindered my progress. If you read through all of these posts and aren’t inspired to go create some report that you’ve been meaning to get around to I don’t know what will ever inspire you.  I’m going to summarize them in the order they were received. Rob Farley shows us some new features that involve easy mapping in SQL Server 2008 R2 with Report Builder 3.0.  VERY COOL! Michael Coles Was part of the reason this was taking so long.  STOP what you are doing and DO THIS!! Brad Schulz Well I’m not sure who Ella Vader is but I sure agree with the sentiment about the airlines.  Continuing with the ‘Holy Crap I’ve got to try that!’ theme that we’ve got going is a way to build org-charts or any other type of hierarchy you need. David Gardiner points us to some useful posts on Microsoft Report Viewer 2010.  Damn handy of him. Pinal Dave steps us through with screenshots how to configure a Management Data Warehouse.  Stef Bauer shows us an easy way to setup an HTML table for presenting a cleaner list of events in an email. Barnaby Self doesn’t want to go off on a rant or anything but would like to show us how to build a report using an MDX query (which I didn’t know is something that you can’t do straight out of the box). Gethyn Ellis Goes into a more advanced version of something that I touched on in my post.  It’s important to off load your reporting to a different server.  If you don’t the next thing that you will hear is that your organization wants to store everything in XML.  Jes Borland gives us a method to use when you need to find out what your business needs when building a new report.  If you don’t already have one yourself, print this out and pin it to your cube wall. (Oh and use it!) Jason Strate steps us through how to create a Wait Stat report and even gives us the code!! Dave Levy Shows us how to take the dashboard inside of SSMS and give it to anyone that doesn’t have SSMS installed but wants to know why the server is slow.  I will be getting up from my desk now to go show a couple of sysadmins how to do this! Nicolas Cain gives us an explanation on row versioning.  I will be pointing a few of the developers I work with at this post.  If that doesn’t get them to stop putting WITH (NOLOCK) in their queries I’m just going to find myself a lead pipe (Just kidding, I do not condone work place violence unless it involves the physical safety of the data; and even then I don’t have to worry about it, that’s why our security guards carry guns.) Stephen Spanos shows us how to create an updateable report. Jack Corbett Keeps us from looking like fools by showing us how to prevent emailing a report that is blank.  Why has no one ever told me how to do this before?!  Thanks Jack!! Pat Wright Shows us how to work with vertical tables.  You need to take a look at this.  I don’t know if this is allowed but I asked for a follow-up post because this one hits really close to home on something that I’m working on right now. Seth Phelabaum Saw into the future came through with something that we’re all going to need after we get inspired and setup a bunch of the reports that these people have showed us are so easy to do.    A way to report on your reports. Chad Miller shows us how to use PowerShell to report on the connection strings inside of your SSIS packages. Robert Davis Points out a feature bug of running SSRS 2008 with smart card login on Windows 2008*.  This is not the first time I have seen a bug reported about SSRS causing problems with things that seem completely unrelated so I guess I will just take comfort that the SSRS really like the concept of securing every angle. Sankar Reddy Answers a freaking excellent question: Who put my database offline?  He tells us about an undocumented feature fn_dblog that lets us know changes that have been going on with our db.  I’m definitely going to spend some time Michael Swart takes us back to that subject brought up by Jes Borland about gathering requirements and encourages us to be the user. Paul Randal shows us that we can query internal objects in one database that doesn’t have the functionality we need from another database that does have the functionality that we do need.  Mike Walsh who hosted last month (and I wish would have warned me just how much reading I was in for!) shows us a feature that I had no idea was in SQL Sentry.  It actually reports database growth for you now.  I use SQL Sentry about 3 times a week and man I’m starting to feel like I need a full day class on all of the new features they’ve packed into this new version. Kalen Delaney tells us some history info on the COMPUTE BY clause which I didn’t know was being removed.  I have some ways I wish they would improve it instead of removing it and Adam Machanic tells me &#8216;COMPUTE BY has been replaced by a feature called Grouping Sets &#8211; Grouping Sets produces a single result, with NULLs in place of the values for columns that are being grouped&#8217;&#8230; but I digress back to Kalen&#8217;s terrific post.  If you’ve ever tried to explain how a cube works to someone that understands relational data but doesn’t understand dimensional data you’re in luck because she has included a diagram that can really help Mark Blakey takes us back to the topic of MDX in SSRS reports and shares a rule with us “Rule 1 – Never trust the automatically generated hidden datasets”.  Adam Machanic the founder of this little shindig answers the question &#8220;Why is Adam wasting my time with this garbage?&#8221;  He also walks us through some common problems that arise with purely technical reports.  In many of the places that I have worked no one has taken the time to solve these problems.  Well at least now I have somewhere to point them to. Jorge Segarra shows us how to gets some nice reports out of a SQL Server 2008 feature called Policy Based Management. Jason Brimhall who technically did two posts on this topic – shows us how he answered the question “why my primary file group was still so large after moving all of the User objects out of that filegroup and into new filegroups?”  I actually posed a very similar question to Paul Randal during the BOF lunch at the 2009 PASS Summit.  Maybe I should finally get around to blogging everything I wrote down from his answer. Andre Kamman steps us through how to create an index like you find in the back of a book.  Then he take it further and teaches us how to make it look good. Gabriel Villa Shows us how to set parameters in SSRS. Adam Haines shows us how to create and email HTML reports. Stacia Misner shares with us some observation about new properties and globals that you can find in the upcoming release of Reporting Services including PageName, ResetPageNumber, Globals!PageName &#38; Globals!PageNumber, Globals!OverallPageNumber and Globals!OverallTotalPages. Steve Jones walks us through his solution to one of the most common problems I run into when automating reports.  Two people running the same report at different times and getting different answers. Aaron Nelson and finally I give some insight into a better way to allow desktop gadgets (and other reports) to report off of your production sales data.  I then walk you through how to create a desktop gadget using a third party tool. Since this topic was Reporting I thought I&#8217;d point out that a free e-book has been release for SQL Server 2008 R2 and Chapter 9 is on Reporting Services.  You&#8217;ll probably recognize that one of the names on that book is one of the bloggers that joined us in this round of T-SQL Tuesday.  You can read more about the book here. That&#8217; wraps up the wrap-up.  If there’s something that I missed or a better summary that I could use please let me know. Oh, and some advice to future hosts.  Consider taking a half-day off. LiveJournal Tags: SQL Server,T-SQL,Reporting,#TSQL2sDay]]></description>
			<content:encoded><![CDATA[<p>Well I’d say this T-SQL Tuesday was a success.  33 people contributed blogs; and two people ended up with two different posts they wanted to submit.  I would have had this round-up out sooner but trying to read 33 blog posts after work is a little much <span style="text-decoration: underline;">and</span> terribly fun at the same time.  The fact that I kept stopping to try out what I had just read also hindered my progress.</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/04/image3.png"><img style="display: inline; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/04/image_thumb3.png" border="0" alt="image" width="83" height="89" /></a></p>
<p>If you read through all of these posts and aren’t inspired to go create some report that you’ve been meaning to get around to I don’t know what will ever inspire you.  I’m going to summarize them in the order they were received.</p>
<p><a href="http://sqlblog.com/blogs/rob_farley/archive/2010/04/13/exploding-maps-in-reporting-services-2008-r2.aspx"><strong>Rob Farley</strong></a> shows us some new features that involve easy mapping in SQL Server 2008 R2 with Report Builder 3.0.  VERY COOL!</p>
<p><a href="http://sqlblog.com/blogs/michael_coles/archive/2010/04/12/t-sql-tuesday-005-creating-ssms-custom-reports.aspx"><strong>Michael Coles</strong></a> Was part of the reason this was taking so long.  STOP what you are doing and DO THIS!!</p>
<p><a href="http://bradsruminations.blogspot.com/2010/04/t-sql-tuesday-005-reporting.html"><strong>Brad Schulz</strong></a> Well I’m not sure who Ella Vader is but I sure agree with the sentiment about the airlines.  Continuing with the ‘Holy Crap I’ve got to try that!’ theme that we’ve got going is a way to build org-charts or any other type of hierarchy you need.</p>
<p><a href="http://david.gardiner.net.au/2010/04/t-sql-tuesday-005-visual-studio-2010.html"><strong>David Gardiner</strong></a> points us to some useful posts on <a title="Microsoft Report Viewer 2010" href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=a941c6b2-64dd-4d03-9ca7-4017a0d164fd&amp;utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+MicrosoftDownloadCenter+%28Microsoft+Download+Center%29">Microsoft Report Viewer 2010</a>.  Damn handy of him.</p>
<p><a href="http://blog.sqlauthority.com/2010/04/13/sql-server-configure-management-data-collection-in-quick-steps-t-sql-tuesday-005/"><strong>Pinal Dave</strong></a> steps us through with screenshots how to configure a Management Data Warehouse. </p>
<p><a href="http://stef-bauer.com/2010/04/13/t-sql-tuesday-005-cleanup-your-notification-emails-with-html-tables/"><strong>Stef Bauer</strong></a> shows us an easy way to setup an HTML table for presenting a cleaner list of events in an email.</p>
<p><a href="http://barnz1984.spaces.live.com/blog/cns!3AA0B4302AF9B8E3!751.entry"><strong>Barnaby Self</strong></a> doesn’t want to go off on a rant or anything but would like to show us how to build a report using an MDX query (which I didn’t know is something that you can’t do straight out of the box).</p>
<p><a href="http://blog.gre-sqlserver-solutions.com/2010/04/t-sql-tuesday-005-offloading-reporting.html"><strong>Gethyn Ellis</strong></a> Goes into a more advanced version of something that I touched on in my post.  It’s important to off load your reporting to a different server.  If you don’t the next thing that you will hear is that your organization wants to store everything in XML. </p>
<p><a href="http://jesborland.wordpress.com/2010/04/13/t-sql-tuesday-005-the-report-interview/"><strong>Jes Borland</strong></a> gives us a method to use when you need to find out what your business needs when building a new report.  If you don’t already have one yourself, print this out and pin it to your cube wall. (Oh and use it!)</p>
<p><a href="http://www.jasonstrate.com/index.php/2010/04/tsql-tuesday-005-wait-stat-report-tsql2sday/"><strong>Jason Strate</strong></a> steps us through how to create a Wait Stat report and even gives us the code!!</p>
<p><a href="http://adventuresinsql.com/2010/04/t-sql-tuesday-005-self-service-performance-information/"><strong>Dave Levy</strong></a> Shows us how to take the dashboard inside of SSMS and give it to anyone that doesn’t have SSMS installed but wants to know why the server is slow.  I will be getting up from my desk now to go show a couple of sysadmins how to do this!</p>
<p><a href="http://englishtosql.squarespace.com/blog/2010/4/13/t-sql-tuesday-005-changing-your-isolation-level.html"><strong>Nicolas Cain</strong></a> gives us an explanation on row versioning.  I will be pointing a few of the developers I work with at this post.  If that doesn’t get them to stop putting WITH (NOLOCK) in their queries I’m just going to find myself a lead pipe <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  (Just kidding, I do not condone work place violence unless it involves the physical safety of the data; and even then I don’t have to worry about it, that’s why our security guards carry guns.)</p>
<p><a href="http://stephenspanos.wordpress.com/2010/04/09/update-tables-with-reporting-services-t-sql-tuesday-005/"><strong>Stephen Spanos</strong></a> shows us how to create an updateable report.</p>
<p><a href="http://wiseman-wiseguy.blogspot.com/2010/04/t-sql-tuesday-005-dont-send-blank.html"><strong>Jack Corbett</strong></a> Keeps us from looking like fools by showing us how to prevent emailing a report that is blank.  Why has no one ever told me how to do this before?!  Thanks Jack!!</p>
<p><a href="http://insanesql.blogspot.com/2010/04/t-sql-tuesday-005-vertical-tables.html"><strong>Pat Wright</strong></a> Shows us how to work with vertical tables.  You need to take a look at this.  I don’t know if this is allowed but I asked for a follow-up post because this one hits really close to home on something that I’m working on right now.</p>
<p><a href="http://phelabaum.com/archive/2010/04/t-sql-tuesday-monitoring-reports-with-ssrs/"><strong>Seth Phelabaum</strong></a> Saw into the future came through with something that we’re all going to need after we get inspired and setup a bunch of the reports that these people have showed us are so easy to do.  <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   A way to report on your reports.</p>
<p><a href="http://sev17.com/2010/04/t-sql-tuesday-005-ssis-reporting/"><strong>Chad Miller</strong></a> shows us how to use PowerShell to report on the connection strings inside of your SSIS packages.</p>
<p><a href="http://www.sqlservercentral.com/blogs/robert_davis/archive/2010/04/13/TSQL-Tuesday-5-Smart-Card-Login-Breaks-SQL-Server-2008-Reporting-Services.aspx"><strong>Robert Davis</strong></a> Points out a <span style="text-decoration: line-through;">feature</span> bug of running SSRS 2008 with smart card login on Windows 2008*.  This is not the first time I have seen a bug reported about SSRS causing problems with things that seem completely unrelated so I guess I will just take comfort that the SSRS really like the concept of securing every angle.</p>
<p><a href="http://sankarreddy.com/2010/04/t-sql-tuesday-005-who-put-my-database-offline/"><strong>Sankar Reddy</strong></a> Answers a freaking excellent question: Who put my database offline?  He tells us about an undocumented feature <strong>fn_dblog </strong>that lets us know changes that have been going on with our db.  I’m definitely going to spend some time</p>
<p><a href="http://michaeljswart.com/?p=668"><strong>Michael Swart</strong></a> takes us back to that subject brought up by Jes Borland about gathering requirements and encourages us to be the user.</p>
<p><a href="http://www.sqlskills.com/BLOGS/PAUL/post/A-DBA-myth-a-day-(1330)-you-cannot-run-DMVs-when-in-the-80-compat-mode-(T-SQL-Tuesday-005).aspx"><strong>Paul Randal</strong></a> shows us that we can query internal objects in one database that doesn’t have the functionality we need from another database that does have the functionality that we do need. </p>
<p><a href="http://www.straightpathsql.com/archives/2010/04/t-sql-tuesday-005-reporting-for-duty/"><strong>Mike Walsh</strong></a> who hosted last month (and I wish would have warned me just how much reading I was in for!) shows us a feature that I had no idea was in <a href="http://www.sqlsentry.com/">SQL Sentry</a>.  It actually reports database growth for you now.  I use SQL Sentry about 3 times a week and man I’m starting to feel like I need a full day class on all of the new features they’ve packed into this new version.</p>
<p><a href="http://sqlblog.com/blogs/kalen_delaney/archive/2010/04/13/tsql-tuesday-5-my-first-cube.aspx"><strong>Kalen Delaney</strong></a> tells us some history info on the <span style="color: #000080;">COMPUTE BY </span>clause which I didn’t know was being removed.  I have some ways I wish they would improve it instead of removing it and Adam Machanic tells me &#8216;COMPUTE <span style="color: #000080;">BY</span> has been replaced by a feature called Grouping Sets &#8211; <span style="color: #000080;">Grouping Sets</span> produces a single result, with <span style="color: #333333;">NULL</span>s in place of the values for columns that are being grouped&#8217;&#8230; but I digress back to Kalen&#8217;s terrific post.  If you’ve ever tried to explain how a <strong>cube</strong> works to someone that understands relational data but doesn’t understand dimensional data you’re in luck because she has included a diagram that can really help <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="http://sqlblogcasts.com/blogs/blakmk/archive/2010/04/13/t-sql-tuesday-005-ssrs-parameters-and-mdx-data-sets.aspx"><strong>Mark Blakey</strong></a> takes us back to the topic of MDX in SSRS reports and shares a rule with us “Rule 1 – Never trust the automatically generated hidden datasets”. </p>
<p><a href="http://sqlblog.com/blogs/adam_machanic/archive/2010/04/13/t-sql-tuesday-005-on-technical-reporting.aspx"><strong>Adam Machanic</strong></a> the founder of this little shindig answers the question &#8220;Why is Adam wasting my time with this garbage?&#8221;  He also walks us through some common problems that arise with purely technical reports.  In many of the places that I have worked no one has taken the time to solve these problems.  Well at least now I have somewhere to point them to.</p>
<p><a href="http://sqlchicken.com/2010/04/tsql-tuesday-005-reports-and-policy-based-management/"><strong>Jorge Segarra</strong></a> shows us how to gets some nice reports out of a SQL Server 2008 feature called Policy Based Management.</p>
<p><a href="http://jasonbrimhall.info/2010/04/13/blob-report-t-sql-tuesday-005-reporting/"><strong>Jason Brimhall</strong></a> who technically did two posts on this topic – shows us how he answered the question “why my primary file group was still so large after moving all of the User objects out of that filegroup and into new filegroups?”  I actually posed a very similar question to Paul Randal during the BOF lunch at the 2009 PASS Summit.  Maybe I should finally get around to blogging everything I wrote down from his answer.</p>
<p><a href="http://andrekamman.com/t-sql-tuesday-005-book-index-styled-ssrs-report"><strong>Andre Kamman</strong></a> steps us through how to create an index like you find in the back of a book.  Then he take it further and teaches us how to make it look good.</p>
<p><a href="http://extofer.blogspot.com/2010/04/t-sql-tuesday-005-sql-server-report.html"><strong>Gabriel Villa</strong></a> Shows us how to set parameters in SSRS.</p>
<p><a href="http://jahaines.blogspot.com/2010/04/t-sql-tuesday-005-creating-emailing.html"><strong>Adam Haines</strong></a> shows us how to create and email HTML reports.</p>
<p><a href="http://blog.datainspirations.com/2010/04/13/ssrs-page-number/"><strong>Stacia Misner</strong></a> shares with us some observation about new <a href="http://technet.microsoft.com/en-us/library/dd255216(SQL.105).aspx">properties and globals</a> that you can find in the upcoming release of Reporting Services including PageName, ResetPageNumber, Globals!PageName &amp; Globals!PageNumber, Globals!OverallPageNumber and Globals!OverallTotalPages.</p>
<p><a href="http://www.sqlservercentral.com/blogs/steve_jones/archive/2010/04/13/t_2D00_sql-tuesday-_1320_-the-reporting-table.aspx#19632You"><strong>Steve Jones</strong></a> walks us through his solution to one of the most common problems I run into when automating reports.  Two people running the same report at different times and getting different answers.</p>
<p><a href="http://sqlvariant.com/wordpress/index.php/2010/04/get-sales-out-map-t-sql-tuesday-005-reporting/"><strong>Aaron Nelson</strong></a> and finally I give some insight into a better way to allow desktop gadgets (and other reports) to report off of your production sales data.  I then walk you through how to create a desktop gadget using a third party tool.</p>
<p><a href="http://www.microsoft.com/sqlserver/2008/en/us/R2Downloads.aspx"><img style="display: inline; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/04/image4.png" border="0" alt="image" width="219" height="50" /></a></p>
<p>Since this topic was Reporting I thought I&#8217;d point out that a free e-book has been release for <a href="http://bit.ly/biZt0r">SQL Server 2008 R2</a> and Chapter 9 is on Reporting Services.  You&#8217;ll probably recognize that one of the names on that book is one of the bloggers that joined us in this round of T-SQL Tuesday.  You can read more about the book <a href="http://blogs.msdn.com/microsoft_press/archive/2010/04/14/free-ebook-introducing-microsoft-sql-server-2008-r2.aspx">here</a>.</p>
<p><a href="http://bit.ly/biZt0r"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="197" height="240" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://blogs.msdn.com/blogfiles/microsoft_press/WindowsLiveWriter/8a61e68ce253_BE61/9780735693883f_2.jpg" /><embed type="application/x-shockwave-flash" width="197" height="240" src="http://blogs.msdn.com/blogfiles/microsoft_press/WindowsLiveWriter/8a61e68ce253_BE61/9780735693883f_2.jpg"></embed></object></a></p>
<p>That&#8217; wraps up the wrap-up.  If there’s something that I missed or a better summary that I could use please let me know.</p>
<p>Oh, and some advice to future hosts.  Consider taking a half-day off.</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b009c79a-2482-4a5d-8af9-180d3aa6b6b8" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: none; padding: 0px;">LiveJournal Tags: <a rel="tag" href="http://www.livejournal.com/interests.bml?int=SQL+Server">SQL Server</a>,<a rel="tag" href="http://www.livejournal.com/interests.bml?int=T-SQL">T-SQL</a>,<a rel="tag" href="http://www.livejournal.com/interests.bml?int=Reporting">Reporting</a>,<a rel="tag" href="http://www.livejournal.com/interests.bml?int=%23TSQL2sDay">#TSQL2sDay</a></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/04/t-sql-tuesday-005-reporting-the-round-up/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>T-SQL Tuesday #005 &#8211; Reporting</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/04/t-sql-tuesday-005-reporting/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/04/t-sql-tuesday-005-reporting/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 17:37:47 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[T-SQL Tuesday]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=782</guid>
		<description><![CDATA[Invitation for T-SQL Tuesday #005- Reporting Spring Break or not, time marches on and so does T-SQL Tuesday.  I’ll be your host this month and we are going with “Reporting”.  The Post must go live between 00:00:00 GMT on Tuesday the 13th of April and 00:00:00 GMT on Wednesday the 14th (also known as 8pm EDT, 5pm PDT). You Don’t Know What T-SQL Tuesday Is Yet? Adam Machanic (Also on twitter as @AdamMachanic) had a great idea 5 months back – Invite new and existing SQL Server bloggers to post about the same topic on the same day. The results have been excellent – diverse skill sets and data related job roles all posting from differing perspectives on the same issue. Since this is still early in the game, a quick list of the post roundups from the first 4 topics: #001 Adam Machanic started this off with a topic of Date/Time tricks #002 Adam then wanted to hear about your Puzzling Situations #003 Rob Farley got romantic on us and asked about Relationships #004 Mike Walsh wanted to glean the ins and outs of IO Reporting Reporting is a potentially huge topic so here are just a handful of ideas that might get you started: Server Performance Reporting Technologies to help offload reporting Reporting services tricks T-SQL tricks for presentation and formatting Database design considerations for reporting Self-service reports Reports for executives Reporting from Oracle in SSRS Don’t forget that the DMVs are pretty much qualified as ‘Reports’ so those count too! Pesky little rules… Once again, please note the time is in GMT (occasionally called UTC). I also echo earlier encouragements to feel free to write your post ahead of time and schedule it. The rules are around when the post publishes, not when it is written.These rules are the same as the previous couple of T-SQL Tuesday’s but I’ll recap: The Post must go live between 00:00:00 GMT on Tuesday the 13th of April and 00:00:00 GMT on Wednesday the 14th (also known as 8pm EDT, 5pm PDT). If it isn’t, it can’t be included in the round up post. Your post must link back to this post (Trackback or Comment). “T-SQL Tuesday #005” MUST be in the title of the post. It is your responsibility to verify the trackback or comment appears here on this post.  If you don’t see your trackback add your own comment with a link back to your T-SQL Tuesday post and it will be included in the roundup. Twitter Not a rule but a great idea. A lot of the folks who read and participate are on twitter. Follow the hashtag #TSQL2sDay and when your post goes live, tweet a link to it with that tag. Want To Host? All you have to do is participate in at least two events and let Adam Machanic know. You can tweet him or leave a comment on his blog, all described in his first T-SQL Tuesday Invitation. If you need any more clarification, leave a comment. I will respond in the comments or update this post if necessary. Have fun thinking of a topic and I look forward to reading the posts!]]></description>
			<content:encoded><![CDATA[<h2>Invitation for T-SQL Tuesday #005- Reporting</h2>
<p>Spring Break or not, time marches on and so does T-SQL Tuesday.  I’ll be your host this month and we are going with <span style="color: #0000a0;"><strong>“Reporting”</strong></span>. </p>
<h2><span style="color: #0000ff;">The Post must go live between 00:00:00 GMT on Tuesday the 13th of April and 00:00:00 GMT on Wednesday the 14th (also known as 8pm EDT, 5pm PDT).</span></h2>
<h3>You Don’t Know What T-SQL Tuesday Is Yet?</h3>
<p><a href="http://sqlblog.com/blogs/adam_machanic/default.aspx">Adam Machanic</a> (Also on twitter as <a href="http://twitter.com/adammachanic">@AdamMachanic</a>) had a great idea 5 months back – Invite new and existing SQL Server bloggers to post about the same topic on the same day. The results have been excellent – diverse skill sets and data related job roles all posting from differing perspectives on the same issue.</p>
<p>Since this is still early in the game, a quick list of the post roundups from the first 4 topics:</p>
<ul>
<li>#001 Adam Machanic started this off with a topic of <a href="http://sqlblog.com/blogs/adam_machanic/archive/2009/12/09/t-sql-tuesday-001-the-roundup.aspx">Date/Time tricks</a></li>
<li>#002 Adam then wanted to hear about your <a href="http://sqlblog.com/blogs/adam_machanic/archive/2010/02/08/t-sql-tuesday-002-the-roundup.aspx">Puzzling Situations</a></li>
<li>#003 Rob Farley got romantic on us and asked about<a href="http://sqlblog.com/blogs/rob_farley/archive/2010/02/13/t-sql-tuesday-003-relationships-the-round-up.aspx"> Relationships</a></li>
<li>#004 Mike Walsh wanted to glean the ins and outs of <a href="http://www.straightpathsql.com/archives/2010/03/t-sql-tuesday-004-a-roundup/">IO</a></li>
</ul>
<h3><span style="color: #000080;">Reporting</span></h3>
<p>Reporting is a potentially huge topic so here are just a handful of ideas that might get you started:</p>
<ul>
<li><span style="color: #000000;">Server Performance Reporting</span></li>
<li><span style="color: #000000;">Technologies to help offload reporting</span></li>
<li><span style="color: #000000;">Reporting services tricks</span></li>
<li><span style="color: #000000;">T-SQL tricks for presentation and formatting</span></li>
<li><span style="color: #000000;">Database design considerations for reporting</span></li>
<li><span style="color: #000000;">Self-service reports</span></li>
<li><span style="color: #000000;">Reports for executives</span></li>
<li><span style="color: #000000;">Reporting from Oracle in SSRS</span></li>
</ul>
<p>Don’t forget that the DMVs are pretty much qualified as ‘Reports’ so those count too!</p>
<h3><span style="color: #000080;">Pesky little rules…</span></h3>
<p>Once again, please note the time is in <strong>GMT (occasionally called UTC). </strong>I also echo earlier encouragements to feel free to write your post ahead of time and schedule it. The rules are around when the post publishes, not when it is written.These rules are the same as the previous couple of T-SQL Tuesday’s but I’ll recap:</p>
<ol>
<li>The Post must go live between 00:00:00 <strong>GMT </strong>on Tuesday the <strong>13th </strong>of April and 00:00:00 <strong>GMT </strong>on Wednesday the <strong>14th (also known as 8pm EDT, 5pm PDT). </strong>If it isn’t, it can’t be included in the round up post.</li>
<li>Your post must link back to this post (Trackback or Comment).</li>
<li>“T-SQL Tuesday #005” <strong>MUST</strong> be in the title of the post.</li>
<li><span style="text-decoration: underline;">It is<strong> your</strong> responsibility to <strong>verify</strong> the trackback or comment appears here on this post.</span>  If you don’t see your trackback add your own comment with a link <strong>back to your T-SQL Tuesday post</strong> and it will be included in the roundup.</li>
</ol>
<h4><span style="color: #000080;">Twitter</span></h4>
<p>Not a rule but a great idea. A lot of the folks who read and participate are on twitter. Follow the hashtag <a href="http://twitter.com/search?q=%23TSQL2sDay">#TSQL2sDay</a> and when your post goes live, tweet a link to it with that tag.</p>
<h4><span style="color: #000080;">Want To Host?</span></h4>
<p>All you have to do is participate in at least two events and let Adam Machanic know. You can tweet him or leave a comment on his blog, all described in his first <a href="http://sqlblog.com/blogs/adam_machanic/archive/2009/11/30/invitation-to-participate-in-t-sql-tuesday-001-date-time-tricks.aspx">T-SQL Tuesday Invitation</a>.</p>
<p>If you need any more clarification, leave a comment. I will respond in the comments or update this post if necessary. Have fun thinking of a topic and I look forward to reading the posts!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/04/t-sql-tuesday-005-reporting/feed/</wfw:commentRss>
		<slash:comments>59</slash:comments>
		</item>
		<item>
		<title>Coding for the Weekend</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/03/coding-for-the-weekend/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/03/coding-for-the-weekend/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 15:53:29 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/03/coding-for-the-weekend/</guid>
		<description><![CDATA[I’ve mentioned that my company is doing a data center move in the near future and I’ve been building out some PowerShell scripts to get ready for that.  Before we get there though we are having to rebuild one of our test environments from the ground up.  When I told my coworker Shyam of my approach he slightly disagreed and said he thought he had a better way.  So today Shyam and I are holding a little contest, We’re each going to put together some code to detach all of the databases on one server, copy them to a new server, and then attach them all.  Shyam is using an approach where he uses a lot of SMO calls, I am using an approach where I do a bunch of SQL queries.  I’ll keep all of you posted on who wins, why, and give you the code once we’re done (minus any edits for security but it will be working code).  It’s really great to have a coworker like Shyam to hold a friendly little competition like this with.  I can’t wait to see how he ends up solving a couple of the problems that we’ve already come across.  Here’s some of the P. of C. code that we’re both using to get us started; it’s basic ‘code that writes code’ but what we’re going after is ‘code that writes AND executes code’. This generates the list of databases and files including file# to use with the sp_attach_db command.  I know that in 2005+ you should use ALTER DATABASE &#8230; WITH ATTACH but we have a mix of SQL 2000 and 2005 in this project.  (which means I&#8217;m actually running this command through a linked server connection on the 2000 boxes.) SELECT CASE WHEN ROW_NUMBER() OVER(PARTITION BY db.name ORDER BY sf.filename) = 1 THEN &#8216;GO sp_attach_DB @dbname=&#8221;&#8217;+SUBSTRING(db.NAME, 1, LEN(db.NAME))+&#8221;&#8217;,&#8217; ELSE &#8216;, &#8216; END+&#8216;  @filename&#8217;+CONVERT(VARCHAR, ROW_NUMBER() OVER(PARTITION BY db.name ORDER BY sf.filename))+&#8216;=&#8221;&#8217;+SUBSTRING(sf.filename, 1, LEN(sf.filename))+&#8221;&#8221;   FROM master..sysaltfiles sf   JOIN master..sysdatabases db       ON sf.dbid = db.dbid  WHERE db.sid !=0&#215;01  ORDER BY db.name, sf.filename   This just generates the copy file statements in PowerShell that we will need to move the database files. SELECT &#8216; copy-item &#8220;&#8216;+SUBSTRING( saf.filename, 1, LEN(saf.filename))+&#8216;&#8221; -destination &#8220;\\DestinationServerName\Drive$\&#8217;+SUBSTRING(SUBSTRING(saf.filename, 1, LEN(saf.filename)), 4, LEN(saf.filename))+&#8216;&#8221;&#8216;  FROM master.dbo.sysaltfiles saf  JOIN master.dbo.sysdatabases db ON saf.dbid = db.dbid  WHERE db.sid !=0&#215;01 ORDER BY db.name, saf.filename    ]]></description>
			<content:encoded><![CDATA[<p>I’ve mentioned that my company is doing a data center move in the near future and I’ve been building out some PowerShell scripts to get ready for that.  Before we get there though we are having to rebuild one of our test environments from the ground up.  When I told my coworker Shyam of my approach he slightly disagreed and said he thought he had a better way. </p>
<p>So today Shyam and I are holding a little contest, We’re each going to put together some code to detach all of the databases on one server, copy them to a new server, and then attach them all.  Shyam is using an approach where he uses a lot of SMO calls, I am using an approach where I do a bunch of SQL queries.  I’ll keep all of you posted on who wins, why, and give you the code once we’re done (minus any edits for security but it will be working code). </p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/03/DataCenter.gif"><img style="display: inline; border: 0px;" title="Data Center" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/03/DataCenter_thumb.gif" border="0" alt="Data Center" width="221" height="167" /></a></p>
<p>It’s really great to have a coworker like Shyam to hold a friendly little competition like this with.  I can’t wait to see how he ends up solving a couple of the problems that we’ve already come across.  Here’s some of the P. of C. code that we’re both using to get us started; it’s basic ‘code that writes code’ but what we’re going after is ‘code that writes AND executes code’.</p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; mso-no-proof: yes;"><span style="color: #008000;">This generates the list of databases and files including file# to use with the sp_attach_db command.  I know that in 2005+ you should use ALTER DATABASE &#8230; WITH ATTACH but we have a mix of SQL 2000 and 2005 in this project.  (which means I&#8217;m actually running this command through a linked server connection on the 2000 boxes.)</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SELECT</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: blue;">CASE</span> <span style="color: blue;">WHEN</span> <span style="color: fuchsia;">ROW_NUMBER</span><span style="color: gray;">()</span> <span style="color: blue;">OVER</span><span style="color: gray;">(</span><span style="color: blue;">PARTITION</span> <span style="color: blue;">BY</span> db<span style="color: gray;">.</span>name <span style="color: blue;">ORDER</span> <span style="color: blue;">BY</span> sf<span style="color: gray;">.</span><span style="color: blue;">filename</span><span style="color: gray;">)</span> <span style="color: gray;">=</span> 1 <span style="color: blue;">THEN</span> <span style="color: red;">&#8216;GO<br />
</span></span><span style="font-family: &amp;amp;amp; color: red; font-size: 10pt; mso-no-proof: yes;">sp_attach_DB @dbname=&#8221;&#8217;</span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">+</span><span style="font-family: &amp;amp;amp; color: fuchsia; font-size: 10pt; mso-no-proof: yes;">SUBSTRING</span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">(</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">db<span style="color: gray;">.</span>NAME<span style="color: gray;">,</span> 1<span style="color: gray;">,</span> <span style="color: fuchsia;">LEN</span><span style="color: gray;">(</span>db<span style="color: gray;">.</span>NAME<span style="color: gray;">))+</span><span style="color: red;">&#8221;&#8217;,&#8217;</span> <span style="color: blue;">ELSE</span> <span style="color: red;">&#8216;, &#8216;</span> <span style="color: blue;">END</span><span style="color: gray;">+</span><span style="color: red;">&#8216;<br />
</span></span><span style="font-family: &amp;amp;amp; color: red; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>@filename&#8217;</span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">+</span><span style="font-family: &amp;amp;amp; color: fuchsia; font-size: 10pt; mso-no-proof: yes;">CONVERT</span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">(</span><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">VARCHAR</span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">,</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: fuchsia;">ROW_NUMBER</span><span style="color: gray;">()</span> <span style="color: blue;">OVER</span><span style="color: gray;">(</span><span style="color: blue;">PARTITION</span> <span style="color: blue;">BY</span> db<span style="color: gray;">.</span>name <span style="color: blue;">ORDER</span> <span style="color: blue;">BY</span> sf<span style="color: gray;">.</span><span style="color: blue;">filename</span><span style="color: gray;">))+</span><span style="color: red;">&#8216;=&#8221;&#8217;</span><span style="color: gray;">+</span><span style="color: fuchsia;">SUBSTRING</span><span style="color: gray;">(</span>sf<span style="color: gray;">.</span><span style="color: blue;">filename</span><span style="color: gray;">,</span> 1<span style="color: gray;">,</span> <span style="color: fuchsia;">LEN</span><span style="color: gray;">(</span>sf<span style="color: gray;">.</span><span style="color: blue;">filename</span><span style="color: gray;">))+</span><span style="color: red;">&#8221;&#8221;<br />
</span></span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">  </span><span style="color: blue;">FROM</span> <span style="color: blue;">master</span><span style="color: gray;">..</span><span style="color: green;">sysaltfiles</span> sf<br />
</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;">  </span><span style="color: gray;">JOIN</span> <span style="color: blue;">master</span><span style="color: gray;">..</span><span style="color: green;">sysdatabases</span> db<br />
</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-tab-count: 1;">      </span><span style="color: blue;">ON</span> sf<span style="color: gray;">.</span><span style="color: blue;">dbid</span> <span style="color: gray;">=</span> db<span style="color: gray;">.</span><span style="color: blue;">dbid<br />
</span></span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">WHERE</span> db<span style="color: gray;">.</span><span style="color: blue;">sid</span> <span style="color: gray;">!=</span>0&#215;01<br />
</span><span style="line-height: 115%; font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">ORDER</span> <span style="color: blue;">BY</span> db<span style="color: gray;">.</span>name<span style="color: gray;">,</span> sf<span style="color: gray;">.</span><span style="color: blue;">filename</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; mso-no-proof: yes;"><span style="color: #008000;"> </span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; mso-no-proof: yes;"><span style="color: #008000;">This just generates the copy file statements in PowerShell that we will need to move the database files.</span></span></p>
<p class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; color: blue; font-size: 10pt; mso-no-proof: yes;">SELECT</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> <span style="color: red;">&#8216;<br />
</span></span><span style="font-family: &amp;amp;amp; color: red; font-size: 10pt; mso-no-proof: yes;">copy-item &#8220;&#8216;</span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">+</span><span style="font-family: &amp;amp;amp; color: fuchsia; font-size: 10pt; mso-no-proof: yes;">SUBSTRING</span><span style="font-family: &amp;amp;amp; color: gray; font-size: 10pt; mso-no-proof: yes;">(<br />
</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;">saf<span style="color: gray;">.</span><span style="color: blue;">filename</span><span style="color: gray;">,</span> 1<span style="color: gray;">,</span> <span style="color: fuchsia;">LEN</span><span style="color: gray;">(</span>saf<span style="color: gray;">.</span><span style="color: blue;">filename</span><span style="color: gray;">))+</span><span style="color: red;">&#8216;&#8221; -destination &#8220;\\DestinationServerName\Drive$\&#8217;</span><span style="color: gray;">+</span><span style="color: fuchsia;">SUBSTRING</span><span style="color: gray;">(</span><span style="color: fuchsia;">SUBSTRING</span><span style="color: gray;">(</span>saf<span style="color: gray;">.</span><span style="color: blue;">filename</span><span style="color: gray;">,</span> 1<span style="color: gray;">,</span> <span style="color: fuchsia;">LEN</span><span style="color: gray;">(</span>saf<span style="color: gray;">.</span><span style="color: blue;">filename</span><span style="color: gray;">)),</span> 4<span style="color: gray;">,</span> <span style="color: fuchsia;">LEN</span><span style="color: gray;">(</span>saf<span style="color: gray;">.</span><span style="color: blue;">filename</span><span style="color: gray;">))+</span><span style="color: red;">&#8216;&#8221;&#8216;<br />
</span></span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">FROM</span> <span style="color: blue;">master</span><span style="color: gray;">.</span>dbo<span style="color: gray;">.</span><span style="color: green;">sysaltfiles</span> saf<br />
</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: gray;">JOIN</span> <span style="color: blue;">master</span><span style="color: gray;">.</span>dbo<span style="color: gray;">.</span><span style="color: green;">sysdatabases</span> db<br />
</span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="color: blue;">ON</span> saf<span style="color: gray;">.</span><span style="color: blue;">dbid</span> <span style="color: gray;">=</span> db<span style="color: gray;">.</span><span style="color: blue;">dbid<br />
 WHERE db.sid !<span style="color: #000000;">=0&#215;01</span><br />
</span></span><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"><span style="color: blue;">ORDER</span> <span style="color: blue;">BY</span> db<span style="color: gray;">.</span>name<span style="color: gray;">,</span> saf<span style="color: gray;">.</span><span style="color: blue;">filename </span></span></p>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; mso-layout-grid-align: none;"><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> </span></div>
<p><span style="font-family: &amp;amp;amp; font-size: 10pt; mso-no-proof: yes;"> </span></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/03/coding-for-the-weekend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Saturday #33 PowerShell Slide Deck</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/03/sql-saturday-33-powershell-slide-deck/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/03/sql-saturday-33-powershell-slide-deck/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 13:50:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[SQL Saturday]]></category>
		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/03/sql-saturday-33-powershell-slide-deck/</guid>
		<description><![CDATA[I’ve posted a copy of my slide deck that I used for my PowerShell sessions at SQL Saturday #33 in Charlotte.&#160; Anyone is welcome to use all or part of it if they would like to do they’re own PowerShell session.&#160; I’d love to hear any suggestions for improving it.&#160; I’m working on getting all of the scripts I used together so that I can post them up on the Scripting Guys repository. I’m still not satisfied with the Virtualization slide deck so I’m going to continue to tweak that one and hopefully post that after SQL Saturday #29 in Birmingham.]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/03/PoSh.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="PoSh" border="0" alt="PoSh" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/03/PoSh_thumb.png" width="132" height="105" /></a> </p>
<p>I’ve posted a copy of my <a href="http://bit.ly/adApuC">slide deck</a> that I used for my PowerShell sessions at SQL Saturday #33 in Charlotte.&#160; Anyone is welcome to use all or part of it if they would like to do they’re own PowerShell session.&#160; I’d love to hear any suggestions for improving it.&#160; I’m working on getting all of the scripts I used together so that I can post them up on the Scripting Guys repository.</p>
<p>I’m still not satisfied with the Virtualization slide deck so I’m going to continue to tweak that one and hopefully post that after <a href="http://bit.ly/aa6mMp">SQL Saturday #29 in Birmingham</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/03/sql-saturday-33-powershell-slide-deck/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MacGyver Meets TSQL2sDay</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/03/macgyver-meets-tsql2sday/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/03/macgyver-meets-tsql2sday/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 23:42:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SAN]]></category>
		<category><![CDATA[SSAS 2008]]></category>
		<category><![CDATA[T-SQL Tuesday]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=708</guid>
		<description><![CDATA[Please be aware that I haven’t had a chance to double-check the technical details of this post before the deadline so if you see an error please feel free to comment about it.  The events happened years ago but it&#8217;s funny how history has a way of repeating itself. Because I have too few hours in each day and I still suck at this blogging thing I am combining my MacGyver Moment and TSQL2sDay posts into this one so here we go. The Beginning:  Once upon a time in a conference room on a very high floor sat over a dozen technical people trying to quickly fix a server that had begun crashing the day before.  This company was pretty big.  Their data, it was massive.  We only worked with summary rows because of this and yet it was still in numbers that make you stop and shake your head every once in a while.  For instance, one time the daily import process failed just a few percent in and it already had over 400,000 rows cleansed and loaded.  To set the scene a little: We had developers, data folks, server experts, network experts, a SAN expert, the SAN expert’s boss, application SMEs, business liaisons, directors, and the company’s TAM from Microsoft.  Oh and another SAN expert who also doubled as a Microsoft SQL Server MVP who just happened to specialize in High Availability (specifically clustering).  This conference room had been turned into a War Room and was going to stay that way for as long as it took until the problem was fixed.  The Problem:  A problem child of an application that already had a reputation for crashing every once in a while had now started crashing every couple of hours.  I don’t know the exact specs of the hardware anymore but it was pretty close to the top of the line.  It had something like 16 LPs and 16 Gigs of RAM backed by nearly 2 dozen disks on a SAN that held over 200 disks.  This server had a twin and based on the error logs that was part of the problem.  It was in a single node failover cluster and all of a sudden it had started logging 15,000 millisecond timeout errors while trying to check on it’s disk resources.  This timeout in turn was causing whichever node was active to freak out and think that it had lost contact with the SAN altogether.  The Situation: While the overall SAN supporting this server is large by a lot of companies’ standards it was actually just a run of the mill small SAN at this place.  In fact we later ordered up another one that looked just like it (only 2 years faster in every aspect) but at the time we kept on being told how solid this particular SAN was.  There were a lot of moving parts and we were a fresh set of eyes being brought in.  One of the moving parts that we had taken note of was that another server on different disks on the same SAN had recently been rebuilt as a 64 bit server.  We took a look and said I’m sorry but your SAN just can’t support the needs of this SQL Server.  You would have thought I had just told the SAN guys that I had caught them cross-dressing or something like that.  They assured me that “No [little] Windows box” could ever take down their mighty SAN.  Regardless of that we were stuck with that particular SAN for at least the next couple of weeks and needed to come up with something to help. The Other Problem:  We asked for all the IO stats they could give us but unfortunately there was something about a new version that needed to be installed and needing to wait for an outage window and all that.  Bottom line we were stuck with some total IO numbers over a wide enough time frame that they weren’t all that useful however; being a glorified mathematician I took all the numbers I had and tried to figure out the size of the ‘unknown’ portion by subtracting out the three servers I could get stats for myself.  As it turned out in one particular time interval that was just enough information for me to notice a trend.  It wasn’t much but it was more solid than anything else being offered up (or at least I felt so) and the situation was to say the least a little tense. The Lame-Brained Idea:  One of the sever experts mentioned that he could “borrow” some RAM from a server that hadn’t gone into production yet and we could stick that in the servers (plural because they are a FC) that were crashing to see if that would fix it.  Given the error message mentioned above I just didn’t think this would work.  I had come up with something that just didn’t sound right even saying it but par for the course I said it anyways.  I asked them to humor me and stick the “borrowed RAM” into a box that wasn’t crashing; that other box in the situation that had recently been rebuilt as 64 bit.  They laughed at my idea and I don’t blame them.  Unless you stepped through the situation in the the exact same order as I did this was like saying let’s just reboot and see if that fixes it (oh wait it does reboot every time it crashes ).  It&#8217;s easy to decide to stick the only spare RAM you have into a server that&#8217;s crashing; it&#8217;s a little bit tougher to make the call to bring down a completely different system and have them stick the RAM in that one.  If you&#8217;re wrong you&#8217;ve just caused a second outage for no reason.  Stupid Windows Guys:  That’s what they must have thought when they agreed to give my idea a try.  We had all noticed the crashes had been happening almost like clockwork.  Almost but no one could tie them back to anything else happening on that machine.  As we all know, almost only counts in horse shoes and hand grenades.  And occasionally, wild ass guesses.  Funny thing happened though.  We were able to guesstimate the next crash within 5 to 10 minutes at this point only it didn’t happen this time. The Hidden Pattern:  Now I’ve always enjoyed learning about the storage engine internals but I sure ain’t no Paul Randal.  I am a quick study and love a good disaster though.  What I had found was that there was cube that was being built every couple of hours on the newly minted 64 bit server and while the system did a good job of still letting you query the old cube while the new cube was being built there would inevitably come a point where something was happening that was causing the SSAS engine to flush ooh-gobs of data back down to the disk.  More data than the total size of the cubes even.  The SAN ended up getting saturated with gigs and gigs of non-stop writes (and I hear with RAID 5 that’s like a bad thing but maybe it’s just a rumor). The Takeaway:  Make sure you know what tools your SAN admin has available and more specifically find out what they can collect on a continuous basis for weeks on end, you might be surprised by the answer.  The disks your server relies on may be fine but the controller cards accessing it might be getting saturated from something else.  You may need to purchase some additional software or something.  Look for solutions in places they might not make sense unless you hold your head just right.  The error log is your friend.  And above all, just because someone says it’s not possible, don’t completely believe them until they prove it to you. Tag-You&#8217;re-it:  To keep the fun going I&#8217;m tagging Peter Schott and Matt Schultz (Matt blame Jorge) to find out what their MacGyver moments have been.  Thank you Geoff Hiten for tagging me.]]></description>
			<content:encoded><![CDATA[<p><strong><span style="color: #ff0000;"><em>Please be aware that I haven’t had a chance to double-check the technical details of this post before the deadline so if you see an error please feel free to comment about it.  The events happened years ago but it&#8217;s funny how history has a way of repeating itself.</em></span></strong></p>
<p>Because I have too few hours in each day and I still suck at this blogging thing I am combining my MacGyver Moment and <a href="http://www.straightpathsql.com/archives/2010/03/invitation-for-t-sql-tuesday-004-io/">TSQL2sDay</a> posts into this one so here we go.</p>
<p><strong>The Beginning:</strong>  Once upon a time in a conference room on a very high floor sat over a dozen technical people trying to quickly fix a server that had begun crashing the day before.  This company was pretty big.  Their data, it was massive.  We only worked with summary rows because of this and yet it was still in numbers that make you stop and shake your head every once in a while.  For instance, one time the daily import process failed just a few percent in and it already had over 400,000 rows cleansed and loaded. </p>
<p><strong>To set the scene a little:</strong> We had developers, data folks, server experts, network experts, a SAN expert, the SAN expert’s boss, application SMEs, business liaisons, directors, and the company’s TAM from Microsoft.  Oh and another SAN expert who also doubled as a Microsoft SQL Server MVP who just happened to specialize in High Availability (specifically clustering).  This conference room had been turned into a War Room and was going to stay that way for as long as it took until the problem was fixed. </p>
<p><strong>The Problem:</strong>  A problem child of an application that already had a reputation for crashing every once in a while had now started crashing every couple of hours.  I don’t know the exact specs of the hardware anymore but it was pretty close to the top of the line.  It had something like 16 LPs and 16 Gigs of RAM backed by nearly 2 dozen disks on a SAN that held over 200 disks.  This server had a twin and based on the error logs that was part of the problem.  It was in a single node failover cluster and all of a sudden it had started logging 15,000 millisecond timeout errors while trying to check on it’s disk resources.  This timeout in turn was causing whichever node was active to freak out and think that it had lost contact with the SAN altogether. </p>
<p><strong>The Situation:</strong> While the overall SAN supporting this server is large by a lot of companies’ standards it was actually just a run of the mill small SAN at this place.  In fact we later ordered up another one that looked just like it (only 2 years faster in every aspect) but at the time we kept on being told how solid this particular SAN was.  There were a lot of moving parts and we were a fresh set of eyes being brought in.  One of the moving parts that we had taken note of was that another server on different disks on the same SAN had recently been rebuilt as a 64 bit server.  We took a look and said I’m sorry but your SAN just can’t support the needs of this SQL Server.  You would have thought I had just told the SAN guys that I had caught them cross-dressing or something like that.  They assured me that “No [little] Windows box” could ever take down their mighty SAN.  Regardless of that we were stuck with that particular SAN for at least the next couple of weeks and needed to come up with something to help.</p>
<p><strong>The Other Problem:</strong>  We asked for all the IO stats they could give us but unfortunately there was something about a new version that needed to be installed and needing to wait for an outage window and all that.  Bottom line we were stuck with some total IO numbers over a wide enough time frame that they weren’t all that useful however; being a glorified mathematician I took all the numbers I had and tried to figure out the size of the ‘unknown’ portion by subtracting out the three servers I could get stats for myself.  As it turned out in one particular time interval that was just enough information for me to notice a trend.  It wasn’t much but it was more solid than anything else being offered up (or at least I felt so) and the situation was to say the least a little tense.</p>
<p><strong>The Lame-Brained Idea:</strong>  One of the sever experts mentioned that he could “borrow” some RAM from a server that hadn’t gone into production yet and we could stick that in the servers (plural because they are a FC) that were crashing to see if that would fix it.  Given the error message mentioned above I just didn’t think this would work.  I had come up with something that just didn’t sound right even saying it but par for the course I said it anyways.  I asked them to humor me and stick the “borrowed RAM” <span style="color: #000080;">into a box that <em><strong>wasn’t crashing</strong></em></span>; that other box in the situation that had recently been rebuilt as 64 bit.  They laughed at my idea and I don’t blame them.  Unless you stepped through the situation in the the exact same order as I did this was like saying let’s just reboot and see if that fixes it (oh wait it does reboot every time it crashes <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ).  <span style="color: #000080;">It&#8217;s easy to decide to stick the only spare RAM you have into a server that&#8217;s crashing; it&#8217;s a little bit tougher to make the call to bring down a completely different system and have them stick the RAM in that one.  If you&#8217;re wrong you&#8217;ve just caused a <span style="text-decoration: underline;">second</span> outage for no reason. </span></p>
<p><strong>Stupid Windows Guys:</strong>  That’s what they must have thought when they agreed to give my idea a try.  We had all noticed the crashes had been happening <em>almost</em> like clockwork.  <em>Almost</em> but no one could tie them back to anything else happening on that machine.  As we all know, <em>almost</em> only counts in horse shoes and hand grenades.  And occasionally, wild ass guesses.  Funny thing happened though.  We were able to guesstimate the next crash within 5 to 10 minutes at this point only it didn’t happen this time.</p>
<p><strong>The Hidden Pattern:</strong>  Now I’ve always enjoyed learning about the storage engine internals but I sure ain’t no Paul Randal.  I am a quick study and love a good disaster though.  What I had found was that there was cube that was being built every couple of hours on the newly minted 64 bit server and while the system did a good job of still letting you query the old cube while the new cube was being built there would inevitably come a point where something was happening that was causing the SSAS engine to flush ooh-gobs of data back down to the disk.  More data than the total size of the cubes even.  The SAN ended up getting saturated with gigs and gigs of non-stop writes (and I hear with RAID 5 that’s like a bad thing but maybe it’s just a rumor).</p>
<p><strong>The Takeaway:</strong>  Make sure you know what tools your SAN admin has available and more specifically find out <strong><span style="text-decoration: underline;">what they can collect on a continuous basis for weeks on end</span></strong>, you might be surprised by the answer.  The disks your server relies on may be fine but the controller cards accessing it might be getting saturated from something else.  You may need to purchase some additional software or something.  Look for solutions in places they might not make sense unless you hold your head just right.  The error log is your friend.  And above all, just because someone says it’s not possible, don’t completely believe them until they prove it to you.</p>
<p><strong>Tag-You&#8217;re-it:</strong>  To keep the fun going I&#8217;m tagging <a href="http://schottsql.blogspot.com/">Peter Schott</a> and <a href="http://hockeygeek.wordpress.com/">Matt Schultz</a> (Matt blame Jorge) to find out what their MacGyver moments have been.  Thank you <a href="http://weblogs.sqlteam.com/geoffh/archive/2010/02/25/MacGyver-Moments.aspx">Geoff Hiten</a> for tagging me.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/03/macgyver-meets-tsql2sday/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Get More Done with SQLPSX</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/02/get-more-done-with-sqlpsx/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/02/get-more-done-with-sqlpsx/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 09:00:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[AppDev]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Modules]]></category>
		<category><![CDATA[RTFM]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[SQLPSX]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=652</guid>
		<description><![CDATA[In my LiveMeeting session for the AppDev Virtual Chapter of PASS yesterday I talked about building on top of tools that others had already built for you to use.  A great one for any DBA to use is the SQL PowerShell Extensions known as SQLPSX.  Even if you’ve never used PowerShell before you should take a look at this.  Heck even Sys Admins in shops that don’t have a DBA should have a look at this.  I have found the commands I have worked with very easy to use; even easier than T-SQL in some cases. After you download the files and RTFM you can then you can follow along on this next part.  Oh wait, first a little warning straight from Buck Woody: Script Disclaimer, for people who need to be told this sort of thing:   Never trust any script, including those that you find here, until you understand exactly what it does and how it will act on your systems. Always check the script on a test system or Virtual Machine, not a production system. All scripts on this site are performed by a professional stunt driver on a closed course. Your mileage may vary. Void where prohibited. Offer good for a limited time only. Keep out of reach of small children. Do not operate heavy machinery while using this script. If you experience blurry vision, indigestion or diarrhea during the operation of this script, see a physician immediately. get-module -listAvailable import-module SQLServer Invoke-SqlBackup -sqlserver "WINX64ULT7\Kilimanjaro" -dbname "AdventureWorks" ` -filepath "C:\Temp\AdventureWorks_db_$(((Get-Date).ToString("yyyyMMddHHmm"))).bak" Now this little script here (above) will backup a db for you and even include the current YearMonthDayHourMinute in the file string.  This one below will backup all of the non-system databases on your instance.  If you’re like me you’re thinking this doesn’t do anything that you can’t already do today with a maintenance plan.  That’s true and maybe I should have titled this post &#8220;Get Something Done with SQLPSX&#8221; but I will build on how you can leverage this more tomorrow.  For now, why don’t you add an AND clause only backup all the databases that start with ‘A’ foreach ($dbn in invoke-sqlcmd -query "SELECT name FROM sys.databases WHERE owner_sid !=0x01" ` -database master -serverinstance WIN7\Kilimanjaro ) { $k="C:\Temp\" + $($dbn.name) + "_db_$(((Get-Date).ToString("yyyyMMddHHmm"))).bak"WIN7\Kilimanjaro" -dbname $($dbn.name) -filepath $k $dbn; Invoke-SQLBackup -sqlserver " } I’ve gone ahead and included the SQLPSX help items here.  Please see if there’s one that catches your eye and see if it might work for you. * Get-AgentAlert * Get-AgentAlertCategory * Get-AgentJob * Get-AgentJobHistory * Get-AgentJobSchedule * Get-AgentJobServer * Get-AgentJobStep * Get-AgentOperator * Get-AgentOperatorCategory * Get-AgentProxyAccount * Get-AgentSchedule * Get-AgentTargetServer * Get-AgentTargetServerGroup * Set-AgentJobHistoryFilter * Get-ReplArticle * Get-ReplEnumLogReaderAgent * Get-ReplEnumPublications * Get-ReplEnumPublications2 * Get-ReplEnumSnapshotAgent * Get-ReplEnumSubscriptions * Get-ReplEnumSubscriptions2 * Get-ReplLightPublication * Get-ReplMonitor * Get-ReplPublication * Get-ReplPublicationMonitor * Get-ReplPublisherMonitor * Get-ReplScript * Get-ReplServer * Get-ReplSubscriberSubscription * Get-ReplSubscription * Get-ReplTransPendingCommandInfo * New-ReplMergePublication * New-ReplScriptOptions * New-ReplTransPublication * Get-GroupUser * Get-ShowMbrs * New-ShowMbrs * Set-ShowMbrs * Out-SqlScript * Test-SqlScript * Add-SqlDatabase * Add-SqlDatabaseRole * Add-SqlDatabaseRoleMember * Add-SqlDataFile * Add-SqlFileGroup * Add-SqlLogFile * Add-SqlLogin * Add-SqlServerRoleMember * Add-SqlUser * Get-Sql * Get-SqlCheck * Get-SqlColumn * Get-SqlConnection * Get-SqlData * Get-SqlDatabase * Get-SqlDatabasePermission * Get-SqlDatabaseRole * Get-SqlDataFile * Get-SqlDefaultDir * Get-SqlEdition * Get-SqlErrorLog * Get-SqlForeignKey * Get-SqlIndex * Get-SqlIndexFragmentation * Get-SqlInformation_Schema.Columns * Get-SqlInformation_Schema.Routines * Get-SqlInformation_Schema.Tables * Get-SqlInformation_Schema.Views * Get-SqlLinkedServerLogin * Get-SqlLogFile * Get-SqlLogin * Get-SqlObjectPermission * Get-SqlPort * Get-SqlProcess * Get-SqlSchema * Get-SqlScripter * Get-SqlServer * Get-SqlServerPermission * Get-SqlServerRole * Get-SqlShowMbrs * Get-SqlStatistic * Get-SqlStoredProcedure * Get-SqlSynonym * Get-SqlSysDatabases * Get-SqlTable * Get-SqlTransaction * Get-SqlTrigger * Get-SqlUser * Get-SqlUserDefinedDataType * Get-SqlUserDefinedFunction * Get-SqlVersion * Get-SqlView * Invoke-SqlBackup * Invoke-SqlDatabaseCheck * Invoke-SqlIndexDefrag * Invoke-SqlIndexRebuild * Invoke-SqlRestore * New-SqlScriptingOptions * Remove-SqlDatabase * Remove-SqlDatabaseRole * Remove-SqlDatabaseRoleMember * Remove-SqlLogin * Remove-SqlServerRoleMember * Remove-SqlUser * Set-SqlData * Set-SqlDatabasePermission * Set-SqlObjectPermission * Set-SqlServerPermission * Update-SqlStatistic * Copy-ISItemFileToSQL * Copy-ISItemSQLToFile * Copy-ISItemSQLToSQL * Get-ISData * Get-ISItem * Get-ISPackage * Get-ISRunningPackage * Get-ISSqlConfigurationItem * New-ISApplication * New-ISItem * Remove-ISItem * Rename-ISItem * Set-ISConnectionString * Set-ISPackage * Test-ISPath]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://appdev.sqlpass.org/MeetingArchive/tabid/2005/Default.aspx">LiveMeeting session</a> for the AppDev Virtual Chapter of PASS yesterday I talked about building on top of tools that others had already built for you to use.  A great one for any DBA to use is the <a href="http://sqlpsx.codeplex.com/">SQL PowerShell Extensions</a> known as SQLPSX.  Even if you’ve never used PowerShell before you should take a look at this.  Heck even Sys Admins in shops that don’t have a DBA should have a look at this.  I have found the commands I have worked with very easy to use; even easier than T-SQL in some cases.</p>
<p><a href="http://sqlpsx.codeplex.com/releases/view/40773"><img style="display: inline; border-width: 0px;" title="SQLPSX" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/02/SQLPSX.png" border="0" alt="SQLPSX" width="335" height="70" /></a></p>
<p>After you <a href="http://sqlpsx.codeplex.com/releases/view/40773">download</a> the files and <a href="http://sqlpsx.codeplex.com/documentation">RTFM</a> you can then you can follow along on this next part.  Oh wait, first a little warning straight from <a href="http://blogs.msdn.com/buckwoody/archive/tags/PowerShell/default.aspx">Buck Woody</a>:</p>
<p><em><strong><span style="color: #800000;">Script Disclaimer, for people who need to be told this sort of thing: </span></strong></em><span style="color: #800000;"> </span></p>
<p><em><span style="color: #800000;">Never trust any script, including those that you find here, until you understand exactly what it does and how it will act on your systems. Always check the script on a test system or Virtual Machine, not a production system. All scripts on this site are performed by a professional stunt driver on a closed course. Your mileage may vary. Void where prohibited. Offer good for a limited time only. Keep out of reach of small children. Do not operate heavy machinery while using this script. If you experience blurry vision, indigestion or diarrhea during the operation of this script, see a physician immediately.</span> </em></p>
<p><span style="color: #0000ff;">get-module</span> <span style="color: #240084;">-listAvailable </span></p>
<p><span style="color: #240084;"><span style="color: #0000ff;">import-module</span> SQLServer</span></p>
<div id="codeSnippetWrapper">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">Invoke-SqlBackup -sqlserver <span style="color: #006080;">"WINX64ULT7\Kilimanjaro"</span> -dbname <span style="color: #006080;">"AdventureWorks"</span> `</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">-filepath <span style="color: #006080;">"C:\Temp\AdventureWorks_db_$(((Get-Date).ToString("</span>yyyyMMddHHmm<span style="color: #006080;">"))).bak"</span></pre>
<p><!--CRLF--></p>
</div>
<div id="codeSnippetWrapper">
<p>Now this little script here (above) will backup a db for you and even include the current YearMonthDayHourMinute in the file string.  This one below will backup all of the non-system databases on your instance.  If you’re like me you’re thinking this doesn’t do anything that you can’t already do today with a maintenance plan.  That’s true and maybe I should have titled this post &#8220;Get <em>Something</em> Done with SQLPSX&#8221; but I will build on how you can leverage this more tomorrow.  For now, why don’t you add an AND clause only backup all the databases that start with ‘A’ <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div id="codeSnippetWrapper">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #0000ff;">foreach</span> ($dbn <span style="color: #0000ff;">in</span> invoke-sqlcmd -query <span style="color: #006080;">"SELECT name  FROM sys.databases WHERE owner_sid !=0x01"</span> `</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">-database master -serverinstance WIN7\Kilimanjaro )</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">{</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">$k=<span style="color: #006080;">"C:\Temp\" + $($dbn.name) + "</span>_db_$(((Get-Date).ToString(<span style="color: #006080;">"yyyyMMddHHmm"</span>))).bak<span style="color: #006080;">"</span>WIN7\Kilimanjaro" -dbname $($dbn.name)  -filepath $k</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">$dbn; Invoke-SQLBackup -sqlserver "</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">}</pre>
<p><!--CRLF--></p>
</div>
</div>
<div id="codeSnippetWrapper">
<p>I’ve gone ahead and included the SQLPSX help items here.  Please see if there’s one that catches your eye and see if it might work for you.</p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentAlert.htm">* Get-AgentAlert</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentAlertCategory.htm">* Get-AgentAlertCategory</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentJob.htm">* Get-AgentJob</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentJobHistory.htm">* Get-AgentJobHistory</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentJobSchedule.htm">* Get-AgentJobSchedule</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentJobServer.htm">* Get-AgentJobServer</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentJobStep.htm">* Get-AgentJobStep</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentOperator.htm">* Get-AgentOperator</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentOperatorCategory.htm">* Get-AgentOperatorCategory</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentProxyAccount.htm">* Get-AgentProxyAccount</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentSchedule.htm">* Get-AgentSchedule</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentTargetServer.htm">* Get-AgentTargetServer</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-AgentTargetServerGroup.htm">* Get-AgentTargetServerGroup</a></p>
<p><a href="http://sqlpsx.appspot.com/Set-AgentJobHistoryFilter.htm">* Set-AgentJobHistoryFilter</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplArticle.htm">* Get-ReplArticle</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplEnumLogReaderAgent.htm">* Get-ReplEnumLogReaderAgent</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplEnumPublications.htm">* Get-ReplEnumPublications</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplEnumPublications2.htm">* Get-ReplEnumPublications2</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplEnumSnapshotAgent.htm">* Get-ReplEnumSnapshotAgent</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplEnumSubscriptions.htm">* Get-ReplEnumSubscriptions</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplEnumSubscriptions2.htm">* Get-ReplEnumSubscriptions2</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplLightPublication.htm">* Get-ReplLightPublication</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplMonitor.htm">* Get-ReplMonitor</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplPublication.htm">* Get-ReplPublication</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplPublicationMonitor.htm">* Get-ReplPublicationMonitor</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplPublisherMonitor.htm">* Get-ReplPublisherMonitor</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplScript.htm">* Get-ReplScript</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplServer.htm">* Get-ReplServer</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplSubscriberSubscription.htm">* Get-ReplSubscriberSubscription</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplSubscription.htm">* Get-ReplSubscription</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ReplTransPendingCommandInfo.htm">* Get-ReplTransPendingCommandInfo</a></p>
<p><a href="http://sqlpsx.appspot.com/New-ReplMergePublication.htm">* New-ReplMergePublication</a></p>
<p><a href="http://sqlpsx.appspot.com/New-ReplScriptOptions.htm">* New-ReplScriptOptions</a></p>
<p><a href="http://sqlpsx.appspot.com/New-ReplTransPublication.htm">* New-ReplTransPublication</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-GroupUser.htm">* Get-GroupUser</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ShowMbrs.htm">* Get-ShowMbrs</a></p>
<p><a href="http://sqlpsx.appspot.com/New-ShowMbrs.htm">* New-ShowMbrs</a></p>
<p><a href="http://sqlpsx.appspot.com/Set-ShowMbrs.htm">* Set-ShowMbrs</a></p>
<p><a href="http://sqlpsx.appspot.com/Out-SqlScript.htm">* Out-SqlScript</a></p>
<p><a href="http://sqlpsx.appspot.com/Test-SqlScript.htm">* Test-SqlScript</a></p>
<p><a href="http://sqlpsx.appspot.com/Add-SqlDatabase.htm">* Add-SqlDatabase</a></p>
<p><a href="http://sqlpsx.appspot.com/Add-SqlDatabaseRole.htm">* Add-SqlDatabaseRole</a></p>
<p><a href="http://sqlpsx.appspot.com/Add-SqlDatabaseRoleMember.htm">* Add-SqlDatabaseRoleMember</a></p>
<p><a href="http://sqlpsx.appspot.com/Add-SqlDataFile.htm">* Add-SqlDataFile</a></p>
<p><a href="http://sqlpsx.appspot.com/Add-SqlFileGroup.htm">* Add-SqlFileGroup</a></p>
<p><a href="http://sqlpsx.appspot.com/Add-SqlLogFile.htm">* Add-SqlLogFile</a></p>
<p><a href="http://sqlpsx.appspot.com/Add-SqlLogin.htm">* Add-SqlLogin</a></p>
<p><a href="http://sqlpsx.appspot.com/Add-SqlServerRoleMember.htm">* Add-SqlServerRoleMember</a></p>
<p><a href="http://sqlpsx.appspot.com/Add-SqlUser.htm">* Add-SqlUser</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-Sql.htm">* Get-Sql</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlCheck.htm">* Get-SqlCheck</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlColumn.htm">* Get-SqlColumn</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlConnection.htm">* Get-SqlConnection</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlData.htm">* Get-SqlData</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlDatabase.htm">* Get-SqlDatabase</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlDatabasePermission.htm">* Get-SqlDatabasePermission</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlDatabaseRole.htm">* Get-SqlDatabaseRole</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlDataFile.htm">* Get-SqlDataFile</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlDefaultDir.htm">* Get-SqlDefaultDir</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlEdition.htm">* Get-SqlEdition</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlErrorLog.htm">* Get-SqlErrorLog</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlForeignKey.htm">* Get-SqlForeignKey</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlIndex.htm">* Get-SqlIndex</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlIndexFragmentation.htm">* Get-SqlIndexFragmentation</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlInformation_Schema.Columns.htm">* Get-SqlInformation_Schema.Columns</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlInformation_Schema.Routines.htm">* Get-SqlInformation_Schema.Routines</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlInformation_Schema.Tables.htm">* Get-SqlInformation_Schema.Tables</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlInformation_Schema.Views.htm">* Get-SqlInformation_Schema.Views</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlLinkedServerLogin.htm">* Get-SqlLinkedServerLogin</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlLogFile.htm">* Get-SqlLogFile</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlLogin.htm">* Get-SqlLogin</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlObjectPermission.htm">* Get-SqlObjectPermission</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlPort.htm">* Get-SqlPort</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlProcess.htm">* Get-SqlProcess</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlSchema.htm">* Get-SqlSchema</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlScripter.htm">* Get-SqlScripter</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlServer.htm">* Get-SqlServer</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlServerPermission.htm">* Get-SqlServerPermission</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlServerRole.htm">* Get-SqlServerRole</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlShowMbrs.htm">* Get-SqlShowMbrs</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlStatistic.htm">* Get-SqlStatistic</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlStoredProcedure.htm">* Get-SqlStoredProcedure</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlSynonym.htm">* Get-SqlSynonym</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlSysDatabases.htm">* Get-SqlSysDatabases</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlTable.htm">* Get-SqlTable</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlTransaction.htm">* Get-SqlTransaction</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlTrigger.htm">* Get-SqlTrigger</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlUser.htm">* Get-SqlUser</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlUserDefinedDataType.htm">* Get-SqlUserDefinedDataType</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlUserDefinedFunction.htm">* Get-SqlUserDefinedFunction</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlVersion.htm">* Get-SqlVersion</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-SqlView.htm">* Get-SqlView</a></p>
<p><a href="http://sqlpsx.appspot.com/Invoke-SqlBackup.htm">* Invoke-SqlBackup</a></p>
<p><a href="http://sqlpsx.appspot.com/Invoke-SqlDatabaseCheck.htm">* Invoke-SqlDatabaseCheck</a></p>
<p><a href="http://sqlpsx.appspot.com/Invoke-SqlIndexDefrag.htm">* Invoke-SqlIndexDefrag</a></p>
<p><a href="http://sqlpsx.appspot.com/Invoke-SqlIndexRebuild.htm">* Invoke-SqlIndexRebuild</a></p>
<p><a href="http://sqlpsx.appspot.com/Invoke-SqlRestore.htm">* Invoke-SqlRestore</a></p>
<p><a href="http://sqlpsx.appspot.com/New-SqlScriptingOptions.htm">* New-SqlScriptingOptions</a></p>
<p><a href="http://sqlpsx.appspot.com/Remove-SqlDatabase.htm">* Remove-SqlDatabase</a></p>
<p><a href="http://sqlpsx.appspot.com/Remove-SqlDatabaseRole.htm">* Remove-SqlDatabaseRole</a></p>
<p><a href="http://sqlpsx.appspot.com/Remove-SqlDatabaseRoleMember.htm">* Remove-SqlDatabaseRoleMember</a></p>
<p><a href="http://sqlpsx.appspot.com/Remove-SqlLogin.htm">* Remove-SqlLogin</a></p>
<p><a href="http://sqlpsx.appspot.com/Remove-SqlServerRoleMember.htm">* Remove-SqlServerRoleMember</a></p>
<p><a href="http://sqlpsx.appspot.com/Remove-SqlUser.htm">* Remove-SqlUser</a></p>
<p><a href="http://sqlpsx.appspot.com/Set-SqlData.htm">* Set-SqlData</a></p>
<p><a href="http://sqlpsx.appspot.com/Set-SqlDatabasePermission.htm">* Set-SqlDatabasePermission</a></p>
<p><a href="http://sqlpsx.appspot.com/Set-SqlObjectPermission.htm">* Set-SqlObjectPermission</a></p>
<p><a href="http://sqlpsx.appspot.com/Set-SqlServerPermission.htm">* Set-SqlServerPermission</a></p>
<p><a href="http://sqlpsx.appspot.com/Update-SqlStatistic.htm">* Update-SqlStatistic</a></p>
<p><a href="http://sqlpsx.appspot.com/Copy-ISItemFileToSQL.htm">* Copy-ISItemFileToSQL</a></p>
<p><a href="http://sqlpsx.appspot.com/Copy-ISItemSQLToFile.htm">* Copy-ISItemSQLToFile</a></p>
<p><a href="http://sqlpsx.appspot.com/Copy-ISItemSQLToSQL.htm">* Copy-ISItemSQLToSQL</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ISData.htm">* Get-ISData</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ISItem.htm">* Get-ISItem</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ISPackage.htm">* Get-ISPackage</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ISRunningPackage.htm">* Get-ISRunningPackage</a></p>
<p><a href="http://sqlpsx.appspot.com/Get-ISSqlConfigurationItem.htm">* Get-ISSqlConfigurationItem</a></p>
<p><a href="http://sqlpsx.appspot.com/New-ISApplication.htm">* New-ISApplication</a></p>
<p><a href="http://sqlpsx.appspot.com/New-ISItem.htm">* New-ISItem</a></p>
<p><a href="http://sqlpsx.appspot.com/Remove-ISItem.htm">* Remove-ISItem</a></p>
<p><a href="http://sqlpsx.appspot.com/Rename-ISItem.htm">* Rename-ISItem</a></p>
<p><a href="http://sqlpsx.appspot.com/Set-ISConnectionString.htm">* Set-ISConnectionString</a></p>
<p><a href="http://sqlpsx.appspot.com/Set-ISPackage.htm">* Set-ISPackage</a></p>
<p><a href="http://sqlpsx.appspot.com/Test-ISPath.htm">* Test-ISPath</a></p>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/02/get-more-done-with-sqlpsx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Big Were Last Nights Backups?</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/02/how-big-were-last-nights-backups/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/02/how-big-were-last-nights-backups/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 12:25:29 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Backups]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=618</guid>
		<description><![CDATA[Last week one of the Sys Admin’s asked me “How big were last night’s backups?”  I was like “Why are you asking me?  We drop all of the backup files onto one of your arrays so why don’t you tell me.” Background:  We’re doing a Data Center move and they wanted to move a copy of all of the dbs over to the new DC to test the applications.  In some shops this might be easy because they just delete backups more than a day old.  For us, we are blessed with enough room to keep several days worth of backups for some of our critical systems.  This is further complicated by the fact that we have over 100 databases to move and they have different retention policies based on importance.  I know that the databases take up 1.8 TB thanks to another PowerShell script I wrote but since we use backup compression our data is about a fifth of that size.  But what is the exact number?!  I’m glad you asked. I threw together a script I had used previously and modified it so that would recurse down the directory structure of our db archive server and pickup on .bak files that were made in the last day.  Now, because nothing is simple where I work, there is a software product – which will remain nameless for now – that also backs up transaction log files with the .bak extension; but luckily also throw in _TLOG_ so I was able to filter them out pretty easily. 1: $c=0 2: $l=0 3: foreach ($f in dir -include *.bak -exclude *TLOG* -recurse &#124; 4: where{ $_.LastWriteTime -gt [datetime]::Now.AddDays(-1) } ) 5: {$c += 1; $l += $f.length} 6: "Total File Count: $c and total size of .bak files in Bytes: $l" 7: &#62;&#62; c:\Temp\MyBackupFileSizes.txt Now I was already in a directory where I wanted to get all the files in all of the sub-directories when I ran this so don’t forget to do that or this could run for a long time.  For you that might look like this (but probably won’t): C:\Program Files\Microsoft SQL Server\MSSQL10_50\MSSQL\Backup.  I went and checked a bunch of these file sizes manually and they came out exactly correct If you&#8217;re new to PowerShell I hope you give this a try and come up with a way that it could be useful to you.]]></description>
			<content:encoded><![CDATA[<p>Last week one of the Sys Admin’s asked me “How big were last night’s backups?”  I was like “Why are you asking me?  We drop all of the backup files onto one of your arrays so why don’t you tell me.”</p>
<p><strong>Background: </strong> We’re doing a Data Center move and they wanted to move a copy of all of the dbs over to the new DC to test the applications.  In some shops this might be easy because they just delete backups more than a day old.  For us, we are blessed with enough room to keep several days worth of backups for some of our critical systems.  This is further complicated by the fact that we have over 100 databases to move and they have different retention policies based on importance. </p>
<p>I know that the databases take up 1.8 TB thanks to another PowerShell script I wrote but since we use backup compression our data is about a fifth of that size.  But what is the exact number?!  I’m glad you asked.</p>
<p>I threw together a script I had <a href="http://bit.ly/dcbDXC">used previously</a> and modified it so that would recurse down the directory structure of our db archive server and pickup on .bak files that were made in the last day.  Now, because nothing is simple where I work, there is a software product – which will remain nameless for now – that also backs up transaction log files with the .bak extension; but luckily also throw in _TLOG_ so I was able to filter them out pretty easily.</p>
<div id="codeSnippetWrapper">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum1" style="color: #606060;">   1:</span> <span style="color: #ff0000;">$c</span>=0</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum2" style="color: #606060;">   2:</span> <span style="color: #ff0000;">$l</span>=0</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum3" style="color: #606060;">   3:</span> <span style="color: #0000ff;">foreach</span> (<span style="color: #ff0000;">$f</span> <span style="color: #0000ff;">in</span> dir -include <span style="color: #993366;">*.bak</span> -exclude <span style="color: #993366;">*TLOG*</span> -recurse |</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum4" style="color: #606060;">   4:</span> where{ <span style="color: #ff0000;">$_</span>.LastWriteTime <span style="color: #cc6633;">-gt</span> <span style="color: #008080;">[datetime]</span>::Now.AddDays(-1) } )</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum5" style="color: #606060;">   5:</span> {<span style="color: #ff0000;">$c</span> += 1; <span style="color: #ff0000;">$l</span> += <span style="color: #ff0000;">$f</span>.length}</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum6" style="color: #606060;">   6:</span> <span style="color: #006080;">"Total File Count: $c and total size of .bak files in Bytes: $l"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum7" style="color: #606060;">   7:</span> &gt;&gt; <span style="color: #993366;">c:\Temp\MyBackupFileSizes.tx</span>t</pre>
<p><!--CRLF--></p>
</div>
<p>Now I was already in a directory where I wanted to get all the files in all of the sub-directories when I ran this so don’t forget to do that or this could run for a long time.  For you that might look like this (but probably won’t): C:\Program Files\Microsoft SQL Server\MSSQL10_50\MSSQL\Backup. </p>
</div>
<p>I went and checked a bunch of these file sizes manually and they came out exactly correct <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>If you&#8217;re new to PowerShell I hope you give this a try and come up with a way that it could be useful to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/02/how-big-were-last-nights-backups/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Basic SQL Querying From PowerShell</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/02/basic-querying-from-powershell/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/02/basic-querying-from-powershell/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 15:42:33 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Invoke-SQLCmd]]></category>
		<category><![CDATA[PSSnapin]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[Syndicated]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=592</guid>
		<description><![CDATA[I promise to make this worth your time.  (Oops, I better make this quick.) Alright so with PowerShell if you open it up and just run this code you’ll be able to query your database right from the start.  Anyone who has worked with data systems for a while will notice right away the first line of this script kinda looks like a connection string for an application.  I’m sure the fact that PowerShell was built on .Net has something to do with that.  (But I’m not a developer so I don’t really know, it could be just a coincidence for all I know.   $conn = New-Object System.Data.SqlClient.SqlConnection(&#8220;Data Source=YourMachineName\YourInstanceName; InitialCatalog=master; Integrated Security=SSPI&#8221;) $conn.Open() $cmd1 = $conn.CreateCommand() $cmd1.CommandType = [System.Data.CommandType]::StoredProcedure $cmd1.CommandText =&#8220;sp_databases&#8221; $data = $cmd1.ExecuteReader() $dt = new-object &#8220;System.Data.DataTable&#8221; $dt.Load($data) $dt &#124; format-table #PipeLining is Awesome! $conn.Close() But this code is so much Nicer! If you’ve got SSMS 2008 installed on your machine all you need to do is fire up the ISE and add the SnapIn like I talked about in my last blog.  Then you can use invoke-sqlcmd and pass it your query.  As you see this is a lot easier and cleaner than all of the code above was. #Go ahead and add the SQL Snapins add-pssnapin SqlServerCmdletSnapin100 #sp_databases &#124; format-table invoke-sqlcmd -query &#8220;sp_databases&#8221; -database master -serverinstance WIN7\Kilimanjaro &#124; format-table Conclusion: Unless you really like writing 6 or 7 extra lines of code every time you query your database, load up the Snapin and use invoke-sqlcmd.]]></description>
			<content:encoded><![CDATA[<p>I promise to make this worth your time.  (Oops, I better make this quick.)</p>
<table border="2" cellspacing="0" cellpadding="2" width="500">
<tbody>
<tr>
<td width="496" valign="top"><span style="color: #000040;"><span style="color: #333399;">Alright so with PowerShell if you open it up and just run this code you’ll be able to query your database right from the start.  Anyone who has worked with data systems for a while will notice right away the first line of this script kinda looks like a connection string for an application.  I’m sure the fact that PowerShell was built on .Net has something to do with that.  (But I’m not a developer so I don’t really know, it could be just a coincidence for all I know.  </span></span></td>
</tr>
</tbody>
</table>
<p style="margin: 0in; font-family: calibri; font-size: 11pt;"><span style="color: red;">$conn</span> <span style="color: #7f7f7f;">=</span> <span style="color: #1802be;">New-Object</span> <span style="color: #7030a0;">System.Data.SqlClient.SqlConnection</span>(<span style="color: #c00000;">&#8220;Data Source=YourMachineName\YourInstanceName; InitialCatalog=master; Integrated Security=SSPI&#8221;</span>)<br />
<span style="color: red;">$conn</span><span style="color: #7f7f7f;">.</span>Open()<br />
<span style="color: red;">$cmd1</span> <span style="color: #7f7f7f;">=</span> <span style="color: red;">$conn</span>.CreateCommand()<br />
<span style="color: red;">$cmd1</span><span style="color: #7f7f7f;">.</span>CommandType <span style="color: #7f7f7f;">=</span> <span style="color: #00b050;">[System.Data.CommandType]</span><span style="color: #7f7f7f;">::</span>StoredProcedure<br />
<span style="color: red;">$cmd1</span><span style="color: #7f7f7f;">.</span>CommandText <span style="color: #7f7f7f;">=</span><span style="color: #c00000;">&#8220;sp_databases&#8221;<br />
</span><span style="color: red;">$data</span> <span style="color: #7f7f7f;">=</span> <span style="color: red;">$cmd1</span><span style="color: #7f7f7f;">.</span>ExecuteReader()<br />
<span style="color: red;">$dt</span> <span style="color: #7f7f7f;">=</span> <span style="color: #1802be;">new-object</span> <span style="color: #c00000;">&#8220;System.Data.DataTable&#8221;<br />
</span><span style="color: red;">$dt</span><span style="color: #7f7f7f;">.</span>Load(<span style="color: red;">$data</span>)<br />
<span style="color: red;">$dt</span> <span style="color: #7f7f7f;">|</span> <span style="color: #1802be;">format-table</span> <span style="color: #006600;">#PipeLining is Awesome!<br />
</span><span style="color: red;">$conn</span><span style="color: #7f7f7f;">.</span>Close()</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/02/image6.png"><img style="display: inline; border-width: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/02/image_thumb4.png" border="0" alt="image" width="904" height="435" /></a></p>
<h4>But this code is so much Nicer!</h4>
<table border="2" cellspacing="0" cellpadding="2" width="500">
<tbody>
<tr>
<td width="500" valign="top"><span style="color: #000080;">If you’ve got SSMS 2008 installed on your machine all you need to do is fire up the ISE and add the SnapIn like I talked about in my </span><a href="http://sqlvariant.com/wordpress/index.php/2010/02/sqlserversqldatabasestables-dir/"><span style="color: #000080;">last blog</span></a><span style="color: #000080;">.  Then you can use invoke-sqlcmd and pass it your query.  As you see this is a lot easier and cleaner than all of the code above was.</span></td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="color: #3f672b;">#Go ahead and add the SQL Snapins<br />
</span><span style="color: #020bbe;">add-pssnapin</span><span style="color: #0070c0;"> </span><span style="color: #7030a0;">SqlServerCmdletSnapin100 </span></p>
<div><span style="color: #3f672b; mso-style-textfill-fill-color: #3f672b; mso-style-textfill-fill-alpha: 100.0%; mso-style-textfill-fill-colortransforms: lumm=50000;">#sp_databases | format-table</span><br />
<span style="color: #020bbe;">invoke-sqlcmd</span><span style="color: #0070c0;"> </span><span style="color: #002060;">-query</span> <span style="color: #c00000;">&#8220;sp_databases&#8221;</span> <span style="color: #002060;">-database</span> <span style="color: #7030a0;">master</span> <span style="color: #002060;">-serverinstance </span><span style="color: #7030a0;">WIN7\Kilimanjaro</span> | <span style="color: #020bbe;">format-table</span></div>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/02/image7.png"><img style="display: inline; border-width: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/02/image_thumb5.png" border="0" alt="image" width="902" height="573" /></a></p>
<h4>Conclusion:</h4>
<p>Unless you really like writing 6 or 7 extra lines of code every time you query your database, load up the Snapin and use <span style="color: #0000ff;">invoke-sqlcmd</span>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/02/basic-querying-from-powershell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bite Sized Blog Posts</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/02/bite-sized-blog-posts/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/02/bite-sized-blog-posts/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 20:27:29 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Podcast]]></category>
		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=614</guid>
		<description><![CDATA[For the next several weeks (about 9) I will be really busy with a data center move and doing some presentations on PowerShell.  During that time I’m sure I’ll find all kinds of cool uses for PowerShell and SQL Server and I’ll post them as quick as I can in a small bite-sized format.  This will make it quick and easy for people to read and for me it will mean much less time to get a post ready.  Sometimes when getting a blog post ready I will take as many a 8 screen shots of the same thing just trying to make sure that I got everything easy to understand, syntactically correct, and useful.   Once I’m done with all this (around May) I will come back and thread these posts together into a bigger story and show you how much time we saved from end to end.  So far I already have about 3 of the bite-sized posts that I need to write and we’ve saved at least 4 hours on tasks that previously would have required loads of manually clicking around. I hope this format helps people easily take advantage of what I’ve found useful between leveraging SQL and PowerShell. btw…  If you’re looking to learn more about PowerShell during your daily commute I HIGHLY recommend that you subscribe to the PowerScripting Podcast.  My coworker Shyam and I are catching up on back episodes and listening to it nearly every day on the way into work.  They don’t talk about SQL Server too much but what they do talk about is still very useful to us.]]></description>
			<content:encoded><![CDATA[<p>For the next several weeks (about 9) I will be really busy with a data center move and doing some presentations on PowerShell.  During that time I’m sure I’ll find all kinds of cool uses for PowerShell and SQL Server and I’ll post them as quick as I can in a small bite-sized format.  This will make it quick and easy for people to read and for me it will mean much less time to get a post ready.  Sometimes when getting a blog post ready I will take as many a 8 screen shots of the same thing just trying to make sure that I got everything easy to understand, syntactically correct, and useful.</p>
<p> <a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/02/PoSh.png"><img style="display: inline; border: 0px;" title="PoSh" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/02/PoSh_thumb.png" border="0" alt="PoSh" width="116" height="91" /></a> <a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/02/image8.png"><img style="display: inline; border: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/02/image_thumb6.png" border="0" alt="image" width="80" height="91" /></a></p>
<p>Once I’m done with all this (around May) I will come back and thread these posts together into a bigger story and show you how much time we saved from end to end.  So far I already have about 3 of the bite-sized posts that I need to write and we’ve saved at least 4 hours on tasks that previously would have required loads of manually clicking around.</p>
<p>I hope this format helps people easily take advantage of what I’ve found useful between leveraging SQL and PowerShell.</p>
<p>btw…  If you’re looking to learn more about PowerShell during your daily commute I HIGHLY recommend that you subscribe to the <a href="http://bit.ly/b7GUwQ">PowerScripting Podcast</a>.  My coworker Shyam and I are catching up on back episodes and listening to it nearly every day on the way into work.  They don’t talk about SQL Server too much but what they do talk about is still very useful to us.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/02/bite-sized-blog-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic (Requested URI is rejected)

Served from: www.sqlvariant.com @ 2012-02-04 03:50:17 -->
