<?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; PowerShell</title>
	<atom:link href="http://sqlvariant.com/wordpress/index.php/category/powershell/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>Quick Blog: Grabbing basic machine info with PowerShell</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/11/quick-blog-grabbing-basic-machine-info-with-powershell/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/11/quick-blog-grabbing-basic-machine-info-with-powershell/#comments</comments>
		<pubDate>Tue, 29 Nov 2011 14:33:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[functions]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2011/11/quick-blog-grabbing-basic-machine-info-with-powershell/</guid>
		<description><![CDATA[The other day I needed to track down how much RAM a couple of our servers had installed.  A few days later I needed to verify that a couple of them were in fact 64-bit and not 32-bit.  I decided I wanted to be able to get at this basic info any time that I wanted without having to remember all the syntax so I built it into a PowerShell function. Building a PowerShell function is almost as easy easier than building a stored procedure around a select statement in SQL.  The reason PowerShell is easier than SQL is that when you have a parameter that you are passing in, you can give it a data type, but you don’t have to. For the function below I gave it a default value of the local machine but you can pass in a machine name that you are trying to get to. Just copy the code below into an ISE window and hit F5. function Get-MachineInfo($ServerName="localhost") { get-wmiobject win32_computersystem -ComputerName $ServerName &#124; select DNSHostName, Manufacturer, Model, SystemType , @{Name="TotalPhysicalMemoryInMB";Expression={"{0:n2}" -f($_.TotalPhysicalMemory/1mb)}}, NumberOfLogicalProcessors, NumberOfProcessors, CurrentTimeZone, DaylightInEffect }# End Get-MachineInfo After you’ve done that, to call the stored proc function simply type in the name ( Get-MachineInfo ) to the prompt at the bottom and hit enter]]></description>
			<content:encoded><![CDATA[<p>The other day I needed to track down how much RAM a couple of our servers had installed.  A few days later I needed to verify that a couple of them were in fact 64-bit and not 32-bit.  I decided I wanted to be able to get at this basic info any time that I wanted without having to remember all the syntax so I built it into a PowerShell function.</p>
<p>Building a PowerShell function is <span style="text-decoration: line-through;">almost as easy</span> easier than building a stored procedure around a select statement in SQL.  The reason PowerShell is easier than SQL is that when you have a parameter that you are passing in, you <strong><em>can</em></strong> give it a data type, but you <span style="text-decoration: underline;">don’t have to</span>.</p>
<p>For the function below I gave it a default value of the local machine but you can pass in a machine name that you are trying to get to.</p>
<p>Just copy the code below into an ISE window and hit F5.</p>
<pre class='PowerShellColorizedScript'><span style='color:#00008b'>function</span> <span style='color:#8a2be2'>Get-MachineInfo</span><span style='color:#000000'>(</span><span style='color:#ff4500'>$ServerName</span><span style='color:#a9a9a9'>=</span><span style='color:#8b0000'>"localhost"</span><span style='color:#000000'>)</span>
<span style='color:#000000'>{</span>
<span style='color:#0000ff'>get-wmiobject</span> <span style='color:#8a2be2'>win32_computersystem</span> <span style='color:#000080'>-ComputerName</span> <span style='color:#ff4500'>$ServerName</span> <span style='color:#a9a9a9'>|</span>
<span style='color:#0000ff'>select</span> <span style='color:#8a2be2'>DNSHostName</span><span style='color:#a9a9a9'>,</span> <span style='color:#8a2be2'>Manufacturer</span><span style='color:#a9a9a9'>,</span> <span style='color:#8a2be2'>Model</span><span style='color:#a9a9a9'>,</span> <span style='color:#8a2be2'>SystemType</span> <span style='color:#a9a9a9'>,</span>
        <span style='color:#000000'>@{</span><span style='color:#000000'>Name</span><span style='color:#a9a9a9'>=</span><span style='color:#8b0000'>"TotalPhysicalMemoryInMB"</span><span style='color:#000000'>;</span><span style='color:#000000'>Expression</span><span style='color:#a9a9a9'>=</span><span style='color:#000000'>{</span><span style='color:#8b0000'>"{0:n2}"</span> <span style='color:#a9a9a9'>-f</span><span style='color:#000000'>(</span><span style='color:#ff4500'>$_</span><span style='color:#a9a9a9'>.</span><span style='color:#000000'>TotalPhysicalMemory</span><span style='color:#a9a9a9'>/</span><span style='color:#800080'>1mb</span><span style='color:#000000'>)</span><span style='color:#000000'>}</span><span style='color:#000000'>}</span><span style='color:#a9a9a9'>,</span>
        <span style='color:#8a2be2'>NumberOfLogicalProcessors</span><span style='color:#a9a9a9'>,</span> <span style='color:#8a2be2'>NumberOfProcessors</span><span style='color:#a9a9a9'>,</span> <span style='color:#8a2be2'>CurrentTimeZone</span><span style='color:#a9a9a9'>,</span> <span style='color:#8a2be2'>DaylightInEffect</span>
<span style='color:#000000'>}</span><span style='color:#006400'># End Get-MachineInfo</span></pre>
<p>After you’ve done that, to call the <span style="text-decoration: line-through;">stored proc</span> function simply type in the name ( <span style="color: #0000ff; font-family: Segoe UI Semibold; font-size: small;">Get-MachineInfo</span> ) to the prompt at the bottom and hit enter</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2011/11/image2.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/2011/11/image_thumb.png" alt="image" width="473" height="342" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/11/quick-blog-grabbing-basic-machine-info-with-powershell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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>PowerShell takes the Pole at SQLRally!</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/05/powershell-takes-the-pole-at-sqlrally/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/05/powershell-takes-the-pole-at-sqlrally/#comments</comments>
		<pubDate>Tue, 10 May 2011 13:26:02 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PASS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[Presentations]]></category>
		<category><![CDATA[SQLRally]]></category>
		<category><![CDATA[Syndicated]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=2234</guid>
		<description><![CDATA[PowerShell takes the Pole at SQLRally! PowerShell has taken the Pole for the DBA division at SQLRally!  Come see why the organizers have chosen this session to lead the pack to the Green Flag. We will be covering new ground, not rehashing last year’s PASS Summit presentation.  I have developed several new examples for leveraging PowerShell in your everyday DBA role since then.  I am promising 6 new scripts for everyone but if I get on a role that number might be closer to 10 when they drop the green flag on this year’s event.  If you’ve never used PowerShell before don’t worry. We will spend a few minutes on a ‘get up to speed lap’ so everyone is going at the same pace when we step on the gas with all this new material.  All scripts will be made available for you to download during the session and access later on from pit-row. After my session here’s what I’ll be checking out:  ]]></description>
			<content:encoded><![CDATA[<h1><span style="font-size: large;"><span style="color: #365f91;"><span style="font-family: Cambria;">PowerShell takes the Pole at SQLRally!</span></span></span></h1>
<p><span style="font-size: small;"><span style="font-family: Calibri;">PowerShell has taken the Pole for the DBA division at SQLRally!  Come see why the organizers have chosen this session to lead the pack to the Green Flag.</span></span></p>
<p><span style="font-family: Calibri; font-size: small;">We <strong><span style="text-decoration: underline;">will be covering new ground</span></strong>, not rehashing last year’s </span><a href="http://sqlpass.eventpoint.com/topic/details/DBA237"><span style="font-family: Calibri; color: #0000ff; font-size: small;">PASS Summit</span></a><span style="font-size: small;"><span style="font-family: Calibri;"> presentation.  I have developed several new examples for leveraging PowerShell in your everyday DBA role since then.  I am promising 6 new scripts for everyone but if I get on a role that number might be closer to 10 when they drop the green flag on this year’s event.  <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">If you’ve never used PowerShell before don’t worry. We will spend a few minutes on a ‘get up to speed lap’ so everyone is going at the same pace when we step on the gas with all this new material.  All scripts will be made available for you to download during the session and access later on from pit-row. </span></span></p>
<p><span style="font-size: small;"><span style="font-family: Calibri;">After my session here’s what I’ll be checking out:</span></span></p>
<p><span style="font-size: small;"> </span></p>
<div id="attachment_2235" class="wp-caption aligncenter" style="width: 656px"><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2011/05/My_SQLRally_Schedule.jpg"><img class="size-full wp-image-2235" title="My_SQLRally_Schedule" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/05/My_SQLRally_Schedule.jpg" alt="What sessions I'll be checking out during SQLRally" width="646" height="871" /></a><p class="wp-caption-text">What sessions I&#39;ll be checking out during SQLRally</p></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/05/powershell-takes-the-pole-at-sqlrally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Week at SQL University – Post 7</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/04/powershell-week-at-sql-university-post-7/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/04/powershell-week-at-sql-university-post-7/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 13:28:37 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL University]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=2222</guid>
		<description><![CDATA[Deploying Code Deploying SQL code with PowerShell can be very easy but why would you want to do that instead of just open a script in SQL Management Studio and run it?  The number 1 reason that I can think of is when you need to deploy to multiple destinations.  Let’s get started with something simple, we’ll deploy a table that I use in the post on collecting database sizes. Invoke-Sqlcmd -ServerInstance Win7Netbook -Database CentralInfo -InputFile C:\temp\dbo.DatabaseFileSizes.SQL That’s a pretty simple example and one that doesn’t offer too much any benefit over just opening up SSMS and running the script.   Let’s take it a little further with the loop construct and this time we’ll deploy Adam Machanic’s ( blog &#124; twitter ) sp_WhoIsActive to a bunch of machines $DeployFile = C:\temp\who_is_active_v11_00.sql &#60;# Loops through Registered SQL Severs and applys WhoIsActive #&#62; foreach ($RegisteredSQLs in dir -recurse SQLSERVER:\SQLRegistration\'Database Engine Server Group'\Development\ &#124; where {$_.Mode -ne "d"} ) { "Deploying to "+ $RegisteredSQLs.ServerName; Invoke-Sqlcmd -InputFile $DeployFile -ServerInstance $RegisteredSQLs.ServerName -database master} So now we can see how we can deploy a SQL Script to multiple machines with just 4 lines of PowerShell.  The script obviously doesn’t have to be deploying code.  It could inserting/updating data or even verifying permissions.]]></description>
			<content:encoded><![CDATA[<p>Deploying Code</p>
<p>Deploying SQL code with PowerShell can be very easy but why would you want to do that instead of just open a script in SQL Management Studio and run it?  The number 1 reason that I can think of is when you need to deploy to multiple destinations.  Let’s get started with something simple, we’ll deploy a table that I use in the post on collecting database sizes.</p>
<pre class="PowerShellColorizedScript" style="width: 539px; height: 51px;"><span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #8a2be2;">Win7Netbook</span> <span style="color: #000080;">-Database</span> <span style="color: #8a2be2;">CentralInfo</span> <span style="color: #000080;">-InputFile</span> <span style="color: #8a2be2;">C:\temp\dbo.DatabaseFileSizes.SQL</span></pre>
<p>That’s a pretty simple example and one that doesn’t offer <span style="text-decoration: line-through;">too much</span> any benefit over just opening up SSMS and running the script.   Let’s take it a little further with the loop construct and this time we’ll deploy Adam Machanic’s ( <a href="http://sqlblog.com/blogs/adam_machanic/default.aspx">blog</a> | <a href="http://twitter.com/AdamMachanic">twitter</a> ) <a href="http://sqlblog.com/blogs/adam_machanic/archive/2010/11/23/who-is-active-wins-gold-from-sql-server-magazine.aspx">sp_WhoIsActive</a> to a bunch of machines</p>
<pre class="PowerShellColorizedScript" style="width: 539px; height: 163px;"><span style="color: #ff4500;">$DeployFile</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">C:\temp\who_is_active_v11_00.sql</span>
<span style="color: #006400;">&lt;# Loops through Registered SQL Severs and applys WhoIsActive #&gt;</span>
<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: #8b0000;">"Deploying to "</span><span style="color: #a9a9a9;">+</span> <span style="color: #ff4500;">$RegisteredSQLs</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">ServerName</span><span style="color: #000000;">;</span>
<span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-InputFile</span> <span style="color: #ff4500;">$DeployFile</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: #000000;">}</span></pre>
<p>So now we can see how we can deploy a SQL Script to multiple machines with just 4 lines of PowerShell.  The script obviously doesn’t have to be deploying code.  It could inserting/updating data or even verifying permissions.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/04/powershell-week-at-sql-university-post-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Interfaces with Other Hammers</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/02/powershell-interfaces-with-other-hammers/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/02/powershell-interfaces-with-other-hammers/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 04:43:56 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Syndicated]]></category>
		<category><![CDATA[TSQL2sDay]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2011/02/powershell-interfaces-with-other-hammers/</guid>
		<description><![CDATA[This month&#8217;s installment of T-SQL Tuesday is hosted by Pat Wright (blog &#124; twitter). Pat says: &#8220;So the topic I have chosen for this month is Automation! It can be Automation with T-SQL or with PowerShell or a mix of both. Give us your best tips/tricks and ideas for making our lives easier through Automation.&#8221; I have to tell you, this doesn’t get old: I love that somebody on the other side of the planet is telling someone else that I ‘probably have a PowerShell script to solve their problem’. The funny thing is that a lot of the time I don’t have a script for the problem they’re trying to solve *yet*. I love it when someone gets referred to me and I don’t have a script because it gives me a chance to go explore the language and figure out something I don’t know. PowerShell makes this quest pretty fast. Ironically Paul White ( blog &#124; twitter ) didn’t know I had a script for that, he was just making a joke. Well, actually, I didn’t have a script for that. I did however know right where to find the person that did; and that is even better than if I had a script of my own. Why is it better that I had to point someone some where else? Could I not have figured this script out own my own? No that’s not it at all. PowerShell is NOT a hammer it’s an Automation Language. Better yet PowerShell is a Toolset, and it happens to come with some pretty freaking awesome hammers built in. We all understand that SQL Server isn’t just a hammer, that it’s an entire toolset. Inside of that toolset is: T-SQL, SQL Agent, Profiler, SSIS, the SMO, SSRS, SSAS etc… just to name a few. The cool thing about PowerShell is it’s actually built to work with other hammers. So the reason that you hear me talking about PowerShell all the time is not because I’m replacing my T-SQL Hammer, I’m just automating it! Like this, here’s a quick script to figure out how long your SQL 2008+ instances have been running: &#60;# Number of Days since the Instance has been restarted #&#62; $InstanceList = "WIN7NetBook", "WIN7NetBook\R2", "WIN7NetBook\SQLExpress" foreach($Instance in $InstanceList) { Invoke-Sqlcmd -Query "SELECT @@SERVERNAME AS 'ServerName' , DATEDIFF(D, Sqlserver_start_time, SYSDATETIME()) AS 'NumberOfDays' FROM sys.dm_os_sys_info" -ServerInstance $Instance -Database master } The automation doesn’t stop with SQL Server. You can find plenty of posts form people in our SQL Community on working with things like Red-Gate’s SQL Compare, Outlook, Active Directory, and Subversion just to name a few. The key here is that all of these people are automating something adjacent to their SQL world and they’re using PowerShell to make it happen. Heck just last week I wanted to know how many sessions had been submitted to SQL Saturday #67 in Chicago. Do you think I went to the schedule page, copied the list of sessions into Excel and then checked to see what line number the last session was on to get my count?? Heck NO!! Last year I wrote a script for Allen Kinsel ( blog &#124; twitter ) to count how many people at the PASS Summit had registered their twitter handle when the signed up. I took that script, changed the link, changed the term I was looking for and presto! I now know that 105 sessions have been submitted to SQL Saturday #67. That has nothing to do with SQL Server right?!… Except for that whole bit about it being a SQL Saturday that I was interested in. &#60;#Start up a web client and download the web page into a text file#&#62; $url="http://www.sqlsaturday.com/67/schedule.aspx" $file="c:\temp\DownloadSession$(((Get-Date).ToString("yyyyMMddHHmm"))).txt" $webclient = New-Object system.net.webclient $webclient.DownloadFile($url,$file) &#60;#Sift through the file for lines that include "viewsession" #&#62; (Select-String -path $file -Pattern "viewsession").count OK, so what’s your point? My point is that I wouldn’t have even had the twitter script that I started with if Allen Kinsel hadn’t taken a chance and sent me an email at noon the Friday before the PASS Summit and asked me if I could use PowerShell to count the number of attendees with twitter handles. Again, what’s your point? My point is Use PowerShell to make one tool talk to another. And… And tell people faced with an annoying problem that you think I’ve got a script for that because whose knows, maybe I do!]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlasylum.wordpress.com/2011/02/01/invitation-to-t-sql-tuesday-15-automation-in-sql-server/"><img alt="" style="display: inline; float: right;" src="http://sqlblog.com/files/folders/30073/download.aspx" border="0" hspace="22" width="154" height="154" align="right" /></a>This month&#8217;s installment of T-SQL Tuesday is hosted by Pat Wright (<a href="http://sqlasylum.wordpress.com/">blog</a> | <a href="http://twitter.com/SQLAsylum">twitter</a>). Pat says: &#8220;<em>So the topic I have chosen for this month is Automation! It can be Automation with T-SQL or with PowerShell or a mix of both. Give us your best tips/tricks and ideas for making our lives easier through Automation</em>.&#8221;</p>
<h3>I have to tell you, this doesn’t get old:</h3>
<p><a href="http://twitter.com/#!/SQL_Kiwi/statuses/34802898562973697"><img title="image" alt="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/02/image.png" border="0" width="403" height="225" align="right" /></a>I love that somebody on the other side of the planet is telling someone else that I ‘<em>probably have a PowerShell script to solve their problem</em>’.  The funny thing is that a lot of the time I don’t have a script for the problem they’re trying to solve *yet*.  I love it when someone gets referred to me and I don’t have a script because it gives me a chance to go explore the language and figure out something I don’t know.  PowerShell makes this quest pretty fast.</p>
<p><a href="http://twitter.com/#!/SQL_Kiwi/statuses/34803381813903360"><img title="image" alt="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/02/image1.png" border="0" width="404" height="193" align="right" /></a>Ironically Paul White ( <a href="http://sqlblog.com/blogs/paul_white/default.aspx">blog</a> | <a href="http://twitter.com/SQL_Kiwi">twitter</a> ) didn’t know I had a script for that, he was just making a joke.  Well, actually, <strong>I didn’t have a script for that</strong>. I did however know right where to find the person that did; and that is even better than if I had a script of my own.  Why is it better that I had to point someone some where else?  Could I not have figured this script out own my own?  No that’s not it at all.</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2011/02/image2.png"><img title="image" alt="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/02/image_thumb.png" border="0" width="389" height="134" align="right" /></a>PowerShell is <strong>NOT</strong> a hammer it’s an <strong>Automation Language</strong>.  Better yet PowerShell is a <span style="color: #000080;">Toolset</span>, and it happens to come with some pretty freaking awesome hammers <span style="text-decoration: underline;">built in</span>.  We all understand that <span style="color: #000080;">SQL Server</span> isn’t just a hammer, that it’s an entire toolset.  Inside of that toolset is: T-SQL, SQL Agent, Profiler, SSIS, the SMO, SSRS, SSAS etc… just to name a few.</p>
<p>The cool thing about PowerShell is it’s actually built to <span style="text-decoration: underline;">work with other hammers</span>.  So the reason that you hear me talking about PowerShell all the time is not because I’m replacing my T-SQL Hammer, I’m just automating it!  Like this, here’s a quick script to figure out how long your SQL 2008+ instances have been running:</p>
<pre class="PowerShellColorizedScript"><span style="color: #006400;">&lt;# Number of Days since the Instance has been restarted #&gt;</span>
<span style="color: #ff4500;">$InstanceList</span> <span style="color: #a9a9a9;">=</span> <span style="color: #8b0000;">"WIN7NetBook"</span><span style="color: #a9a9a9;">,</span> <span style="color: #8b0000;">"WIN7NetBook\R2"</span><span style="color: #a9a9a9;">,</span> <span style="color: #8b0000;">"WIN7NetBook\SQLExpress"</span>
<span style="color: #00008b;">foreach</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$Instance</span> <span style="color: #00008b;">in</span> <span style="color: #ff4500;">$InstanceList</span><span style="color: #000000;">)</span>
<span style="color: #000000;">{</span>
<span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">"SELECT @@SERVERNAME AS 'ServerName'
, DATEDIFF(D, Sqlserver_start_time, SYSDATETIME()) AS 'NumberOfDays'
  FROM sys.dm_os_sys_info"</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #ff4500;">$Instance</span> <span style="color: #000080;">-Database</span> <span style="color: #8a2be2;">master</span>
<span style="color: #000000;">}</span></pre>
<p>The automation doesn’t stop with SQL Server.  You can find plenty of posts form people in our SQL Community on working with things like <a href="http://www.scarydba.com/2011/01/31/powershell-to-automate-sql-compare/">Red-Gate’s SQL Compare</a>, <a href="http://adventuresinsql.com/2011/01/looking-up-email-addresses-with-powershell/">Outlook</a>, <a href="http://adventuresinsql.com/2011/01/looking-up-email-addresses-with-powershell/">Active Directory</a>, and <a href="http://www.erichumphrey.com/2010/09/upcoming-series-on-source-controlling-your-databases/">Subversion</a> just to name a few.  The key here is that all of these people are automating something adjacent to their SQL world and they’re using PowerShell to make it happen.</p>
<p>Heck just last week I wanted to know how many sessions had been submitted to <a href="http://www.sqlsaturday.com/67/eventhome.aspx">SQL Saturday #67 in Chicago</a>.  Do you think I went to the <a href="http://www.sqlsaturday.com/67/schedule.aspx">schedule page</a>, copied the list of sessions into Excel and then checked to see what line number the last session was on to get my count??  Heck NO!!  Last year I wrote a script for Allen Kinsel ( <a href="http://www.allenkinsel.com/">blog</a> | <a href="http://twitter.com/sqlinsaneo">twitter</a> ) to count how many people at the PASS Summit had registered their twitter handle when the signed up.  I took that script, changed the link, changed the term I was looking for and presto!  I now know that 105 sessions have been submitted to SQL Saturday #67.</p>
<p>That has <span style="text-decoration: underline;">nothing to do with SQL Server</span> right?!…  Except for that whole bit about it being a <strong><span style="text-decoration: underline;">SQL</span></strong> Saturday that I was interested in.</p>
<pre style="width: 641px; height: 180px;" class="PowerShellColorizedScript"><span style="color: #006400;">&lt;#Start up a web client and download the web page into a text file#&gt;</span>
<span style="color: #ff4500;">$url</span><span style="color: #a9a9a9;">=</span><span style="color: #8b0000;">"http://www.sqlsaturday.com/67/schedule.aspx"</span>
<span style="color: #ff4500;">$file</span><span style="color: #a9a9a9;">=</span><span style="color: #8b0000;">"c:\temp\DownloadSession$(((Get-Date).ToString("yyyyMMddHHmm"))).txt"</span>
<span style="color: #ff4500;">$webclient</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">New-Object</span> <span style="color: #8a2be2;">system.net.webclient</span>
<span style="color: #ff4500;">$webclient</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">DownloadFile</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$url</span><span style="color: #a9a9a9;">,</span><span style="color: #ff4500;">$file</span><span style="color: #000000;">)</span>            

<span style="color: #006400;">&lt;#Sift through the file for lines that include "viewsession" #&gt;</span>
<span style="color: #000000;">(</span><span style="color: #0000ff;">Select-String</span> <span style="color: #000080;">-path</span> <span style="color: #ff4500;">$file</span> <span style="color: #000080;">-Pattern</span> <span style="color: #8b0000;">"viewsession"</span><span style="color: #000000;">)</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">count</span></pre>
<p><strong>OK, so what’s your point?</strong></p>
<p>My point is that I wouldn’t have even had the twitter script that I started with if Allen Kinsel hadn’t taken a chance and sent me an email at noon the Friday before the PASS Summit and asked me if I could use PowerShell to count the number of attendees with twitter handles.</p>
<p><strong>Again, what’s your point?</strong></p>
<p>My point is <span style="color: #0000a0;">Use PowerShell to make one tool talk to another</span>.</p>
<p>And…</p>
<p>And tell people faced with an annoying problem that you think I’ve got a script for that because whose knows, <a href="http://blogshell.codeplex.com/">maybe I do</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/02/powershell-interfaces-with-other-hammers/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Recursive Find and Replace Your SQL Files with PowerShell</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/02/recursive-find-and-replace-your-sql-files-with-powershell/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/02/recursive-find-and-replace-your-sql-files-with-powershell/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 13:59:42 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[Find and Replace]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=2092</guid>
		<description><![CDATA[This is just a quick blog to help out with something I saw discussed on twitter yesterday. When I do my presentations I have a set of scripts that have the name of the computer and instance I am working with.  I’m not a fan of using localhost or anything like that; I also like to use instance names that let people know what version of SQL that I’m using.  When I switch computers I spend less than a minute changing all of the names.  At the PASS Summit I used a laptop that I had just purchased; here’s the script I used to rename everything. foreach ($SC in dir "$home\Documents\PoSh\" -recurse &#124; where{ Test-Path $_.fullname -pathtype leaf} ) { (Get-Content $SC) &#124; Foreach-Object { $_ -replace 'KILIMANJARO', 'R2' } &#124; Set-Content $SC } To make this work for you just change out the highlighted parts above to whatever you need.  The part that says &#8220;$home\Documents\PoSh\&#8221; will go to the PoSh folder under your “My Documents” directory (If you don’t have one, now’s a good time ).  You can also use a path like C:\SQL\Databases\AdventureQuirks\ here.  The -replace &#8216;KILIMANJARO&#8217;, &#8216;R2&#8242; portion seems pretty self explanatory; same goes for -recurse. If you just wanted to search for all the files with a certain table name, column name, stored proc name, etc… and return a report (not to modify) you can use something like this: #Make sure to navigate to the directory that you want to start looking in: ## cd c:\temp foreach ($SC in dir -recurse &#124; where{ Test-Path $_.fullname -pathtype leaf} ) { Select-String -path $SC -Pattern "WIN7NetBook" } This piece of code is setup slightly different solely to demonstrate another way you can use this functionality.  Make sure that you navigate to directory that you want to search in first for this script.  When you get the results you may end up seeing the same filename listed more that once because the “pattern” appears in the file multiple times.  To make the results show each filename just once simple add -List. One final option that I want to call out is -Filter.  If you want to search for only .SQL files in a directory (or .PS1, .txt, whatever) just add this: -Filter *.SQL So you might end up using something like this: foreach ($SC in dir C:\SQL\Databases\AdventureQuirks\ -recurse -Filter *.SQL &#124; where{ Test-Path $_.fullname -pathtype leaf} ) { Select-String -path $SC -Pattern "WIN7NetBook" } Alright I better stop here before I start showing off some other features that I just learned. Hope that helps!]]></description>
			<content:encoded><![CDATA[<p>This is just a quick blog to help out with something I saw discussed on twitter yesterday.</p>
<p>When I do my presentations I have a set of scripts that have the name of the computer and instance I am working with.  I’m not a fan of using localhost or anything like that; I also like to use instance names that let people know what version of SQL that I’m using.  When I switch computers I spend less than a minute changing all of the names.  At the <a href="http://sqlpass.eventpoint.com/topic/details/DBA237">PASS Summit</a> I used a laptop that I had just purchased; here’s the script I used to rename everything.</p>
<pre class="PowerShellColorizedScript"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$SC</span> <span style="color: #00008b;">in</span> <span style="color: #0000ff;">dir</span> <span style="color: #8b0000;"><span style="background-color: #ffff00;">"$home\Documents\PoSh\"</span></span> <span style="color: #000080;"><span style="background-color: #00ff00;">-recurse</span></span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">where</span><span style="color: #000000;">{</span> <span style="color: #0000ff;">Test-Path</span> <span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">fullname</span> <span style="color: #000080;">-pathtype</span> <span style="color: #8a2be2;">leaf</span><span style="color: #000000;">}</span> <span style="color: #000000;">)</span>
<span style="color: #000000;">{</span>
<span style="color: #000000;">(</span><span style="color: #0000ff;">Get-Content</span> <span style="color: #ff4500;">$SC</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Foreach-Object</span> <span style="color: #000000;">{</span> <span style="color: #ff4500;">$_</span> <span style="color: #a9a9a9;">-replace</span> <span style="color: #8b0000;"><span style="background-color: #ffff00;">'KILIMANJARO'</span></span><span style="color: #a9a9a9;">,</span> <span style="color: #8b0000;"><span style="background-color: #ffff00;">'R2'</span></span> <span style="color: #000000;">}</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Set-Content</span> <span style="color: #ff4500;">$SC</span>
<span style="color: #000000;">}</span></pre>
<blockquote><p>To make this work for <span style="text-decoration: underline;">you</span> just change out the highlighted parts above to whatever you need.  The part that says <span style="color: #8b0000;">&#8220;$home\Documents\PoSh\&#8221;</span> will go to the PoSh folder under your “My Documents” directory (If you don’t have one, now’s a good time <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/02/wlEmoticon-smile.png" alt="Smile" /> ).  You can also use a path like <span style="color: #0000ff;">C:\SQL\Databases\AdventureQuirks\</span> here.  The <span style="color: #a9a9a9;">-replace</span> <span style="color: #8b0000;"><span style="background-color: #ffff00;">&#8216;KILIMANJARO&#8217;</span></span><span style="color: #a9a9a9;">,</span> <span style="color: #8b0000;"><span style="background-color: #ffff00;">&#8216;R2&#8242;</span></span> portion seems pretty self explanatory; same goes for <span style="color: #000080;"><span style="background-color: #00ff00;">-recurse</span></span>.</p></blockquote>
<p>If you just wanted to search for all the files with a certain table name, column name, stored proc name, etc… and return a report (not to modify) you can use something like this:</p>
<pre class="PowerShellColorizedScript"><span style="color: #006400;">#Make sure to navigate to the directory that you want to start looking in:</span>
<span style="color: #006400;">## </span>
<span style="background-color: #ffff00;"><span style="color: #0000ff;">cd</span> <span style="color: #8a2be2;">c:\temp</span></span>            

<span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$SC</span> <span style="color: #00008b;">in</span> <span style="color: #0000ff;">dir</span> <span style="color: #000080;">-recurse</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">where</span><span style="color: #000000;">{</span> <span style="color: #0000ff;">Test-Path</span> <span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">fullname</span> <span style="color: #000080;">-pathtype</span> <span style="color: #8a2be2;">leaf</span><span style="color: #000000;">}</span> <span style="color: #000000;">)</span>
<span style="color: #000000;">{</span>
<span style="color: #0000ff;">Select-String</span> <span style="color: #000080;">-path</span> <span style="color: #ff4500;">$SC</span> <span style="color: #000080;">-Pattern</span> <span style="color: #8b0000;">"<span style="background-color: #ffff00;">WIN7NetBook</span>"</span>
<span style="color: #000000;">}</span></pre>
<pre class="PowerShellColorizedScript"></pre>
<p>This piece of code is setup slightly different solely to demonstrate another way you can use this functionality.  Make sure that you navigate to directory that you want to search in first for this script.  When you get the results you may end up seeing the same filename listed more that once because the “pattern” appears in the file multiple times.  To make the results show each filename just once simple add <span style="color: #000080;">-List</span>.</p>
<p>One final option that I want to call out is <span style="color: #000080;">-Filter</span>.  If you want to search for only .SQL files in a directory (or .PS1, .txt, whatever) just add this: <span style="color: #000080;">-Filter</span> <span style="color: #8a2be2;">*.SQL</span></p>
<p>So you might end up using something like this:</p>
<pre class="PowerShellColorizedScript"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$SC</span> <span style="color: #00008b;">in</span> <span style="color: #0000ff;">dir</span> <span style="color: #8a2be2;">C:\SQL\Databases\AdventureQuirks\</span> <span style="color: #000080;">-recurse</span> <span style="color: #000080;">-Filter</span> <span style="color: #8a2be2;">*.SQL</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">where</span><span style="color: #000000;">{</span> <span style="color: #0000ff;">Test-Path</span> <span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">fullname</span> <span style="color: #000080;">-pathtype</span> <span style="color: #8a2be2;">leaf</span><span style="color: #000000;">}</span> <span style="color: #000000;">)</span>
<span style="color: #000000;">{</span>
<span style="color: #0000ff;">Select-String</span> <span style="color: #000080;">-path</span> <span style="color: #ff4500;">$SC</span> <span style="color: #000080;">-Pattern</span> <span style="color: #8b0000;">"WIN7NetBook"</span>
<span style="color: #000000;">}</span></pre>
<p>Alright I better stop here before I start showing off some other features that I just learned.<br />
Hope that helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/02/recursive-find-and-replace-your-sql-files-with-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell Week at SQL University – Post 6</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-6/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-6/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 01:58:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[Formatting Results]]></category>
		<category><![CDATA[Multiple Instances]]></category>
		<category><![CDATA[SQL University]]></category>
		<category><![CDATA[Syndicated]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=2062</guid>
		<description><![CDATA[Yesterday we went over some loop constructs to get information out of SQL Server.  While getting the information out is great, as Data Professionals our very next concern is going to be: “ok, where do I put this so that I can refer to it later?” Today we’re going to talk about formatting and storing our results.  Our storage mechanisms are going to be a simple flat file, CSV, and the obvious one, a table.  This post is a little long but it walks you through how to overcome some of the frustrations when I started working with PowerShell over a year ago.  Enough preamble, let’s get started! Output on the screen: Start from the beginning by running this little command: Invoke-Sqlcmd -Query &#8216;SELECT * FROM sysfiles&#8217; -Database MyBigFreakinDatabase -ServerInstance Win7NetBookNow depending on how wide your PowerShell window is open to right now PowerShell will format the data to spool out in the results pain the way it thinks is best.  It may have come out ‘one row at a time’: Invoke-Sqlcmd -Query &#8216;SELECT * FROM sysfiles&#8217; -Database MyBigFreakinDatabase -ServerInstance Win7NetBook &#124; Format-ListOr it may have come out like this: Invoke-Sqlcmd -Query &#8216;SELECT * FROM sysfiles&#8217; -Database MyBigFreakinDatabase -ServerInstance Win7NetBook &#124; Format-Table” so you’ll probably want to get into the habit of putting a “ &#124; Format-Table”  after the end of you queries.  Or if you’re lazy like me:  &#124; FT. When we want to run this cmd (or whatever query you really want to run) against multiple databases we’re going to want to know what database that the data came out of.  We might write something like this foreach ($db in invoke-sqlcmd -query " SELECT name FROM sys.databases WHERE owner_sid !=0x01" -database master -serverinstance Win7NetBook ) { Invoke-Sqlcmd -Query ' SELECT * FROM sysfiles' -ServerInstance Win7NetBook -Database $db.name &#124; Format-Table } But the problem with that is We don’t know for sure which database each file came out of.  I mean if we have logical naming we can guess but that’s all it is, a guess.  What we can do is add our little “$db.name” that we&#8217;re using to pass in the name of our database. foreach ($db in invoke-sqlcmd -query " SELECT name FROM sys.databases WHERE owner_sid !=0x01" -database master -serverinstance Win7NetBook ) {$db.name; Invoke-Sqlcmd -Query ' SELECT * FROM sysfiles' -ServerInstance Win7NetBook -Database $db.name &#124; Format-Table } Object Sidebar: Probably the most important thing for SQL people to know about this language! Believer it or not we’re using object oriented code right now.  In this example we’re pumping a list of databases as objects into a variable and then iterating over that list.  If we examine our object by piping it over to Get-Member “$db &#124; Get-Member” we’ll see that it only has one property but if we had selected more columns it would have had more properties.  Typically objects have more than one property so that’s why we need to add the .name to our $db variable so that we only get the name property. Outputting to a text file: In the PowerShell language to output to a text file we can just use “&#62;” and then give it a filename.  Since we’re inside of a loop we would just keep overwriting that file until we got down to the last database and all that would be in the file would be the info from that last database.  We can also use “&#62;&#62;” which allows us to append to a file like this:  &#62;&#62; C:\temp\MyDatabaseFiles_20110120.txt Side Note: In addition to the &#8220;&#62;&#62;&#8221; we could have also used Out-File –FilePath C:\temp\MyDatabaseFiles_20110120.txt –Append with much the same results.  To make a long story short, use Out-File instead of &#62;&#62; whenever possible. foreach ($db in invoke-sqlcmd -query " SELECT name FROM sys.databases WHERE owner_sid !=0x01" -database master -serverinstance Win7NetBook ) {$db.name; Invoke-Sqlcmd -ServerInstance Win7NetBook -Database $db.name -Query ' SELECT * FROM sysfiles' &#124; Format-Table &#62;&#62; C:\temp\MyDatabaseFiles_20110120.txt } That’s not what we expected was it? There are two main problems with the output when we look at  MyDatabaseFiles_20110120.txt.  First, those database names are missing.  They’re missing because they weren’t in the pipeline in the first place.  Each time that we looped we were executing two different statements not just one; and the database name was only present in the first.  We could fix that by making the first line inside of the loop look like this $db.name &#62;&#62; C:\temp\MyDatabaseFiles_20110120.txt; but we won’t, at least not this time. The second problem is that unless we have the editor open on a really, really wide monitor the output was likely truncated with some “…” at the end.  Now if we changed the output mode Format-List we might avoid that truncation problem but as database professionals “might” rarely cuts it. Using Export-CSV to save off our results: Funny story about Export-CSV later… We’ll fire up a new variable called $MyResults and push our results into it each time that we pass through the loop (sorta~like a temp table but don’t make too strong of a connection to that).  After we complete the loop we will take the results and pass them down the pipeline to the Export-CSV cmdlet.  When we open that file we’ll see nice clean data output that we can save. foreach ($db in Invoke-Sqlcmd -query " SELECT name FROM sys.databases WHERE owner_sid !=0x01" -database master -serverinstance Win7NetBook ) {$db.name; $MyResults += Invoke-Sqlcmd -Query " SELECT DB_NAME(db_id()) AS 'DatabaseName', * FROM sysfiles" -ServerInstance Win7NetBook -Database $db.name } $MyResults &#124; Export-CSV -Path C:\temp\MyDatabaseFiles_20110120.csv -NoTypeInformation Output to a table: I’ve talked about how to save rows to a table a couple of times before.  Do you remember that Wait Stats survey that Paul Randal ( blog &#124; twitter ) did a little while ago?  Well, we have several hundred SQL instances where I work and I wanted to be able to send Paul results from a large number of those servers. The thing is I didn&#8217;t want to have to actually login to each instance, run the query, save off the results, then repeat over and over again.  So I came up with this post.  You can do the same to gather info multiple instances/databases in your environment.  It’s pretty straight-forward and very similar to the CSV example above but with a small pair of changes.  We need the two scripts that I mentioned in the other posts:  Chad Miller’s (Blog&#124;Twitter)  invoke-sqlcmd2 and Write-DataTable functions.  Once we have those loaded (and hopefully their in our profile by now ) we’re off to the races being able to write information from multiple databases back into a single database. foreach ($db in invoke-sqlcmd -query " SELECT name FROM sys.databases WHERE owner_sid !=0x01" -database master -serverinstance Win7NetBook) { $dt=invoke-sqlcmd2 -Query " SELECT DB_NAME(db_id()) AS 'DatabaseName', * FROM sysfiles" -ServerInstance Win7NetBook -Database $db.name -As 'DataTable' Write-DataTable -ServerInstance Win7NetBook -Database CentralInfo -TableName dbFileName -Data $dt } Here&#8217;s the SQL code to create that table so that you can test it out: CREATE TABLE [dbo].[dbFileName]( [DatabaseName] [nvarchar](128) NULL, [fileid] [smallint] NULL, [groupid] [smallint] NULL, [size] [int] NOT NULL, [maxsize] [int] NOT NULL, [growth] [int] NOT NULL, [status] [int] NULL, [perf] [int] NULL, [name] [sysname] NOT NULL, [filename] [nvarchar](260) NOT NULL ) ON [PRIMARY] Output to Email: Call me lazy but… I put this next script together just to see if it could be done.  Going back to that Wait Stats Survey, if you read all the way to the end you&#8217;ll see I managed to get the collection process down to 3 lines.  The only thing is that you still had to do something to the result set to exclude your instance names for security, and then after that you still had to do the whole copy-paste thing. To combat all that wasted time I came up with this script which will go ahead and enumerate the instances for you.  That way if for any reason Paul emailed you back and said &#8216;Holy Crap, how the hell did you manage to get that as your highest wait on Instnce #14?&#8217; you&#8217;d still be able to go back and figure out which server he was talking about.  Also, If you would still have the results around in case you wanted to be proactive and take a look yourself (but let&#8217;s not get too carried away). foreach ($RegisteredSQLs in dir -recurse SQLSERVER:\SQLRegistration\'Database Engine Server Group'\ &#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 } $MultipleResults = Invoke-Sqlcmd2 -ServerInstance "Win7NetBook" -Database CentralInfo -Query "SELECT DENSE_RANK() OVER (ORDER BY [InstanceName]) AS 'SQLInstance' ,[WaitType] ,[Wait_S] ,[Resource_S] ,[Signal_S] ,[WaitCount] ,[Percentage] FROM [CentralInfo].[dbo].[TopWaitTypes] ORDER BY SQLInstance, Percentage" &#124; ConvertTo-Html -Property SQLInstance, WaitType, Wait_S, Resource_S, Signal_S, WaitCount, Percentage &#124; Out-String; Send-MailMessage -To paul@SQLskills.com -Subject "Wait Stats Query Results" –From YourEmailAddress@GoesHere.com -SmtpServer smtp.SQLvariant.com -Body $MultipleResults -BodyAsHtml Finally, you know we could put that SELECT statement into a .sql file.  That would cut it back down to ~6 lines.  We might even be able to wrap the email portion into something a little smaller but considering all that this script does I think this is good enough. It’s Later When I first tried to do something like this I was was shocked to find out that there is no –Append switch for Export-CSV.  I wasn’t very happy about that, I mean I couldn’t wrap my head around [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlvariant.com/wordpress">Yesterday</a> we went over some loop constructs to get information <span style="text-decoration: underline;">out</span> of SQL Server.  While getting the information out is great, as Data Professionals our very next concern is going to be: “ok, where do I put this so that I can refer to it later?”</p>
<p>Today we’re going to talk about formatting and storing our results.  Our storage mechanisms are going to be a simple <strong>flat file</strong>, <strong>CSV</strong>, and the obvious one, a <strong>table</strong>.  This post is a little long but it walks you through how to overcome some of the frustrations when I started working with PowerShell over a year ago.  Enough preamble, let’s get started!</p>
<h3><span style="color: #004080;"><span style="font-weight: bold;">Output on the screen:</span></span></h3>
<p>Start from the beginning by running this little command:</p>
<p><span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">&#8216;SELECT * FROM sysfiles&#8217;</span> <span style="color: #000080;">-Database</span> <span style="color: #8a2be2;">MyBigFreakinDatabase</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #8a2be2;">Win7NetBook</span>Now depending on how wide your PowerShell window is open to right now PowerShell will format the data to spool out in the results pain the way it thinks is best.  It may have come out ‘one row at a time’:</p>
<p><span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">&#8216;SELECT * FROM sysfiles&#8217;</span> <span style="color: #000080;">-Database</span> <span style="color: #8a2be2;">MyBigFreakinDatabase</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #8a2be2;">Win7NetBook</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Format-List</span>Or it may have come out like this:</p>
<p><span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">&#8216;SELECT * FROM sysfiles&#8217;</span> <span style="color: #000080;">-Database</span> <span style="color: #8a2be2;">MyBigFreakinDatabase</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #8a2be2;">Win7NetBook</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Format-Table</span>” so you’ll probably want to get into the habit of putting a “<span style="color: #a9a9a9;"> |</span> <span style="color: #0000ff;">Format-Table</span>”  after the end of you queries.  Or if you’re lazy like me:  <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">FT</span>.</p>
<p>When we want to run this cmd (or whatever query you really want to run) against multiple databases we’re going to want to know what database that the data came out of.  We might write something like this</p>
<pre class="PowerShellColorizedScript" style="width: 539px; height: 209px;"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$db</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: #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: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">' SELECT * FROM sysfiles'</span>  <span style="color: #000080;">-ServerInstance</span>  <span style="color: #8a2be2;">Win7NetBook</span> <span style="color: #000080;">-Database</span> <span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Format-Table</span>
<span style="color: #000000;">}</span></pre>
<p>But the problem with that is We don’t know for sure which database each file came out of.  I mean if we have logical naming we can guess but that’s all it is, a guess.  What we can do is add our little “<span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name”</span> that we&#8217;re using to pass in the name of our database.</p>
<pre class="PowerShellColorizedScript" style="width: 539px; height: 207px;"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$db</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: #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="background-color: #ffff00;"><span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span><span style="color: #000000;">;</span></span>
<span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">' SELECT * FROM sysfiles'</span>  <span style="color: #000080;">-ServerInstance</span>  <span style="color: #8a2be2;">Win7NetBook</span> <span style="color: #000080;">-Database</span> <span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Format-Table</span>
<span style="color: #000000;">}</span></pre>
<blockquote><p><strong>Object Sidebar:</strong> Probably the most important thing for SQL people to know about this language!</p>
<p>Believer it or not we’re using object oriented code right now.  In this example we’re pumping a list of databases as objects into a variable and then iterating over that list.  If we examine our object by piping it over to Get-Member “<span style="color: #ff4500;">$db</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Get-Member</span>” we’ll see that it only has one property but if we had selected more columns it would have had more properties.  Typically objects have more than one property so that’s why we need to add the <strong>.name</strong> to our <span style="color: #ff4500;"><strong>$db</strong></span> variable so that we only get the name property.</p></blockquote>
<h3><span style="color: #004080; font-weight: bold;">Outputting to a text file:</span></h3>
<p>In the PowerShell language to output to a text file we can just use “&gt;” and then give it a filename.  Since we’re inside of a loop we would just keep overwriting that file until we got down to the last database and all that would be in the file would be the info from that last database.  We can also use “&gt;&gt;” which allows us to append to a file like this:  <span style="color: #a9a9a9;">&gt;&gt;</span> <span style="color: #8a2be2;">C:\temp\MyDatabaseFiles_20110120.txt</span></p>
<blockquote><p><strong>Side Note:</strong> In addition to the &#8220;&gt;&gt;&#8221; we could have also used <span style="color: #0000ff;">Out-File</span> –<span style="color: #000080;">FilePath <span style="color: #8a2be2;">C:\temp\MyDatabaseFiles_20110120.txt</span></span> –<span style="color: #000080;">Append </span>with much the same results.  To make a long story short, use Out-File instead of &gt;&gt; whenever possible.</p></blockquote>
<pre class="PowerShellColorizedScript" style="width: 539px; height: 207px;"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$db</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: #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: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span><span style="color: #000000;">;</span>
<span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-ServerInstance</span>  <span style="color: #8a2be2;">Win7NetBook</span> <span style="color: #000080;">-Database</span> <span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">' SELECT * FROM sysfiles'</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Format-Table</span> <span style="color: #a9a9a9;">&gt;&gt;</span> <span style="color: #8a2be2;">C:\temp\MyDatabaseFiles_20110120.txt</span>
<span style="color: #000000;">}</span></pre>
<p><strong>That’s not what we expected was it?</strong></p>
<p>There are two main problems with the output when we look at  MyDatabaseFiles_20110120.txt.  First, those <span style="text-decoration: underline;">database names are missing</span>.  They’re missing because they weren’t in the pipeline in the first place.  Each time that we looped we were executing two different statements not just one; and the database name was only present in the first.  We <em>could</em> fix that by making the first line inside of the loop look like this <span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span> <span style="color: #a9a9a9;">&gt;&gt;</span> <span style="color: #8a2be2;">C:\temp\MyDatabaseFiles_20110120.txt<span style="color: #000000;"><strong>; </strong>but we won’t, at least not this time</span></span>.</p>
<p>The second problem is that unless we have the editor open on a really, really wide monitor the output was likely truncated with some “…” at the end.  Now if we changed the output mode <span style="color: #0000ff;">Format-List</span> we might avoid that truncation problem but as database professionals “might” rarely cuts it.</p>
<h3><span style="color: #004080;"><strong>Using Export-CSV to save off our results:</strong></span></h3>
<p><strong></strong><em>Funny story about Export-CSV later…</em></p>
<p>We’ll fire up a new variable called <span style="color: #ff4500;">$MyResults</span> and push our results into it each time that we pass through the loop (sorta~like a temp table but don’t make too strong of a connection to that).  After we complete the loop we will take the results and pass them down the pipeline to the Export-CSV cmdlet.  When we open that file we’ll see nice clean data output that we can save.</p>
<pre class="PowerShellColorizedScript" style="width: 539px; height: 251px;"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$db</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: #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: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span><span style="color: #000000;">;</span>
<span style="background-color: #ffff00;"><span style="color: #ff4500;">$MyResults</span> <span style="color: #a9a9a9;">+=</span></span> <span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">" SELECT DB_NAME(db_id()) AS 'DatabaseName', * FROM sysfiles"</span>  <span style="color: #000080;">-ServerInstance</span>  <span style="color: #8a2be2;">Win7NetBook</span> <span style="color: #000080;">-Database</span> <span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span>
<span style="color: #000000;">}</span>            

<span style="background-color: #ffff00;"><span style="color: #ff4500;">$MyResults</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Export-CSV</span> <span style="color: #000080;">-Path</span> <span style="color: #8a2be2;">C:\temp\MyDatabaseFiles_20110120.csv</span> <span style="color: #000080;">-NoTypeInformation</span></span></pre>
<h3><span style="color: #004080;"><span style="font-weight: bold;">Output to a table:</span></span></h3>
<p>I’ve talked about how to save rows to a table a couple of times before.  Do you remember that <a href="http://www.sqlskills.com/BLOGS/PAUL/post/Survey-what-is-the-highest-wait-on-your-system.aspx">Wait Stats survey</a> that Paul Randal ( <a href="http://www.sqlskills.com/blogs/paul/">blog</a> | <a href="http://twitter.com/PaulRandal">twitter</a> ) did a little while ago?  Well, we have several hundred SQL instances where I work and I wanted to be able to send Paul results from a large number of those servers. The thing is I didn&#8217;t want to have to actually login to each instance, run the query, save off the results, then repeat over and over again.  So I came up with this <a href="https://mail.ex1.secureserver.net/owa/redir.aspx?C=726ddb72560545c4b9cd539d1a20de03&amp;URL=http%3a%2f%2fsqlvariant.com%2fwordpress%2findex.php%2f2010%2f11%2fget-answers-for-paul-randals-survey-fast%2f">post</a>.  You can do the same to gather info multiple instances/databases in your environment.  It’s pretty straight-forward and very similar to the CSV example above but with a small pair of changes.  We need the two scripts that I mentioned in the other posts:  Chad Miller’s (<a href="http://sev17.com/">Blog</a>|<a href="http://www.twitter.com/cmille19">Twitter</a>)  <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.  Once we have those loaded (and hopefully their in our <a href="http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-4/">profile</a> by now <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/wlEmoticon-winkingsmile1.png" alt="Winking smile" />) we’re off to the races being able to write information from multiple databases back into a single database.</p>
<pre class="PowerShellColorizedScript" style="width: 539px; height: 226px;"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$db</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: #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: #ff4500;">$dt</span><span style="color: #a9a9a9;">=</span><span style="color: #0000ff;">invoke-sqlcmd<span style="background-color: #ffff00;"><strong>2</strong></span></span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">" SELECT DB_NAME(db_id()) AS 'DatabaseName', * FROM sysfiles"</span> <span style="color: #000080;">-ServerInstance</span>  <span style="color: #8a2be2;">Win7NetBook</span> <span style="color: #000080;">-Database</span> <span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span><span style="background-color: #ffff00;"> <span style="color: #000080;">-As</span> <span style="color: #8b0000;">'DataTable'</span></span>
<span style="color: #0000ff;">Write-DataTable</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #8a2be2;">Win7NetBook</span> <span style="color: #000080;">-Database</span> <span style="color: #8a2be2;">CentralInfo</span> <span style="color: #000080;">-TableName</span> <span style="color: #8a2be2;">dbFileName</span> <span style="color: #000080;">-Data</span> <span style="color: #ff4500;">$dt</span>
<span style="color: #000000;">}</span></pre>
<p>Here&#8217;s the SQL code to create that table so that you can test it out:</p>
<p><code style="font-size: 12px;"><span style="color: blue;">CREATE TABLE </span><span style="color: black;">[dbo].[dbFileName]</span><span style="color: gray;">(<br />
</span><span style="color: black;">[DatabaseName] [nvarchar]</span><span style="color: gray;">(</span><span style="color: black;">128</span><span style="color: gray;">) NULL,<br />
</span><span style="color: black;">[fileid] [smallint] </span><span style="color: gray;">NULL,<br />
</span><span style="color: black;">[groupid] [smallint] </span><span style="color: gray;">NULL,<br />
</span><span style="color: black;">[size] [int] </span><span style="color: gray;">NOT NULL,<br />
</span><span style="color: black;">[maxsize] [int] </span><span style="color: gray;">NOT NULL,<br />
</span><span style="color: black;">[growth] [int] </span><span style="color: gray;">NOT NULL,<br />
</span><span style="color: black;">[status] [int] </span><span style="color: gray;">NULL,<br />
</span><span style="color: black;">[perf] [int] </span><span style="color: gray;">NULL,<br />
</span><span style="color: black;">[name] [sysname] </span><span style="color: gray;">NOT NULL,<br />
</span><span style="color: black;">[filename] [nvarchar]</span><span style="color: gray;">(</span><span style="color: black;">260</span><span style="color: gray;">) NOT NULL<br />
) </span><span style="color: blue;">ON </span><span style="color: black;">[PRIMARY]</span></code></p>
<h3><span style="color: #004080;"><span style="font-weight: bold;">Output to Email:</span></span></h3>
<p>Call me lazy but…</p>
<p>I put this <a href="http://sqlvariant.com/BlogSupport/Scripts/PowerShell/Send-WaitSurveyToPaulRandal.html">next script</a> together just to see if it could be done.  Going back to that Wait Stats Survey, if you read all the way to the end you&#8217;ll see I managed to get the collection process down to 3 lines.  The only thing is that you still had to do something to the result set to exclude your instance names for security, and then after that you still had to do the whole copy-paste thing.</p>
<p>To combat all that wasted time I came up with this script which will go ahead and enumerate the instances for you.  That way if for any reason Paul emailed you back and said &#8216;Holy Crap, how the hell did you manage to get that as your highest wait on Instnce #14?&#8217; you&#8217;d still be able to go back and figure out which server he was talking about.  Also, If you would still have the results around in case you wanted to be proactive and take a look yourself (but let&#8217;s not get too carried away).</p>
<pre class="PowerShellColorizedScript" style="width: 539px; height: 354px;"><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'\</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>            

<span style="color: #ff4500;">$MultipleResults</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">Invoke-Sqlcmd2</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;">-Query</span> <span style="color: #8b0000;">"SELECT DENSE_RANK() OVER (ORDER BY [InstanceName]) AS 'SQLInstance' ,[WaitType] ,[Wait_S] ,[Resource_S] ,[Signal_S] ,[WaitCount] ,[Percentage] FROM [CentralInfo].[dbo].[TopWaitTypes] ORDER BY SQLInstance, Percentage"</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">ConvertTo-Html</span> <span style="color: #000080;">-Property</span> <span style="color: #8a2be2;">SQLInstance</span><span style="color: #a9a9a9;">,</span> <span style="color: #8a2be2;">WaitType</span><span style="color: #a9a9a9;">,</span> <span style="color: #8a2be2;">Wait_S</span><span style="color: #a9a9a9;">,</span> <span style="color: #8a2be2;">Resource_S</span><span style="color: #a9a9a9;">,</span> <span style="color: #8a2be2;">Signal_S</span><span style="color: #a9a9a9;">,</span> <span style="color: #8a2be2;">WaitCount</span><span style="color: #a9a9a9;">,</span> <span style="color: #8a2be2;">Percentage</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">Out-String</span><span style="color: #000000;">;</span>
<span style="color: #0000ff;">Send-MailMessage</span> <span style="color: #000080;">-To</span> <span style="color: #8a2be2;">paul@SQLskills.com</span> <span style="color: #000080;">-Subject</span> <span style="color: #8b0000;">"Wait Stats Query Results"</span> –<span style="color: #000080;">From</span> <span style="color: #8a2be2;">YourEmailAddress@GoesHere.com</span> <span style="color: #000080;">-SmtpServer</span> <span style="color: #8a2be2;">smtp.SQLvariant.com</span> <span style="color: #000080;">-Body</span> <span style="color: #ff4500;">$MultipleResults</span> <span style="color: #000080;">-BodyAsHtml</span></pre>
<p>Finally, you know we could put that SELECT statement into a .sql file.  That would cut it back down to ~6 lines.  We might even be able to wrap the email portion into something a little smaller but considering all that this script does I think this is good enough.</p>
<p><strong>It’s Later</strong></p>
<blockquote><p>When I first tried to do something like this I was was shocked to find out that there is no –Append switch for Export-CSV.  I wasn’t very happy about that, I mean I couldn’t wrap my head around how you could leave something like that out.  This ranked right up there with <a href="http://thomaslarock.com/2010/05/utility-control-point/">finding out</a> <strong>Utility Control Point</strong> only worked for managing other SQL 2008 R2 instances.  Luckily my story ended much better Tom’s.  First I reached out to <strong>ScriptingGuys</strong> ( <a href="http://blogs.technet.com/b/heyscriptingguy">blog</a> | <a href="http://twitter.com/ScriptingGuys">twitter</a> ) to make sure that I wasn’t crazy.  Then I did all I could do, sulked and filed a <a href="https://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=525407&amp;wa=wsignin1.0">Connect Item</a>.  The following day I woke up to the sun was shining, the birds chirping, and a tweet from <strong>Dmitry</strong> freaking <strong>Sotnikov</strong> himself ( <a href="http://dmitrysotnikov.wordpress.com/">blog</a> | <a href="http://twitter.com/DSotnikov">twitter</a> ) telling me that he had gone ahead and <a href="http://dmitrysotnikov.wordpress.com/2010/01/19/export-csv-append/">fixed that</a> for me by building a proxy command.  (It’s a function and since functions out rank cmdlets in call order anyone can augment the PowerShell language by adding a proxy command.)</p>
<p>…  and THAT is why I love PowerShell.</p></blockquote>
<h3><span style="color: #004080;">Homework</span></h3>
<p>Use the 3 techniques we walked through to run sp_configure against as many instances as possible.  Save it to a text file, CSV, and a table.  You might even want to add a date column or something.  You could also try email the results to yourself.</p>
<p>Do Not spam Paul Randal!  I cleared the email script with Paul before I included it.  If you want to send Paul the wait stats results from your servers I recommend that you test it first by emailing it to yourself.  If it looks good you go ahead and send it but make sure to include your email address in the –From parameter.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-6/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PowerShell Week at SQL University – Post 5</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-5/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-5/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 04:51:23 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL University]]></category>
		<category><![CDATA[Syndicated]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-5/</guid>
		<description><![CDATA[In the previous posts we’ve just been poking around with PowerShell and trying to make the examples something that actually means something to a SQL person whenever we ca.  There are quite a few more language constructs that we need to cover but we have enough info to start recouping the time we’ve already invested.  Now it’s time to do one of those tasks that I just love to do with PowerShell.  We’re going to loop.  And we’re going to loop in a way that’s far easier than in any part of the SQL language. We’re going to cover 3 different sources for our loop that are the most common for DBAs to use: table, text file, Registered Server/Central Management Server.  After that we’re going to do a double loop and then it’s time for you to find something to do with these. Text File In this chunk of code we’re just going to read from a simple text file from our local hard drive and then loop through the instances in that file one at a time.  You put one instance on each line of the text file.  Don&#8217;t put it in quotes unless you&#8217;re using a non-standard port number.  This is the easiest method because each &#8220;row&#8221; that comes out of the text file only has one property.  We&#8217;ll find out why that&#8217;s important in the next example.  In the meantime setup your text file and test it by running just this: Get-Content C:\PowerShell\AllInstances.txt. foreach ($Instance in Get-Content C:\PowerShell\AllInstances.txt) { $Instance; Invoke-Sqlcmd -ServerInstance $Instance -Database master -Query "SELECT object_name , counter_name , instance_name , cntr_value , cntr_type FROM sys.dm_os_performance_counters" }   Database Table/ Query In this example we could be reading rows out of a table or running a more complex query to determine the list of databases that we want to run out query against.  This may actually seem easier to most database people and it is.  We&#8217;ve got a centrally located table and we can just look at it and know that we can change the first query to select a list of databases from somewhere else.  But there&#8217;s a really important thing to know if you swap out the query.   This approach is sending one usable property (column) to the foreach loop and it&#8217;s called &#8220;name&#8221;.  If you change the query and the column ends up being called database_name, you&#8217;re going to have to change $($db.name) to be called $($db.database_name).  Otherwise you&#8217;re going to loose a lot of hair and get really ticked after about 20 minutes like I did! foreach ($db in invoke-sqlcmd -query "SELECT name  FROM sys.databases WHERE owner_sid !=0x01" -database master -serverinstance Win7NetBook ) {$db.name; Invoke-sqlcmd -Query 'SELECT *   FROM sys.dm_exec_procedure_stats' -ServerInstance  Win7NetBook -Database $($db.name) }   Registered Servers/ Central Management Server Before you get started looping through your Registered Servers you’ll need to run this: Import-Module Agent if you want to do this exact example.  What we’re looking for here is all the jobs that have failed in the last 3 days in our “QA” group of servers.  This example should be easy enough for everyone to tweak on their own.  If you get stuck just remember to do Get-Help -Full Set-AgentJobHistoryFilter (Huge thanks to Chad Miller for helping me put together this demo so that it would be a fast one to run!) $filter = Set-AgentJobHistoryFilter -startDate $(get-date).AddDays(-3) -endDate $(get-date) -outcome 'Failed' foreach ($RegisteredSQLs in dir -recurse SQLSERVER:\SQLRegistration\'Database Engine Server Group'\QA\ &#124; where {$_.Mode -ne "d"} ) { Get-AgentJobHistory $RegisteredSQLs.ServerName $filter &#124; where-object {$_.StepID -ne 0} }   Double Loop This has to be one of my favorite PowerShell scripts of all time (so far).  I had to run a query against every database in a group of over 10 servers.  I’ve changed this one around a little but I’m sure you’ll find a use for it!  (Think permissions.) foreach ($RegisteredSQLs in dir -recurse SQLSERVER:\SQLRegistration\'Database Engine Server Group'\QA\ &#124; where {$_.Mode -ne "d"} ) {     foreach ($DBName in invoke-sqlcmd -query "SELECT name   FROM sys.databases WHERE name in ('AdventureWorks', 'AdventureWorks2008', 'AdventureWorks2008R2', 'AdventureWorksDW' ) " -database master -serverinstance $RegisteredSQLs.ServerName )             {                     invoke-sqlcmd -query 'SELECT *         FROM sys.dm_db_index_usage_stats' -ServerInstance $RegisteredSQLs.ServerName -database $DBName.name             } #EndOfTheFoundDatabasesLoop } #EndOfTheRegisteredServerLoop   Homework Try out each of these methods and think up something you could use this for.  If you hit on something that save you some clicking around in SQL Management Studio please mention it in the comments.]]></description>
			<content:encoded><![CDATA[<p>In the previous posts we’ve just been poking around with PowerShell and trying to make the examples something that actually means something to a SQL person whenever we ca.  There are quite a few more language constructs that we need to cover but we have enough info to start recouping the time we’ve already invested.  Now it’s time to do one of those tasks that I just love to do with PowerShell.  We’re going to loop.  And we’re going to loop in a way that’s far easier than in any part of the SQL language.</p>
<p>We’re going to cover 3 different sources for our loop that are the most common for DBAs to use: <strong>table</strong>, <strong>text file</strong>, <strong>Registered Server</strong>/<strong>Central Management Server</strong>.  After that we’re going to do a double loop and then it’s time for you to find something to do with these.</p>
<h2 style="margin: 6pt 0in 0pt;"><span style="mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-bidi-theme-font: minor-latin;"><span style="color: #498d49; font-size: 14pt;"><span style="font-weight: bold;">Text File</span></span></span></h2>
<p>In this chunk of code we’re just going to read from a simple text file from our local hard drive and then loop through the instances in that file one at a time.  You put one instance on each line of the text file.  Don&#8217;t put it in quotes unless you&#8217;re using a non-standard port number.  This is the easiest method because each &#8220;row&#8221; that comes out of the text file only has one property.  We&#8217;ll find out why that&#8217;s important in the next example.  In the meantime setup your text file and test it by running just this: <span style="color: #0000ff;">Get-Content</span> <span style="color: #8a2be2;">C:\PowerShell\AllInstances.txt</span>.</p>
<pre class="PowerShellColorizedScript"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$Instance</span> <span style="color: #00008b;">in</span> <span style="color: #0000ff;">Get-Content</span> <span style="color: #8a2be2;">C:\PowerShell\AllInstances.txt</span><span style="color: #000000;">)</span>
<span style="color: #000000;">{</span>
<span style="color: #ff4500;">$Instance</span><span style="color: #000000;">;</span>
<span style="color: #0000ff;">Invoke-Sqlcmd</span> <span style="color: #000080;">-ServerInstance</span> <span style="color: #ff4500;">$Instance</span> <span style="color: #000080;">-Database</span> <span style="color: #8a2be2;">master</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">"</span><span style="color: #8b0000;">SELECT  object_name ,
        counter_name ,
        instance_name ,
        cntr_value ,
        cntr_type
  FROM sys.dm_os_performance_counters"</span>
<span style="color: #000000;">}</span></pre>
<h2 style="margin: 6pt 0in 0pt;"><span style="mso-bidi-font-size: 11.0pt;"><span style="color: #498d49; font-size: 14pt;"><span style="font-weight: bold;"> </span></span></span></h2>
<h2 style="margin: 6pt 0in 0pt;"><span style="mso-bidi-font-size: 11.0pt;"><span style="color: #498d49; font-size: 14pt;"><span style="font-weight: bold;">Database Table/ Query</span></span></span></h2>
<p><span style="color: #00008b;"><span style="color: #000000;">In this example we could be reading rows out of a table or running a more complex query to determine the list of databases that we want to run out query against.  This may actually seem easier to most database people and it is.  We&#8217;ve got a centrally located table and we can just look at it and know that we can change the first query to select a list of databases from somewhere else.  But there&#8217;s a really important thing to know if you swap out the query.   This approach is sending one usable property (column) to the foreach loop and it&#8217;s called &#8220;name&#8221;.  If you change the query and the column ends up being called database_name, you&#8217;re going to have to change $(<span style="color: #ff0000;">$db</span>.name) to be called $(<span style="color: #ff0000;">$db</span>.database_name).  Otherwise you&#8217;re going to loose a lot of hair and get really ticked after about 20 minutes like I did!<br />
</span></span></p>
<pre class="PowerShellColorizedScript"><span style="color: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$db</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: #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: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span><span style="color: #000000;">;</span>
<span style="color: #0000ff;">Invoke-sqlcmd</span> <span style="color: #000080;">-Query</span> <span style="color: #8b0000;">'SELECT *
  FROM sys.dm_exec_procedure_stats'</span> <span style="color: #000080;">-ServerInstance</span>  <span style="color: #8a2be2;">Win7NetBook</span> <span style="color: #000080;">-Database</span> <span style="color: #000000;">$(</span><span style="color: #ff4500;">$db</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span><span style="color: #000000;">)</span>
<span style="color: #000000;">}</span></pre>
<h2 style="margin: 6pt 0in 0pt;"><span style="mso-bidi-font-size: 11.0pt;"><span style="color: #498d49; font-size: 14pt;"><span style="font-weight: bold;"> </span></span></span></h2>
<h2 style="margin: 6pt 0in 0pt;"><span style="mso-bidi-font-size: 11.0pt;"><span style="color: #498d49; font-size: 14pt;"><span style="font-weight: bold;">Registered Servers/ Central Management Server</span></span></span></h2>
<p>Before you get started looping through your Registered Servers you’ll need to run this: <span style="font-family: Lucida Console;"><strong><span style="line-height: 12pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;"><span style="color: #0000ff;"><span style="font-size: 10pt;">Import-Module</span></span></span><span style="line-height: 12pt; mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt; mso-ansi-language: en-us; mso-fareast-language: en-us; mso-bidi-language: ar-sa;"><span style="font-size: 10pt;"> </span><span style="color: #8a2be2; font-size: 10pt;">Agent</span></span></strong></span> if you want to do this exact example.  What we’re looking for here is all the jobs that have failed in the last 3 days in our “QA” group of servers.  This example should be easy enough for everyone to tweak on their own.  If you get stuck just remember to do <span style="color: #0000ff;">Get-Help</span> -Full <span style="color: #8a2be2;">Set-AgentJobHistoryFilter</span><br />
(Huge thanks to Chad Miller for helping me put together this demo so that it would be a fast one to run!)</p>
<pre class="PowerShellColorizedScript"><span style="color: #ff4500;">$filter</span> <span style="color: #a9a9a9;">=</span> <span style="color: #0000ff;">Set-AgentJobHistoryFilter</span> <span style="color: #000080;">-startDate</span> <span style="color: #000000;">$(</span><span style="color: #0000ff;">get-date</span><span style="color: #000000;">)</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">AddDays</span><span style="color: #000000;">(</span><span style="color: #800080;">-3</span><span style="color: #000000;">)</span> <span style="color: #000080;">-endDate</span> <span style="color: #000000;">$(</span><span style="color: #0000ff;">get-date</span><span style="color: #000000;">)</span> <span style="color: #000080;">-outcome</span> <span style="color: #8b0000;">'Failed'</span>

<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'\QA\</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: #0000ff;">Get-AgentJobHistory</span> <span style="color: #ff4500;">$RegisteredSQLs</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">ServerName</span> <span style="color: #ff4500;">$filter</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">where-object</span> <span style="color: #000000;">{</span><span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">StepID</span> <span style="color: #a9a9a9;">-ne</span> <span style="color: #800080;">0</span><span style="color: #000000;">}</span>
<span style="color: #000000;">}</span></pre>
<h2 style="margin: 6pt 0in 0pt;"><span style="mso-bidi-font-size: 11.0pt;"><span style="color: #498d49; font-size: 14pt;"><span style="font-weight: bold;"> </span></span></span></h2>
<h2 style="margin: 6pt 0in 0pt;"><span style="mso-bidi-font-size: 11.0pt;"><span style="color: #498d49; font-size: 14pt;"><span style="font-weight: bold;">Double Loop</span></span></span></h2>
<p><span style="color: #00008b;"><span style="color: #000000;">This has to be one of my <strong>favorite PowerShell scripts of all time</strong> (so far).  I had to run a query against every database in a group of over 10 servers.  I’ve changed this one around a little but I’m sure you’ll find a use for it!  (Think permissions.)</span></span></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'\QA\</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: #00008b;">foreach</span> <span style="color: #000000;">(</span><span style="color: #ff4500;">$DBName</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 name in ('AdventureWorks',
            'AdventureWorks2008',
            'AdventureWorks2008R2',
            'AdventureWorksDW'
            ) "</span> <span style="color: #000080;">-database</span> <span style="color: #8a2be2;">master</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: #000000;">)</span>
            <span style="color: #000000;">{</span>
                    <span style="color: #0000ff;">invoke-sqlcmd</span> <span style="color: #000080;">-query</span> <span style="color: #8b0000;">'SELECT *
        FROM sys.dm_db_index_usage_stats'</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: #ff4500;">$DBName</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">name</span>
            <span style="color: #000000;">}</span> <span style="color: #006400;">#EndOfTheFoundDatabasesLoop</span>
<span style="color: #000000;">}</span> <span style="color: #006400;">#EndOfTheRegisteredServerLoop</span></pre>
<h2 style="margin: 6pt 0in 0pt;"><span style="mso-bidi-font-size: 11.0pt;"><span style="color: #498d49; font-size: 14pt;"><span style="font-weight: bold;"> </span></span></span></h2>
<h2 style="margin: 6pt 0in 0pt;"><span style="mso-bidi-font-size: 11.0pt;"><span style="color: #498d49; font-size: 14pt;"><span style="font-weight: bold;">Homework</span></span></span></h2>
<p>Try out each of these methods and think up something you could use this for.  If you hit on something that save you some clicking around in SQL Management Studio please mention it in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-5/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>PowerShell Week at SQL University – Post 4</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-4/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-4/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 16:23:37 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Modules]]></category>
		<category><![CDATA[Profile]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL University]]></category>
		<category><![CDATA[Syndicated]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-4/</guid>
		<description><![CDATA[Recap So far we’ve walked though how to turn on PowerShell and add modules, adding SQL Server 2008 snapins and using PowerShell variables, what cmdlets and functions are, what providers are and how to work with methods &#38; properties. Profiles Today we focus on load things in our profile so that they are always available in PowerShell.  First, some basics: What is a Profile?  A profile is nothing more than a PowerShell script that gets run as soon as you open up a given PowerShell window. Why would we want to do this?  I use PowerShell almost exclusively for automating work with my SQL Servers.  When I’m ready to do something I don’t want to start by reloading the same toolset every time I open it. I want to click the icon and be ready to go.  The profile saves me from this repetitive loading.  I update my profile as I find cool new scripts that I want to add. You are not limited to using a single profile in PowerShell.  Personally, I use one of three profiles depending on the task at hand.  Here is how that works. I use the PowerShell ISE or other third party products as my primary way of writing PowerShell scripts (.ps1) and rarely use the “console.”   I only use the console if I need to troubleshoot something that might have to do with STA/MTA.  When I open up the PowerShell ISE it’s uses it’s own profile CurrentUserCurrentHost that is stored in C:\Users\USERNAME\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1 (picture-right).  Inside of that file on my machine it currently looks like this: import-module ISEPack cd C:\Users\Aaron\Documents\PoSh\Load . ./invoke-sqlcmd2.ps1 . ./Write-DataTable.ps1 . ./Out-DataTable.ps1 . ./Add-SqlTable.ps1 . ./Export-CSV-Append.ps1 . ./invoke-sqlcommand.ps1 . C:\Users\Aaron\Documents\PoSh\Tasks\Get-DisksSpace.ps1 cd c:\temp\ Whatever is in this file only gets loaded into my session when I open the ISE.  Nothing above gets run when I open up the console.  These are items I use in ISE, but not in the console PowerShell window. There are items I use in both ISE and the console.  These items live in a “super profile” of sorts since I want these items no matter how I access PowerShell CurrentUserAllHosts (which is located in C:\Users\USERNAME\Documents\WindowsPowerShell\profile.ps1). Profile.ps1 (picture-center) gets run every time I open up any PowerShell &#8220;host&#8221; including 3rd party tools.  This also includes the SQLPS host which may cause errors messages to appear when you open it or run a SQL Agent Job.  These error messages don&#8217;t impact a PowerShell step in a SQL Agent Job from running. Here’s what I have inside of my Profile.ps1 file. Add-PSSnapin SqlServerCmdletSnapin100 Add-PSSnapin SqlServerProviderSnapin100 Import-Module SQLServer Whenever I open the ISE both the Microsoft.PowerShellISE_profile.ps1 and the Profile.ps1 scripts get run. PowerShell.exe (the little blue &#8220;host&#8221;) has it&#8217;s very own CurrentUserCurrentHost profile that it loads.  That&#8217;s the exact same name as the profile that we talked about the ISE loading so does that mean that it&#8217;s loading that same file?  No.  Each one is configured to load it&#8217;s own CurrentUserCurrentHost from a different location.  So if there are items I want in console world only I have a place to store them thanks to C:\Users\USERNAME\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1.  Since I rarely use the console my profile there sat empty until recently.  I only added items after I spotted a post by Oisin Grehan ( blog &#124; twitter ) on Implementing a Matrix-Style Console Screen Saver and I HAD to try it.  This only works in the console and not in the ISE so it made my console profile the perfect place for implementing this.  Now my PowerShell_profile.ps1 file (picture-left) looks like this: Import-Module screensaver set-screensavertimeout (new-timespan -minutes 5) enable-screensaver Start-ScreenSaver To edit one of the profiles that only load for the console or the ISE all you have to do is open them up and run notepad $profile.  It will figure out which file is the right one for that environment and open it for you.  To edit the profile that is run in every PowerShell environment just run notepad $profile.CurrentUserAllHosts.  If your WindowsPowerShell directory isn&#8217;t there it will not automatically create that for you and you will get an error message stating that it &#8220;can&#8217;t find the specified path&#8220;.  I&#8217;ve written a little script to check for that and create one for you if it&#8217;s not already there: $myPowerShell = $HOME $myPowerShell +="\Documents\WindowsPowerShell" if ((Test-Path $myPowerShell) -eq "true") {"$myPowerShell is already there mate"} else { "you need to make one" mkdir $myPowerShell } Homework Assignment: Setup one of your profiles to at least have one of the modules from the SQLPSX project and the SQL Server Snapins loaded up every time you start up the PowerShell ISE. Which profile to use is completely up to you.  Feel free to play around with your choices.  Optionally you can also include the Get-DisksSpace function like I do; but you don’t have to. Let me know how this goes for you by dropping a note it the comments.  In tomorrow’s post we are going to work with multiple SQL Servers so you’ll need these things up and running for that. If you’re confused by where your files are you can just run this script that I lifted off of the HeyScriptingGuys site to have it tell you where all of the profiles for your session have been loaded from.  Keep in mind that we’re not touching the ones in the Windows directory. $profile &#124; Get-Member -MemberType note* &#124; Format-Table -Wrap -AutoSize -Property name, @{ Label=&#8220;Path&#8221;; Expression={$_.definition -replace &#8220;System.String&#8221;,&#8220;&#8221;} } In Case you would like more to play with&#8230; There is a lot more that can be done with PowerShell Profiles but these are the basics you need to get up and running. If you want to dive deeper check out these posts over on the Hey Scripting Guy Blog.  Go here to download the SQLServer or ISEPack modules; they are both part of larger projects.  If you&#8217;d like some of the scripts that I reference in my profile you can grab the Get-DisksSpace one here and I&#8217;ll be blogging about the rest later this week. Be Advised: Everything that you put into you profile eats up RAM.  Thankfully most scripts are only a few kilobytes.  Keep in mind that the more items you add into your profile the longer that it is going to take to load. In case you’re wondering if that “Matrix Style Console Screen Saver” is worth having around, here is what it looks like after a few minutes: That’s all that I’ve got for you today, see you back tomorrow!]]></description>
			<content:encoded><![CDATA[<h3 style="line-height: 13pt; margin: 10pt 0in 0pt;"><span style="font-family: Cambria;"><span style="color: #4f81bd; font-size: 11pt;"><span style="font-weight: bold;">Recap</span></span></span></h3>
<p>So far we’ve walked though how to turn on PowerShell and add <a href="http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-0/">modules</a>, adding SQL Server 2008 snapins and using PowerShell <a href="http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-1/">variables</a>, what cmdlets and functions <a href="http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-2/">are</a>, what providers are and how to work with methods &amp; <a href="http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-3/">properties</a>.</p>
<h2 style="line-height: 13pt; margin: 10pt 0in 0pt;"><span style="font-family: Cambria;"><span style="color: #4f81bd; font-size: 11pt;"><span style="font-weight: bold;">Profiles</span></span></span></h2>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/PowerShellProfiles.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="PowerShellProfiles" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/PowerShellProfiles_thumb.png" border="0" alt="PowerShellProfiles" width="405" height="160" align="right" /></a>Today we focus on load things in our <strong>profile</strong> so that they are always available in PowerShell.  First, some basics:</p>
<p><em><strong>What is a Profile?</strong></em>  A profile is nothing more than a PowerShell script that gets run as soon as you open up a given PowerShell window.</p>
<p><em><strong>Why would we want to do this?</strong></em>  I use PowerShell almost exclusively for automating work with my SQL Servers.  When I’m ready to do something I don’t want to start by reloading the same toolset every time I open it. I want to <span style="text-decoration: underline;">click the icon and be ready to go</span>.  The profile saves me from this repetitive loading.  I update my profile as I find cool new scripts that I want to add.</p>
<p>You are not limited to using a single profile in PowerShell.  Personally, I use one of three profiles depending on the task at hand.  Here is how that works. I use the <strong>PowerShell ISE</strong> or other third party products as my primary way of writing PowerShell scripts (.ps1) and rarely use the “<strong>console.</strong>”   I only use the console if I need to troubleshoot something that might have to do with STA/MTA. </p>
<p>When I open up the <strong>PowerShell ISE</strong> it’s uses it’s own profile <span style="color: #0000ff;"><strong>CurrentUserCurrentHost</strong> <span style="color: #000000;">that is stored in</span> C:\Users\USERNAME\Documents\WindowsPowerShell\<strong>Microsoft.PowerShellISE_profile.ps1</strong></span> (<strong>picture-right</strong>).  Inside of that file on my machine it currently looks like this:</p>
<pre class="PowerShellColorizedScript"><span style="color: #0000ff;">import-module</span> <span style="color: #8a2be2;">ISEPack</span>
<span style="color: #0000ff;">cd</span> <span style="color: #8a2be2;">C:\Users\Aaron\Documents\PoSh\Load</span>
<span style="color: #a9a9a9;">.</span> <span style="color: #0000ff;">./invoke-sqlcmd2.ps1</span>
<span style="color: #a9a9a9;">.</span> <span style="color: #0000ff;">./Write-DataTable.ps1</span>
<span style="color: #a9a9a9;">.</span> <span style="color: #0000ff;">./Out-DataTable.ps1</span>
<span style="color: #a9a9a9;">.</span> <span style="color: #0000ff;">./Add-SqlTable.ps1</span>
<span style="color: #a9a9a9;">.</span> <span style="color: #0000ff;">./Export-CSV-Append.ps1</span>
<span style="color: #a9a9a9;">.</span> <span style="color: #0000ff;">./invoke-sqlcommand.ps1</span>
<span style="color: #a9a9a9;">.</span> <span style="color: #0000ff;">C:\Users\Aaron\Documents\PoSh\Tasks\Get-DisksSpace.ps1</span>
<span style="color: #0000ff;">cd</span> <span style="color: #8a2be2;">c:\temp\</span></pre>
<p>Whatever is in this file <strong>only</strong> gets loaded into my session when I open the <strong>ISE</strong>.  Nothing above gets run when I open up the console.  These are items I use in ISE, but not in the console PowerShell window.</p>
<p>There are items I use in both ISE and the console.  These items live in a “super profile” of sorts since I want these items no matter how I access PowerShell <span style="color: #0000ff;"><strong>CurrentUser<span style="text-decoration: underline;">AllHosts</span></strong> (<span style="color: #000000;">which is located in</span> C:\Users\USERNAME\Documents\WindowsPowerShell\<strong>profile.ps1</strong></span>). <strong><span style="color: #0000ff;">Profile.ps1</span></strong> (<strong>picture-center</strong>) gets run every time I open up <strong><span style="text-decoration: underline;">any</span></strong> PowerShell &#8220;host&#8221; including 3rd party tools.  This also includes the SQLPS host which may cause errors messages to appear when you open it or run a SQL Agent Job.  These error messages don&#8217;t impact a PowerShell step in a SQL Agent Job from running.</p>
<p>Here’s what I have inside of my <strong><span style="color: #0000ff;">Profile.ps1</span></strong> file.</p>
<pre class="PowerShellColorizedScript"><span style="color: #0000ff;">Add-PSSnapin</span> <span style="color: #8a2be2;">SqlServerCmdletSnapin100</span>
<span style="color: #0000ff;">Add-PSSnapin</span> <span style="color: #8a2be2;">SqlServerProviderSnapin100</span>
<span style="color: #0000ff;">Import-Module</span> <span style="color: #8a2be2;">SQLServer</span></pre>
<p>Whenever I open the ISE both the <span style="color: #0000ff;"><strong>Microsoft.PowerShellISE_profile.ps1</strong></span> and the <strong><span style="color: #0000ff;">Profile.ps1</span></strong> scripts get run.</p>
<p>PowerShell.exe (the little blue &#8220;host&#8221;) has it&#8217;s very own <strong><span style="color: #0000ff;">CurrentUserCurrentHost</span></strong> profile that it loads.  That&#8217;s the exact same name as the profile that we talked about the ISE loading so does that mean that it&#8217;s loading that same file?  No.  Each one is configured to load it&#8217;s own CurrentUserCurrentHost from a different location.  So if there are items I want in console world only I have a place to store them thanks to <span style="color: #0000ff;">C:\Users\USERNAME\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1.</span>  Since I rarely use the console my profile there sat empty until recently.  I only added items after I spotted a post by Oisin Grehan ( <a href="http://www.nivot.org/">blog</a> | <a href="http://twitter.com/oising">twitter</a> ) on <a href="http://www.nivot.org/2010/12/18/PowerShell20ImplementingAMatrixStyleConsoleScreenSaver.aspx">Implementing a Matrix-Style Console Screen Saver</a> and I <span style="text-decoration: underline;">HAD</span> to try it.  This only works in the console and not in the ISE so it made my console profile the perfect place for implementing this.  Now my <span style="color: #0000ff;">PowerShell_profile.ps1</span> file (<strong>picture-left</strong>) looks like this:</p>
<pre class="PowerShellColorizedScript"><span style="color: #0000ff;">Import-Module</span> <span style="color: #8a2be2;">screensaver</span>
<span style="color: #0000ff;">set-screensavertimeout</span> <span style="color: #000000;">(</span><span style="color: #0000ff;">new-timespan</span> <span style="color: #000080;">-minutes</span> <span style="color: #800080;">5</span><span style="color: #000000;">)</span>
<span style="color: #0000ff;">enable-screensaver</span>
<span style="color: #0000ff;">Start-ScreenSaver</span></pre>
<p>To edit one of the profiles that only load for the console or the ISE all you have to do is open them up and run <span style="font-family: lucida console;"><span style="font-size: x-small;"><span style="line-height: 14pt; mso-bidi-font-family: &amp;amp;amp;"><span style="color: #0000ff;">notepad</span></span><span style="line-height: 14pt; mso-bidi-font-family: &amp;amp;amp;"> <span style="color: #ff4500;">$profile</span></span></span></span>.  It will figure out which file is the right one for that environment and open it for you.  To edit the profile that is run in every PowerShell environment just run <span style="font-family: lucida console;"><span style="font-size: x-small;"><span style="line-height: 13pt; mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt;"><span style="color: #0000ff;">notepad</span></span><span style="line-height: 13pt; mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt;"> <span style="color: #ff4500;">$profile</span><span style="color: #a9a9a9;">.</span>CurrentUserAllHosts</span></span></span>.  If your WindowsPowerShell directory isn&#8217;t there it <span style="text-decoration: underline;">will not</span> automatically create that for you and you will get an error message stating that it &#8220;<em>can&#8217;t find the specified path</em>&#8220;.  I&#8217;ve written a little script to check for that and create one for you if it&#8217;s not already there:</p>
<pre class="PowerShellColorizedScript"><span style="color: #ff4500;">$myPowerShell</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$HOME</span>
<span style="color: #ff4500;">$myPowerShell</span> <span style="color: #a9a9a9;">+=</span><span style="color: #8b0000;">"\Documents\WindowsPowerShell"</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: #ff4500;">$myPowerShell</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: #8b0000;">"$myPowerShell is already there mate"</span><span style="color: #000000;">}</span>
<span style="color: #00008b;">else</span> <span style="color: #000000;">{</span> <span style="color: #8b0000;">"you need to make one"</span>
<span style="color: #0000ff;">mkdir</span> <span style="color: #ff4500;">$myPowerShell</span>  <span style="color: #000000;">}</span></pre>
<h2 style="line-height: 15pt; margin: 10pt 0in 0pt;"><span style="font-family: Cambria;"><span style="color: #4f81bd; font-size: 13pt;"><span style="font-weight: bold;">Homework Assignment:</span></span></span></h2>
<p class="MsoNormal" style="line-height: 13pt; margin: 0in 0in 10pt;"><strong>Setup one of your profiles</strong> to at least have one of the modules from the <a href="http://sqlpsx.codeplex.com/"><strong>SQLPSX project</strong></a> and the <strong>SQL Server Snapins</strong> loaded up every time you start up the PowerShell ISE.<span style="mso-spacerun: yes;"> </span>Which profile to use is completely up to you.<span style="mso-spacerun: yes;">  </span>Feel free to play around with your choices.<span style="mso-spacerun: yes;">  </span>Optionally you can also include the Get-DisksSpace function like I do; but you don’t have to.</p>
<p class="MsoNormal" style="line-height: 13pt; margin: 0in 0in 10pt;">Let me know how this goes for you by <strong>dropping a note it the comments</strong>.<span style="mso-spacerun: yes;">  </span>In tomorrow’s post we are going to work with multiple SQL Servers so you’ll need these things up and running for that.</p>
<p class="MsoNormal" style="line-height: 13pt; margin: 0in 0in 10pt;"><strong><em>If you’re confused</em></strong> by where your files are you can just run this script that I lifted off of the <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2010/09/05/how-to-create-a-customizable-profile-for-the-powershell-ise.aspx"><span style="color: #800080;">HeyScriptingGuys</span></a> site to have it tell you where all of the profiles for your session have been loaded from.<span style="mso-spacerun: yes;">  </span>Keep in mind that we’re not touching the ones in the Windows directory.</p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Lucida Console;"><span style="mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt;"><span style="color: #ff4500;"><span style="font-size: 10pt;">$profile</span></span></span><span style="mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt;"><span style="font-size: 10pt;"> <span><span style="color: #a9a9a9;">|</span></span></span><span style="mso-spacerun: yes;"><span style="font-size: 10pt;"> </span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Lucida Console;"><span style="mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt;"><span style="color: #0000ff;"><span style="font-size: 10pt;">Get-Member</span></span></span><span style="mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt;"><span style="font-size: 10pt;"> <span><span style="color: #000080;">-MemberType</span></span> <span><span style="color: #8a2be2;">note*</span></span> <span><span style="color: #a9a9a9;">|</span></span></span><span style="mso-spacerun: yes;"><span style="font-size: 10pt;"> </span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Lucida Console;"><span style="mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt;"><span style="color: #0000ff;"><span style="font-size: 10pt;">Format-Table</span></span></span><span style="mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt;"><span style="font-size: 10pt;"> <span><span style="color: #000080;">-Wrap</span></span> <span><span style="color: #000080;">-AutoSize</span></span> <span><span style="color: #000080;">-Property</span></span> <span><span style="color: #8a2be2;">name</span></span><span><span style="color: #a9a9a9;">,</span></span></span><span style="mso-spacerun: yes;"><span style="font-size: 10pt;"> </span></span></span></span></p>
<p class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="mso-bidi-font-family: &amp;amp;amp; mso-bidi-font-size: 12.0pt;"><span style="font-family: Lucida Console;"><span style="font-size: 10pt;"><span>@{</span> <span>Label</span><span><span style="color: #a9a9a9;">=</span></span><span><span style="color: #8b0000;">&#8220;Path&#8221;</span></span><span>;</span> <span>Expression</span><span><span style="color: #a9a9a9;">=</span></span><span>{</span><span><span style="color: #ff4500;">$_</span></span><span><span style="color: #a9a9a9;">.</span></span><span>definition</span> <span><span style="color: #a9a9a9;">-replace</span></span> <span><span style="color: #8b0000;">&#8220;System.String&#8221;</span></span><span><span style="color: #a9a9a9;">,</span></span><span><span style="color: #8b0000;">&#8220;&#8221;</span></span><span>}</span> <span>}</span> </span></span></span></p>
<p><a href="http://sqlchicken.com/SQL-University"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="SQL University" src="http://sqlchicken.com/wp-content/uploads/2010/11/SQL_University_Web1.png" border="0" alt="PowerShellProfiles" width="150" height="120" align="right" /></a></p>
<h2 style="line-height: 15pt; margin: 10pt 0in 0pt;"><span style="font-family: Cambria;"><span style="color: #4f81bd; font-size: 13pt;"><span style="font-weight: bold;">In Case you would like more to play with&#8230;</span></span></span></h2>
<p>There is a lot more that can be done with PowerShell Profiles but these are the basics you need to get up and running. If you want to dive deeper check out <a href="http://blogs.technet.com/b/heyscriptingguy/archive/tags/windows+powershell/profiles/">these posts</a> over on the Hey Scripting Guy Blog.  Go here to download the <a href="http://sqlpsx.codeplex.com/">SQLServer</a> or <a href="http://code.msdn.microsoft.com/PowerShellPack">ISEPack</a> modules; they are both part of larger projects.  If you&#8217;d like some of the scripts that I reference in my profile you can grab the <a href="http://sqlvariant.com/wordpress/index.php/2010/11/quick-blog-powershell-disk-and-mountpoint-check/">Get-DisksSpace</a> one here and I&#8217;ll be blogging about the rest later this week.</p>
<p><span style="color: #0000ff;"><strong><span style="color: #000080;">Be Advised:</span></strong></span></p>
<p>Everything that you put into you profile eats up RAM.  Thankfully most scripts are only a few kilobytes.  Keep in mind that the more items you add into your profile the longer that it is going to take to load.</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/image5.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="image" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/image_thumb3.png" border="0" alt="image" width="453" height="292" align="right" /></a>In case you’re wondering if that “Matrix Style Console Screen Saver” is worth having around, here is what it looks like after a few minutes:</p>
<p>That’s all that I’ve got for you today, see you back tomorrow!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/01/powershell-week-at-sql-university-post-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SQL Smackdown: SSIS vs. PowerShell</title>
		<link>http://sqlvariant.com/wordpress/index.php/2011/01/sql-smackdown-ssis-vs-powershell/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2011/01/sql-smackdown-ssis-vs-powershell/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 14:50:08 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Saturday]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1943</guid>
		<description><![CDATA[I’ll be presenting with Mike Davis ( blog &#124; twitter ) at SQL Saturday #62 this weekend.  I’ll be presenting on a topic that is very near and dear to my heart: Not using SSIS!  And Mike, well lets face it.  I know Mike’s written a book or two on SSIS but about all that Mike will be doing is showing everyone why I love PowerShell so much.  I hear he even picked up a brand new laptop so that BIDS wouldn’t slow him down as much.  I’ll be bringing my old Netbook running multiple instances of SQL Server.  $5 says I still complete my demos in half the time as Mike’s. Mike says that we’re going to “Square off” but I heard the new SSIS has pretty new rounded corners.  I don’t know about you but that a feature that I’ve been waiting a loooong time for.  I bet he’s going to be doing a lot of talking about what might be in the Denali version of SSIS but I’ll be showing you what 4 or 5 lines of PowerShell can do for you today!  So if you’re looking for something to do around 2:45 Saturday afternoon come see what PowerShell can do for you!]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/SQLsmackdown.jpg"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="SQLsmackdown" src="http://sqlvariant.com/wordpress/wp-content/uploads/2011/01/SQLsmackdown_thumb.jpg" border="0" alt="SQLsmackdown" width="244" height="158" align="right" /></a>I’ll be presenting with Mike Davis ( <a href="http://www.bidn.com/blogs/MikeDavis/">blog</a> | <a href="http://www.twitter.com/MikeDavisSQL">twitter</a> ) at SQL Saturday #62 this weekend.  I’ll be presenting on a topic that is very near and dear to my heart: <strong>Not using SSIS</strong>!  And Mike, well lets face it.  I know Mike’s written a <a href="http://www.amazon.com/Knights-24-Hour-Trainer-Integration-Programmer/dp/0470496924/ref=sr_1_1?ie=UTF8&amp;qid=1294929975&amp;sr=8-1">book or two on SSIS</a> but about all that Mike will be doing is showing everyone why I love PowerShell so much.  I hear he even picked up a brand new laptop so that BIDS wouldn’t slow him down as much.  I’ll be bringing my old Netbook running multiple instances of SQL Server.  $5 says I still complete my demos in <strong>half</strong> the time as Mike’s.</p>
<p>Mike says that we’re going to “<a href="http://www.bidn.com/blogs/MikeDavis/ssis/1373/sql-smackdown-at-sql-saturday-tampa-2011">Square off</a>” but I heard the new SSIS has pretty new rounded corners.  I don’t know about you but that a feature that I’ve been waiting a loooong time for.  I bet he’s going to be doing a lot of talking about what <em><span style="text-decoration: underline;">might be</span></em> in the <strong>Denali</strong> version of SSIS but I’ll be showing you what 4 or 5 lines of <strong>PowerShell</strong> can do for you <span style="text-decoration: underline;">today</span>!  So if you’re looking for something to do around 2:45 Saturday afternoon come see what PowerShell can do for you!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2011/01/sql-smackdown-ssis-vs-powershell/feed/</wfw:commentRss>
		<slash:comments>2</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>PowerShell Script to Download SQL MCM Videos</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/12/powershell-script-to-download-sql-mcm-videos/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/12/powershell-script-to-download-sql-mcm-videos/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 14:17:55 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[MCM]]></category>
		<category><![CDATA[RegEx]]></category>
		<category><![CDATA[RSS feed]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Video Download]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1747</guid>
		<description><![CDATA[Microsoft has made changes to the Microsoft Certified Master program for SQL Server to make it much more accessible to everyone.  In short if you have the required credentials (MCITP: DBA 2008, DBD 2008), the required skills, and $2,500; you too can become an MCM for SQL Server.  Microsoft has partnered with SQLskills to produce 40 hours of introductory MCM training material videos which they have made freely available to everyone.  If you’d like more training than just the videos SQLskills has some classes that you can attend. If you’re like me you’ve either already downloaded the videos or you’re not even reading this right now because you clicked the link and just started downloading the videos.    Well if you don’t want to spend the rest of your day downloading all of those videos by hand I’ve got a little PowerShell script I think you’ll enjoy. $wc = new-object net.webclient [regex]$regex ="(?&#60;url&#62;http://download.microsoft.com/download/./././[0-f]{8}-[0-f]{4}-[0-f]{4}-[0-f]{4}-[0-f]{12}/(?&#60;file&#62;[^&#62;]*?wmv))" [xml]$xml = $wc.DownloadString("http://www.microsoft.com/feeds/TechNet/en-us/How-to-videos/SQL_Server_2008_Microsoft_Certified_Master_(MCM)_Readiness_Videos.xml") $xml.rss.channel.item &#124; foreach { if ($wc.DownloadString($_.link) -match $regex) { $url = $matches.url $file = "$home\Videos\$($matches.file)" if (Test-Path $file) {Write-Host "$file is already there mate"} else { Write-Host "Downloading $file" $wc.DownloadFile($url,$file) } } } This script will check the RSS feed, connect to all of the links in it, find the first .wmv link that it comes across, then copy that file to your videos directory in your documents folder IF it’s not already there.  If you have to stop this script that’s fine, it will figure out which videos have already been downloaded and skip them*.  If you want to try downloading the .MP4 files instead, just swap out .wmv for .mp4 and you should be all set.  A warning about that though; they seem to be a little more than twice the size of the .wmv files *This script is written for Windows 7 and maybe for Windows Vista.  You&#8217;ll have to edit it yourself for Windows XP or just bug Nic Cain to post one **IMPORTANT:  I think I have fixed the HTML rendering issues for the code block but you may need to download the script here. PowerShell First Timers! First off, welcome to the best addiction that you will ever have!  Since so many people are checking out this post and firing up PowerShell for the first time, I&#8217;ve gathered together some useful links.  Here&#8217;s one from the ScriptingGuys themselves: How Do I Install PowerShell on Windows 7 and Other Questions  I have a series of posts you may want to look at to help you get up &#38; running as well as a video I did a while back for MSDN&#8217;s geekSpeak: PowerShell Week Post 0 (5/17) PowerShell Week Post 1 (5/18) PowerShell Week Post 2 (5/20) PowerShell Week Post 3 (5/20) I’ll blog more later this week about how I put together the script but I wanted to get it into people’s hands ASAP.  Special Thanks go out to Jeremiah Peschka ( blog &#124; twitter ) for not laughing too hard at my first ever attempt at a RegEx as well as Nicolas Cain ( blog &#124; twitter ) &#38; Chad Miller (Blog&#124;Twitter) for giving me pointers on how to use my new RegEx hammer inside of PowerShell.]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/12/image4.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_thumb4.png" border="0" alt="image" width="68" height="67" align="right" /></a>Microsoft has made <a href="http://www.microsoft.com/presspass/features/2010/nov10/11-09sqlservermcm.mspx?rss_fdn=Custom">changes</a> to the Microsoft Certified Master program for SQL Server to make it much more accessible to everyone.  In short if you have the required credentials (MCITP: DBA 2008, DBD 2008), the required skills, and $2,500; you too can become an MCM for SQL Server.  Microsoft has partnered with <a href="http://www.sqlskills.com/T_SQLskillsMasterImmersionEvents.asp">SQLskills</a> to produce <a href="http://technet.microsoft.com/en-us/sqlserver/ff977043.aspx">40 hours</a> of introductory MCM training material videos which they have made freely available to everyone. </p>
<p>If you’d like more training than just the videos SQLskills has some <a href="http://www.sqlskills.com/T_SQLskillsMasterImmersionEvents.asp">classes</a> that you can attend.</p>
<p><a href="http://sqlvariant.com/BlogSupport/Scripts/PowerShell/Download-MCMVideos.zip"><img style="display: inline; float: right;" src="http://powershell.sqlpass.org/Portals/74/icons/Windows_PowerShell_icon-102x102.png" alt="" width="102" height="102" align="right" /></a>If you’re like me you’ve either already downloaded the videos or you’re not even reading this right now because you clicked the link and just started downloading the videos.  <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/12/wlEmoticon-smile11.png" alt="Smile" />  Well if you don’t want to spend the rest of your day downloading all of those videos by hand I’ve got a little <a href="http://sqlvariant.com/BlogSupport/Scripts/PowerShell/Download-MCMVideos.zip">PowerShell script</a> I think you’ll enjoy.</p>
<pre class="PowerShellColorizedScript"><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: #008080;">[regex]</span><span style="color: #ff4500;">$regex</span> <span style="color: #a9a9a9;">=</span><span style="color: #8b0000;">"(?&lt;<span style="color: #8b0000;">url&gt;</span><span style="color: #8b0000;">http://download.microsoft.com/download/./././[0-f]{8}-[0-f]{4}-[0-f]{4}-[0-f]{4}-[0-f]{12}/(?&lt;file&gt;[^&gt;]*?wmv))"</span>
<span style="color: #008080;">[xml]</span><span style="color: #ff4500;">$xml</span> <span style="color: #a9a9a9;">=</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: #8b0000;">"http://www.microsoft.com/feeds/TechNet/en-us/How-to-videos/SQL_Server_2008_Microsoft_Certified_Master_(MCM)_Readiness_Videos.xml"</span><span style="color: #000000;">)</span>
<span style="color: #ff4500;">$xml</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">rss</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">channel</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">item</span> <span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">foreach</span> <span style="color: #000000;">{</span>
    <span style="color: #00008b;">if</span> <span style="color: #000000;">(</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;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">link</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">-match</span> <span style="color: #ff4500;">$regex</span><span style="color: #000000;">)</span>
    <span style="color: #000000;">{</span>
        <span style="color: #ff4500;">$url</span> <span style="color: #a9a9a9;">=</span> <span style="color: #ff4500;">$matches</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">url</span>
        <span style="color: #ff4500;">$file</span> <span style="color: #a9a9a9;">=</span>  <span style="color: #8b0000;">"$home\Videos\$($matches.file)"</span>
        <span style="color: #00008b;">if</span> <span style="color: #000000;">(</span><span style="color: #0000ff;">Test-Path</span> <span style="color: #ff4500;">$file</span><span style="color: #000000;">)</span>
        <span style="color: #000000;">{</span><span style="color: #0000ff;">Write-Host</span> <span style="color: #8b0000;">"$file is already there mate"</span><span style="color: #000000;">}</span>
        <span style="color: #00008b;">else</span> <span style="color: #000000;">{</span>
            <span style="color: #0000ff;">Write-Host</span> <span style="color: #8b0000;">"Downloading $file"</span>
            <span style="color: #ff4500;">$wc</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">DownloadFile</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$url</span><span style="color: #a9a9a9;">,</span><span style="color: #ff4500;">$file</span><span style="color: #000000;">)</span>
        <span style="color: #000000;">}</span>
    <span style="color: #000000;">}</span>
<span style="color: #000000;">}</span></span></pre>
<p>This script will check the RSS feed, connect to all of the links in it, find the first .wmv link that it comes across, then copy that file to your videos directory in your documents folder IF it’s not already there.  If you have to stop this script that’s fine, it will figure out which videos have already been downloaded and skip them*.  If you want to try downloading the .MP4 files instead, just swap out .wmv for .mp4 and you should be all set.  A warning about that though; they seem to be a little more than twice the size of the .wmv files</p>
<p>*This script is written for Windows 7 and maybe for Windows Vista.  You&#8217;ll have to edit it yourself for Windows XP or just bug Nic Cain to post one <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
**<span style="color: #ff0000;">IMPORTANT:</span>  I think I have fixed the HTML rendering issues for the code block but you may need to <strong>download the script </strong><a href="http://sqlvariant.com/BlogSupport/Scripts/PowerShell/Download-MCMVideos.zip"><strong>here</strong></a><span style="color: #800000;"><span style="color: #000000;">.</span></span></p>
<h3><span style="color: #800000;"><span style="color: #000080;">PowerShell First Timers!</span></span></h3>
<p>First off, welcome to the best addiction that you will ever have!  Since so many people are checking out this post and firing up PowerShell for the first time, I&#8217;ve gathered together some useful links.  Here&#8217;s one from the ScriptingGuys themselves:<strong> </strong><a href="http://blogs.technet.com/b/heyscriptingguy/archive/2011/01/07/how-do-i-install-powershell-on-windows-7-and-other-questions.aspx#Q1"><strong>How Do I Install PowerShell on Windows 7 and Other Questions</strong></a> </p>
<p>I have a series of posts you may want to look at to help you get up &amp; running as well as a video I did a while back for<strong> </strong><a href="http://channel9.msdn.com/shows/geekSpeak/geekSpeak-Recording-Powershell-for-Data-Professionals/"><strong>MSDN&#8217;s geekSpeak</strong></a>:<object style="width: 400px; height: 400px;" classid="clsid:6bf52a52-394a-11d3-b153-00c04f79faa6" width="400" height="400" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"><param name="autostart" value="false" /><param name="url" value="http://ecn.channel9.msdn.com/o9/ch9/7/8/5/8/4/5/geekSpeakPowershell_2MB_ch9.wmv" /><param name="align" value="right" /><embed style="width: 400px; height: 400px;" type="application/x-mplayer2" width="400" height="400" src="http://ecn.channel9.msdn.com/o9/ch9/7/8/5/8/4/5/geekSpeakPowershell_2MB_ch9.wmv" autostart="false" align="right"></embed></object><br />
<a href="http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-0/">PowerShell Week Post 0</a> (5/17)<br />
<a href="http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-1/">PowerShell Week Post 1</a> (5/18)<br />
<a href="http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-2/">PowerShell Week Post 2</a> (5/20)<br />
<a href="http://sqlvariant.com/wordpress/index.php/2010/05/powershell-week-at-sql-university-post-3/">PowerShell Week Post 3</a> (5/20)</p>
<p>I’ll blog more later this week about how I put together the script but I wanted to get it into people’s hands ASAP.  Special Thanks go out to <strong>Jeremiah Peschka</strong> ( <a href="http://facility9.com/">blog</a> | <a href="http://twitter.com/peschkaj">twitter</a> ) for not laughing too hard at my first ever attempt at a RegEx as well as <strong>Nicolas Cain</strong> ( <a href="http://www.englishtosql.com/">blog</a> | <a href="http://twitter.com/anonythemouse">twitter</a> ) &amp; <strong>Chad Miller</strong> (<a href="http://sev17.com/">Blog</a>|<a href="http://www.twitter.com/cmille19">Twitter</a>) for giving me pointers on how to use my new RegEx hammer inside of PowerShell.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/12/powershell-script-to-download-sql-mcm-videos/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
<enclosure url="http://ecn.channel9.msdn.com/o9/ch9/7/8/5/8/4/5/geekSpeakPowershell_2MB_ch9.wmv" length="205363119" type="video/asf" />
		</item>
		<item>
		<title>PowerShell Grab Bag Code</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/12/powershell-grab-bag-code/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/12/powershell-grab-bag-code/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 18:52:33 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Check Existence]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[Virtual Chapter]]></category>
		<category><![CDATA[Zip Directory]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/12/powershell-grab-bag-code/</guid>
		<description><![CDATA[Thanks to everyone who took the time to check out my PowerShell Grab Bag session today for the PowerShell Virtual Chapter of PASS.  Here’s a zip of all the code that I used and the two links I promised to include. Today’s Code Quest’s Free PowerShell Commands for Active Directory Shay Levy’s ( blog &#124; twitter ) WinRar blog post Happy Scripting!]]></description>
			<content:encoded><![CDATA[<p><img style="display: inline; float: right;" src="http://powershell.sqlpass.org/Portals/74/icons/Windows_PowerShell_icon-102x102.png" alt="" width="102" height="102" align="right" />Thanks to everyone who took the time to check out my PowerShell Grab Bag session today for the <a href="http://powershell.sqlpass.org/">PowerShell Virtual Chapter of PASS</a>.  Here’s a <a href="http://bit.ly/fKPxUO">zip</a> of all the code that I used and the two links I promised to include.</p>
<h3><a href="http://bit.ly/fKPxUO">Today’s Code</a></h3>
<h3>Quest’s <a href="http://www.quest.com/powershell/activeroles-server.aspx">Free PowerShell Commands for Active Directory</a></h3>
<h3>Shay Levy’s ( <a href="http://scriptolog.blogspot.com/">blog</a> | <a href="http://twitter.com/ShayLevy">twitter</a> ) <a href="http://scriptolog.blogspot.com/2007/09/winrar-archivebackup-function.html">WinRar blog post</a></h3>
<p>Happy Scripting!</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/12/powershell-grab-bag-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Presenting for the PowerShell Virtual Chapter of PASS</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/12/presenting-for-the-powershell-virtual-chapter-of-pass/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/12/presenting-for-the-powershell-virtual-chapter-of-pass/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 14:31:30 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[Virtual Chapter]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/12/presenting-for-the-powershell-virtual-chapter-of-pass/</guid>
		<description><![CDATA[Sorry for the late notice folks but I will be Presenting for the PowerShell Virtual Chapter of PASS today at Noon Eastern.  Today’s session is just going to be a bunch of cool things that I’ve been working on lately but haven’t gotten a chance to present or blog about yet.  I’m still working on one last script but I’ll post the code before the session if I can.  Hope to see you there! PowerShell Grab Bag Wednesday December 15, 2010, 12 Noon Eastern Time (GMT -5) Speaker:  Me Live Meeting Information Join the meeting In this short grab bag session we’ll go over a bunch of new scripts that I’ve built over the last few weeks.  Things like: checking free space on mount points, checking SQL agent for failed jobs, polling instances to make sure they&#8217;re available, checking the status of log shipping across multiple targets, emailing result sets and scheduling all these with SQL Agent.  Checking remote registries (including why on earth you would ever want to do that?!). Zipping files, even better, we’ll go over how to not zip files that have already been zipped.  The final grab from this session:  for all the Summit attendees out there, I’ll share with you my script to download all the session videos from the 2010 Summit]]></description>
			<content:encoded><![CDATA[<p><a href="http://powershell.sqlpass.org/"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border: 0px;" title="pass_logo_thumb" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/12/pass_logo_thumb1.gif" border="0" alt="pass_logo_thumb" width="83" height="64" align="right" /></a>Sorry for the late notice folks but I will be Presenting for the PowerShell Virtual Chapter of PASS <strong>today at Noon Eastern</strong>.  Today’s session is just going to be a bunch of cool things that I’ve been working on lately but haven’t gotten a chance to present or blog about yet.  I’m still working on one last script but I’ll post the code before the session if I can.  Hope to see you there!</p>
<h4><span style="color: #0080c0;">PowerShell Grab Bag</span></h4>
<p><strong>Wednesday December 15, 2010, 12 Noon Eastern Time (GMT -5) </strong><br />
<strong>Speaker:  Me<br />
</strong><strong>Live Meeting Information </strong><span style="text-decoration: underline;"><a href="https://www.livemeeting.com/cc/8000181573/join?id=K3GGBR&amp;role=attend&amp;pw=SW%7E%5D7%7Dh2h">Join the meeting</a></span></p>
<p>In this short grab bag session we’ll go over a bunch of new scripts that I’ve built over the last few weeks.  Things like:</p>
<ul>
<li>checking free space on mount points,</li>
<li>checking SQL agent for failed jobs,</li>
<li>polling instances to make sure they&#8217;re available,</li>
<li>checking the status of log shipping across multiple targets,</li>
<li>emailing result sets and</li>
<li>scheduling all these with SQL Agent. </li>
<li>Checking remote registries (including why on earth you would ever want to do that?!).</li>
<li>Zipping files, even better, we’ll go over how to <span style="text-decoration: underline;">not zip</span> files that have already been zipped. </li>
<li>The final grab from this session:  for all the Summit attendees out there, I’ll share with you my script to download all the session videos from the 2010 Summit <img src="http://powershell.sqlpass.org/Providers/HtmlEditorProviders/Fck/fckeditor/editor/images/smiley/msn/regular_smile.gif" alt="" align="textTop" /></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/12/presenting-for-the-powershell-virtual-chapter-of-pass/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I&#8217;m on the PowerScripting Podcast</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/12/im-on-the-powerscripting-podcast/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/12/im-on-the-powerscripting-podcast/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 13:55:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PASS Summit 2010]]></category>
		<category><![CDATA[Podcast]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1703</guid>
		<description><![CDATA[Two Weeks ago I got to sit around a table with Jon Walz ( blog &#124; twitter ), Hal Rottenberg ( blog &#124; twitter ), Ed Wilson ( blog &#124; twitter ) and Mark Mitchell ( blog &#124; twitter ) to talk about PowerShell and the 2010 PASS Summit. Surprised it only took 48 minutes! It’s always a lot of fun to get to sit around and talk with those guys at any time but I’m glad it was recorded so that their community can hear how we’re using PowerShell in the SQL community. If you’ve never been to their site (PowerScripting.net) it is PACKED with PowerShell tips! You would be amazed at the cool tips that you can find from shows they did a year or two ago and their all it the show notes. I hope you enjoy the show oh and sorry B/I people, I didn’t mean any thing by the parsley thing Listen:]]></description>
			<content:encoded><![CDATA[<p><a href="http://social.zune.net/podcast/PowerScripting-Podcast/1571d0bf-bae0-4e13-982d-a8b03d54c0eb"><img style="display: inline; float: right;" src="http://image.catalog.zune.net/v3.0/image/0be34680-f011-40c3-98dc-22de96acccbc?resize=true&amp;width=300" alt="PowerScripting Podcast" width="190" height="190" align="right" /></a>Two Weeks ago I got to sit around a table with Jon Walz ( <a href="http://powerscripting.wordpress.com/">blog</a> | <a href="http://twitter.com/jonwalz">twitter</a> ), Hal Rottenberg ( <a href="http://halr9000.com/">blog</a> | <a href="http://twitter.com/halr9000">twitter</a> ), Ed Wilson ( <a href="http://blogs.technet.com/b/heyscriptingguy">blog</a> | <a href="http://www.twitter.com/ScriptingGuys">twitter</a> ) and Mark Mitchell ( <a href="http://designandcode.net/default.aspx">blog</a> | <a href="http://twitter.com/mitchellm44">twitter</a> ) to talk about PowerShell and the <a href="http://www.sqlpass.org/summit/na2010/">2010 PASS Summit</a>.  Surprised it only took 48 minutes! <img style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/wlEmoticon-openmouthedsmile1.png" alt="Open-mouthed smile" class="wlEmoticon wlEmoticon-openmouthedsmile" /> It’s always a lot of fun to get to sit around and talk with those guys at any time but I’m glad it was recorded so that their community can hear how we’re using PowerShell in the SQL community.</p>
<p>If you’ve never been to their site (<a href="http://powerscripting.wordpress.com/">PowerScripting.net</a>) it is PACKED with PowerShell tips!  You would be amazed at the cool tips that you can find from shows they did a year or two ago and their all it the show notes.</p>
<p>I hope you enjoy the show oh and sorry B/I people, I didn’t mean any thing by the parsley thing <img style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/12/wlEmoticon-winkingsmile.png" alt="Winking smile" class="wlEmoticon wlEmoticon-winkingsmile" /></p>
<p>Listen:</p>
<div><a href="http://traffic.libsyn.com/powerscripting/PSPodcast-132.mp3"><strong><img src="http://powerscripting.libsyn.com/img/podcastIcon.gif" alt="" border="0" /></strong></a></div>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/12/im-on-the-powerscripting-podcast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://traffic.libsyn.com/powerscripting/PSPodcast-132.mp3" length="0" type="audio/mpeg" />
		</item>
		<item>
		<title>Quick Blog: PowerShell Disk and MountPoint Check</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/11/quick-blog-powershell-disk-and-mountpoint-check/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/11/quick-blog-powershell-disk-and-mountpoint-check/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 14:24:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Disk Space]]></category>
		<category><![CDATA[Mount Points]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/11/quick-blog-powershell-disk-and-mountpoint-check/</guid>
		<description><![CDATA[I tuned into twitter yesterday for a couple of minutes and found a great conversation going on between Nicolas Cain ( blog &#124; twitter ) and Dave Levy ( blog &#124; twitter ) about checking Disk Space &#38; Mount Points. I really like what they were working on because it was actually one of my top priorities for the week. I already have some code for checking both regular disk drives and mount points with PowerShell but I was looking to improve it and get it ready for production monitoring. Everyone’s environment is different and they build things based on needs and pain points. For my own environment I took a little of what Dave put together and a little of what Nick put together and built my own function for my environment. I’m still trying to add some more information to it but here’s what I’ve got so far: Function Get-DisksSpace ([string]$Servername, $unit= "GB") { $measure = "1$unit" Get-WmiObject -computername $serverName -query " select SystemName, Name, DriveType, FileSystem, FreeSpace, Capacity, Label from Win32_Volume where DriveType = 2 or DriveType = 3" ` &#124; select SystemName ` , Name ` , @{Label="SizeIn$unit";Expression={"{0:n2}" -f($_.Capacity/$measure)}} ` , @{Label="FreeIn$unit";Expression={"{0:n2}" -f($_.freespace/$measure)}} ` , @{Label="PercentFree";Expression={"{0:n2}" -f(($_.freespace / $_.Capacity) * 100)}} ` , Label }#Get-DisksSpace The code above will create a PowerShell function (sorta kinda like a stored procedure only not really but just think of it like that if you’re a SQL person that’s new to PowerShell ) Here&#8217;s how you would call it: Get-DisksSpace &#8220;Win7NetBook&#8221; &#124; Format-Table Or if you only wanted to know about the drives that are low on space: Get-DisksSpace &#8220;Win7NetBook&#8221; &#124; where{$_.PercentFree -lt 20} &#124; Format-Table This will return you the list of drives and mount points on the machine you listed and default the unit of measure to convert the results to gigabytes. The great news is that this code runs really fast. Their conversation yesterday literally saved me hours of work. I’ll keep working with this and post another blog when I put the monitoring portion into production.]]></description>
			<content:encoded><![CDATA[<p><img style="display: inline; float: right;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/04/PoSh.png" alt="" align="right" />I tuned into twitter yesterday for a couple of minutes and found a great conversation going on between <strong>Nicolas Cain</strong> ( <a href="http://www.englishtosql.com/">blog</a> | <a href="http://twitter.com/anonythemouse">twitter</a> ) and <strong>Dave Levy</strong> ( <a href="http://adventuresinsql.com">blog</a> | <a href="http://twitter.com/dave_levy">twitter</a> ) about checking Disk Space &amp; Mount Points.  I really like what they were working on because it was actually one of my top priorities for the week.  I already have some code for checking both regular disk drives and <a href="http://sqlvariant.com/wordpress/index.php/2010/05/quick-post-checking-mount-points-with-powershell/">mount points</a> with PowerShell but I was looking to improve it and get it ready for production monitoring.</p>
<p>Everyone’s environment is different and they build things based on needs and pain points.  For my own environment I took a little of what <a href="http://adventuresinsql.com/2010/11/get-drive-space-including-mount-points/">Dave put together</a> and a little of what <a href="http://www.englishtosql.com/english-to-sql-blog/2010/11/23/quick-powershell-disk-space-check.html">Nick put together</a> and built my own function for my environment.  I’m still trying to add some more information to it but here’s what I’ve got so far:</p>
<pre style="width: 539px; height: 338px;" class="PowerShellColorizedScript"><span style="color: #00008b;">Function</span> <span style="color: #8a2be2;">Get-DisksSpace</span> <span style="color: #000000;">(</span><span style="color: #008080;">[string]</span><span style="color: #ff4500;">$Servername</span><span style="color: #a9a9a9;">,</span> <span style="color: #ff4500;">$unit</span><span style="color: #a9a9a9;">=</span> <span style="color: #8b0000;">"GB"</span><span style="color: #000000;">)</span>
<span style="color: #000000;">{</span>
<span style="color: #ff4500;">$measure</span> <span style="color: #a9a9a9;">=</span> <span style="color: #8b0000;">"1$unit"</span>

<span style="color: #0000ff;">Get-WmiObject</span> <span style="color: #000080;">-computername</span> <span style="color: #ff4500;">$serverName</span> <span style="color: #000080;">-query</span> <span style="color: #8b0000;">"
select SystemName, Name, DriveType, FileSystem, FreeSpace, Capacity, Label
  from Win32_Volume
 where DriveType = 2 or DriveType = 3"</span> <span style="color: #000000;">`
</span><span style="color: #a9a9a9;">|</span> <span style="color: #0000ff;">select</span> <span style="color: #0000ff;">SystemName</span> <span style="color: #000000;">`
</span>        <span style="color: #a9a9a9;">,</span> <span style="color: #8a2be2;">Name</span> <span style="color: #000000;">`
</span>        <span style="color: #a9a9a9;">,</span> <span style="color: #000000;">@{</span><span style="color: #000000;">Label</span><span style="color: #a9a9a9;">=</span><span style="color: #8b0000;">"SizeIn$unit"</span><span style="color: #000000;">;</span><span style="color: #000000;">Expression</span><span style="color: #a9a9a9;">=</span><span style="color: #000000;">{</span><span style="color: #8b0000;">"{0:n2}"</span> <span style="color: #a9a9a9;">-f</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Capacity</span><span style="color: #a9a9a9;">/</span><span style="color: #ff4500;">$measure</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> <span style="color: #000000;">`
</span>        <span style="color: #a9a9a9;">,</span> <span style="color: #000000;">@{</span><span style="color: #000000;">Label</span><span style="color: #a9a9a9;">=</span><span style="color: #8b0000;">"FreeIn$unit"</span><span style="color: #000000;">;</span><span style="color: #000000;">Expression</span><span style="color: #a9a9a9;">=</span><span style="color: #000000;">{</span><span style="color: #8b0000;">"{0:n2}"</span> <span style="color: #a9a9a9;">-f</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">freespace</span><span style="color: #a9a9a9;">/</span><span style="color: #ff4500;">$measure</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> <span style="color: #000000;">`
</span>        <span style="color: #a9a9a9;">,</span> <span style="color: #000000;">@{</span><span style="color: #000000;">Label</span><span style="color: #a9a9a9;">=</span><span style="color: #8b0000;">"PercentFree"</span><span style="color: #000000;">;</span><span style="color: #000000;">Expression</span><span style="color: #a9a9a9;">=</span><span style="color: #000000;">{</span><span style="color: #8b0000;">"{0:n2}"</span> <span style="color: #a9a9a9;">-f</span><span style="color: #000000;">(</span><span style="color: #000000;">(</span><span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">freespace</span> <span style="color: #a9a9a9;">/</span> <span style="color: #ff4500;">$_</span><span style="color: #a9a9a9;">.</span><span style="color: #000000;">Capacity</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">*</span> <span style="color: #800080;">100</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><span style="color: #000000;">}</span> <span style="color: #000000;">`
</span>        <span style="color: #a9a9a9;">,</span>  <span style="color: #8a2be2;">Label</span>
<span style="color: #000000;">}</span><span style="color: #006400;">#Get-DisksSpace</span></pre>
<p>The code above will create a PowerShell function (<em>sorta kinda like a stored procedure only not really but just think of it like that if you’re a SQL person that’s new to PowerShell</em> <img style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/wlEmoticon-smile3.png" alt="Smile" class="wlEmoticon wlEmoticon-smile" /> ) Here&#8217;s how you would call it:</p>
<p style="line-height: 13pt; margin: 0in 0in 10pt;" class="MsoNormal"><span style="font-family: Lucida Console;"><span style="line-height: 12pt; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: &amp;amp;amp;"><span style="color: #0000ff;"><span style="font-size: 10pt;">Get-DisksSpace</span></span></span><span style="line-height: 12pt; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: &amp;amp;amp;"><span style="font-size: 10pt;"><span style="color: #000000;"> </span><span><span style="color: #8b0000;">&#8220;Win7NetBook&#8221;</span></span><span style="color: #000000;"> </span><span><span style="color: #a9a9a9;">|</span></span><span style="color: #000000;"> </span></span><span><span style="color: #0000ff; font-size: 10pt;">Format-Table</span></span></span></span></p>
<p>Or if you only wanted to know about the drives that are low on space:</p>
<p style="line-height: 13pt; margin: 0in 0in 10pt;" class="MsoNormal"><span style="font-family: Lucida Console;"><span style="line-height: 13pt; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: &amp;amp;amp;"><span style="color: #0000ff;"><span style="font-size: 11pt;">Get-DisksSpace</span></span></span><span style="line-height: 13pt; mso-bidi-font-size: 12.0pt; mso-bidi-font-family: &amp;amp;amp;"><span style="font-size: 11pt;"><span style="color: #000000;"> </span><span><span style="color: #8b0000;">&#8220;Win7NetBook&#8221;</span></span><span style="color: #000000;"> </span><span><span style="color: #a9a9a9;">|</span></span><span style="color: #000000;"> </span><span><span style="color: #0000ff;">where</span></span><span><span style="color: #000000;">{</span></span><span><span style="color: #ff4500;">$_</span></span><span><span style="color: #a9a9a9;">.</span></span><span style="color: #000000;"><span>PercentFree</span> </span><span><span style="color: #a9a9a9;">-lt</span></span><span style="color: #000000;"> </span><span><span style="color: #800080;">20</span></span><span style="color: #000000;"><span>}</span> </span><span><span style="color: #a9a9a9;">|</span></span><span style="color: #000000;"> </span></span><span><span style="color: #0000ff; font-size: 11pt;">Format-Table</span></span></span></span></p>
<p>This will return you the list of drives and mount points on the machine you listed and default the unit of measure to convert the results to gigabytes.  The great news is that this code runs really fast.  Their conversation yesterday literally saved me hours of work.  I’ll keep working with this and post another blog when I put the monitoring portion into production.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/11/quick-blog-powershell-disk-and-mountpoint-check/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Finding SQL Servers with PowerShell Part 2</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/11/finding-sql-servers-with-powershell-part-2/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/11/finding-sql-servers-with-powershell-part-2/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 15:35:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1539</guid>
		<description><![CDATA[Can’t believe it’s taken me this long to get back to this series but man life has been busy! There are at least two other ways (and maybe even 3) that I want to show you for finding SQL Servers on your network. This next way is very similar the my first post but the results are a bit nicer because it actually puts the server and instance name together in a column called Name. For people just starting out with PowerShell this one difference is reason enough to use this method over the other This is [one of] the same method[s] that Mladen Prajdić ( blog &#124; twitter ) uses in SSMS Tools Pack to find SQL Servers. Mladen was nice enough to send me the C# code that he uses and patient enough to explain to me what the heck to do with C# code! As luck would have it he was using the same method that I had found just a few days earlier. After I was finally able to translate it to PowerShell I was elated to find Mladen’s C# code and my PowerShell code returned the exact same list of instances in my environment. I changed the table around a little to accommodate the extra column from the function and also columns to track the method used and the date-time the discovery was made: CREATE TABLE FoundSQLServers ( Name VARCHAR(128), ServerName VARCHAR(128), InstanceName VARCHAR(128), IsClustered VARCHAR(5), VersionNumber VARCHAR(64), DiscoveryMethod VARCHAR(10), DiscoveryOccured datetime2 ) Beyond just the function being a little different I changed the output so that this time we’re inserting directly into a table in the database instead of diverting to CSV first. Fire up your favorite PowerShell editor and run this: $SQL = [Microsoft.SqlServer.Management.Smo.SmoApplication]::EnumAvailableSqlServers() &#124; ` foreach { invoke-sqlcmd -query "INSERT INTO dbo.FoundSQLServers VALUES ('$($_.Name)', '$($_.Server)' ` , '$($_.Instance)', '$($_.IsClustered)', '$($_.Version)', 'EnumAvail', SYSDATETIMEOFFSET())" ` -database SandBox -serverinstance "Win7NetBook" } Now, you may or may not have received an error message with that last command and it completely depends on your setup but that’s a discussion for another post. For today we’ll just say that if you got this error message: Unable to find type [Microsoft.SqlServer.Management.Smo.SmoApplication]: make sure that the assembly containing this type is loaded.Then all that you’ll need to do is load this Assembly first (once, at the beginning of your PowerShell session) and you’ll be good to go. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") &#124; out-null Back to that table… You’ll notice that the table doesn’t have a primary key and that’s because I’ve left that up to you. I use a table similar to this just to dump my results; I don’t use this as my master list or anything like that. I query this table to see what has shown up recently that I didn’t know about but I use a different table to sort instances between Prod/QA/UAT/Dev and what-not. SELECT [Name] ,[ServerName] FROM [dbo].[FoundSQLServers] GROUP BY [Name] ,[ServerName] ORDER BY [Name] There you have it, not just a different way to find SQL Servers but also a nice comparison between outputting to a CSV file and outputting straight to a table inside of SQL Server. There are some drawbacks to this method that I want to make sure to call out: 1) I’ve never seen it work over a VPN connection so make sure to RDP into another machine and run it from there. 2) This method is no good at crossing domains so you’d have to RDP into a machine on the other domain for that too. 3) Anytime the Version column isn’t populated you can expect the IsClustered column to be wrong. Hopefully the next method (or two) won’t take me as long to get posted]]></description>
			<content:encoded><![CDATA[<p><img style="display: inline; float: right;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/04/PoSh.png" alt="" align="right" />Can’t believe it’s taken me this long to get back to this series but man life has been <span style="text-decoration: underline;">busy</span>!  There are at least two other ways (and maybe even 3) that I want to show you for finding SQL Servers on your network.  This next way is <span style="text-decoration: underline;">very</span> similar the my <a href="http://bit.ly/8Xg1Qf">first post</a> but the results are a bit nicer because it actually puts the server and instance name together in a column called Name.  For people just starting out with PowerShell this one difference is reason enough to use this method over the other <img style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/wlEmoticon-smile2.png" alt="Smile" class="wlEmoticon wlEmoticon-smile" /></p>
<p>This is [one of] the same method[s] that Mladen Prajdić ( <a href="http://weblogs.sqlteam.com/mladenp/default.aspx">blog</a> | <a href="http://twitter.com/MladenPrajdic">twitter</a> ) uses in <a href="http://www.ssmstoolspack.com/">SSMS Tools Pack</a> to find SQL Servers.  Mladen was nice enough to send me the C# code that he uses and patient enough to explain to me what the heck to do with C# code!  As luck would have it he was using the same method that I had found just a few days earlier.  After I was finally able to translate it to PowerShell I was elated to find Mladen’s C# code and my PowerShell code returned the exact same list of instances in my environment.</p>
<p>I changed the table around a little to accommodate the extra column from the function and also columns to track the method used and the date-time the discovery was made:</p>
<p><code style="line-height: normal;"><span style="font-family: courier new;"><span><span style="color: #0000ff;"><span style="font-size: 9pt;">CREATE TABLE </span></span></span><span style="font-size: 9pt;"><span><span style="color: #000000;">FoundSQLServers </span></span></span></span><span style="font-size: 9pt;"><span style="font-family: courier new;"><span><span style="color: #808080;">(</span><br />
</span><span><span style="color: #000000;">Name </span></span><span><span style="color: #0000ff;">VARCHAR</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #000000;">128</span></span></span><span style="font-family: courier new;"><span><span style="color: #808080;">),</span><br />
</span><span><span style="color: #000000;">ServerName </span></span><span><span style="color: #0000ff;">VARCHAR</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #000000;">128</span></span></span><span style="font-family: courier new;"><span><span style="color: #808080;">),</span><br />
</span><span><span style="color: #000000;">InstanceName </span></span><span><span style="color: #0000ff;">VARCHAR</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #000000;">128</span></span></span><span style="font-family: courier new;"><span><span style="color: #808080;">),</span><br />
</span><span><span style="color: #000000;">IsClustered </span></span><span><span style="color: #0000ff;">VARCHAR</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #000000;">5</span></span></span><span style="font-family: courier new;"><span><span style="color: #808080;">),</span><br />
</span><span><span style="color: #000000;">VersionNumber </span></span><span><span style="color: #0000ff;">VARCHAR</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #000000;">64</span></span></span><span style="font-family: courier new;"><span><span style="color: #808080;">),</span><br />
</span><span><span style="color: #000000;">DiscoveryMethod </span></span><span><span style="color: #0000ff;">VARCHAR</span></span><span><span style="color: #808080;">(</span></span><span><span style="color: #000000;">10</span></span></span><span><span style="font-family: courier new;"><span style="color: #808080;">),</span><br />
</span></span></span><span style="font-family: courier new;"><span style="font-size: 9pt;"><span><span style="color: #000000;">DiscoveryOccured   datetime2</span><br />
</span></span><span><span style="color: #808080; font-size: 9pt;">)</span></span></span></code><span style="font-family: times new roman;"><span style="color: #000000; font-size: 12pt;"> </span></span></p>
<p>Beyond just the function being a little different I changed the output so that this time we’re inserting directly into a table in the database instead of diverting to CSV first.  Fire up your favorite PowerShell editor and run this:</p>
<pre style="width: 561px; height: 149px;" class="PowerShellColorizedScript"><span style="color: #ff4500;">$SQL</span> <span style="color: #a9a9a9;">=</span> <span style="color: #008080;">[Microsoft.SqlServer.Management.Smo.SmoApplication]</span><span style="color: #a9a9a9;">::</span><span style="color: #000000;">EnumAvailableSqlServers</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #a9a9a9;">|</span> <span style="color: #000000;">`
</span><span style="color: #0000ff;">foreach</span> <span style="color: #000000;">{</span>
<span style="color: #0000ff;">invoke-sqlcmd</span> <span style="color: #000080;">-query</span> <span style="color: #8b0000;">"INSERT INTO dbo.FoundSQLServers VALUES ('$($_.Name)', '$($_.Server)' `
, '$($_.Instance)', '$($_.IsClustered)', '$($_.Version)', 'EnumAvail', SYSDATETIMEOFFSET())"</span> <span style="color: #000000;">`
</span> <span style="color: #000080;">-database</span> <span style="color: #8a2be2;">SandBox</span> <span style="color: #000080;">-serverinstance</span> <span style="color: #8b0000;">"Win7NetBook"</span>

        <span style="color: #000000;">}</span></pre>
<p>Now, you <strong>may</strong> or <strong>may not</strong> have received an error message with that last command and it completely depends on your setup but that’s a discussion for another post.  For today we’ll just say that if you got this error message:</p>
<p><span style="color: #ff0000;">Unable to find type [Microsoft.SqlServer.Management.Smo.SmoApplication]: make sure that the assembly containing this type is loaded.</span>Then all that you’ll need to do is <strong>load this Assembly first</strong> (once, at the beginning of your PowerShell session) and you’ll be good to go.</p>
<pre style="width: 539px; height: 51px;" class="PowerShellColorizedScript"><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></pre>
<p>Back to that table…  You’ll notice that the table doesn’t have a primary key and that’s because I’ve left that up to you.  I use a table similar to this just to dump my results; I don’t use this as my master list or anything like that.  I query this table to see what has shown up recently that I didn’t know about but I use a different table to sort instances between Prod/QA/UAT/Dev and what-not.</p>
<p><code style="font-size: 12px;"><span style="color: blue;">SELECT </span><span style="color: black;">[Name]<br />
</span><span style="color: gray;">,</span><span style="color: black;">[ServerName]<br />
</span><span style="color: blue;">FROM </span><span style="color: black;">[dbo].[FoundSQLServers]<br />
</span><span style="color: blue;">GROUP BY </span><span style="color: black;">[Name]<br />
</span><span style="color: gray;">,</span><span style="color: black;">[ServerName]<br />
</span><span style="color: blue;">ORDER BY </span><span style="color: black;">[Name]</span></code></p>
<p>There you have it, not just a different way to find SQL Servers but also a nice comparison between outputting to a CSV file and outputting straight to a table inside of SQL Server.</p>
<p>There are some drawbacks to this method that I want to make sure to call out: 1) I’ve never seen it work over a VPN connection so make sure to RDP into another machine and run it from there.  2) This method is no good at crossing domains so you’d have to RDP into a machine on the other domain for that too.  3) Anytime the Version column isn’t populated you can expect the IsClustered column to be wrong.</p>
<p>Hopefully the next method (or two) won’t take me as long to get posted <img style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/wlEmoticon-smile2.png" alt="Smile" class="wlEmoticon wlEmoticon-smile" /></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/11/finding-sql-servers-with-powershell-part-2/feed/</wfw:commentRss>
		<slash:comments>0</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>Atlanta PowerShell User Group &#8211; November Meeting</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/11/atlanta-powershell-user-group-november-meeting/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/11/atlanta-powershell-user-group-november-meeting/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 14:55:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Atlanta]]></category>
		<category><![CDATA[Free Training]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1662</guid>
		<description><![CDATA[This month is a special meeting as the Atlanta PowerShell User Group and the Virtual PowerShell User Group are joining forces to bring you Ed Wilson, the Scripting Guy.&#160; He will be joining us to give his presentation on PowerShell Best Practices. Please register so we know how much pizza to order.&#160; Orrrrr, don’t complain when we run out of pizza again.&#160; When: Tuesday, November 16, 2010 from 6:00 PM &#8211; 8:30 PM (ET) Agenda: 6:00pm: Networking, free pizza and soft drinks, and open discussions. 6:30pm: User Group News and Information &#8211; Mark Schill 6:45pm: PowerShell Best Practices &#8211; Ed Wilson Where: New Horizons Atlanta 211 Perimeter Center Parkway Suite 200 Atlanta, GA 30346 Speaker Bio: Ed Wilson is one of the Microsoft Scripting Guys and a well-known scripting expert.&#160; He is a Microsoft-certified trainer who has delivered a popular Windows PowerShell workshop to Microsoft Premier Customers worldwide.&#160; He has written 8 books including 5 on Windows scripting, including: Windows PowerShell Scripting Guide, and Microsoft Windows PowerShell Step by Step both published by Microsoft Press. He has also contributed to nearly a dozen other books, and is currently working on a PowerShell Best Practices book.&#160; Ed holds more than 20 industry certifications, including Microsoft Certified Systems Engineer (MCSE) and Certified Information Systems Security Professional (CISSP).&#160; Prior to coming to work for Microsoft he was a senior consultant for a Microsoft Gold Certified Partner where he specialized in Active Directory design and Exchange implementation. In his spare time he enjoys woodworking, underwater photography, and scuba diving. Live Meeting URL for remote participants: https://www.livemeeting.com/cc/UserGroups/join?id=8RFF4R&#38;role=attend&#38;pw=dDs%405B%21-X Atlanta PowerShell User Group: To receive the latest news and updates from the user group, sign up for the ATLPUG Mailing List at http://powershellgroup.org/content/atlanta-powershell-user-group-mailing-list.]]></description>
			<content:encoded><![CDATA[<p><img style="display: inline; float: right" alt="Atlanta &amp; Virtual PowerShell User Group - November Meeting" align="right" src="http://evbdn.eventbrite.com/s3-s3/eventlogos/1060939/972012315-1.png" />This month is a special meeting as the Atlanta PowerShell User Group and the Virtual PowerShell User Group are joining forces to bring you <b>Ed Wilson, the Scripting Guy</b>.&#160; He will be joining us to give his presentation on <b>PowerShell Best Practices</b>. </p>
<p>Please <a href="http://atlpugnov.eventbrite.com/">register</a> so we know how much pizza to order.&#160; Orrrrr, don’t complain when we run out of pizza again.&#160; </p>
<p><b>When:      <br />Tuesday, November 16, 2010 from 6:00 PM &#8211; 8:30 PM (ET) </b></p>
<p><b>Agenda:</b>     <br />6:00pm: Networking, <b>free pizza and soft drinks</b>, and open discussions.     <br />6:30pm: User Group News and Information &#8211; Mark Schill     <br />6:45pm: PowerShell Best Practices &#8211; Ed Wilson</p>
<p><b>Where:      <br /></b><b><a href="http://www.bing.com/maps/explore/?org=aj#5003/0.6002=q:New+Horizons+Atlanta,+211+Perimeter+Center+Parkway+Atlanta,+GA+30346:nelat:47.7105436508957:nelong:-122.098600462867:swlat:47.4894563491043:swlong:-122.561399535133:nosp:0:adj:0:cs:1/5872/style=auto&amp;lat=33.925501&amp;lon=-84.345319&amp;z=16&amp;pid=5874">New Horizons Atlanta</a>       <br /><a href="http://www.bing.com/maps/explore/?org=aj#5003/0.6002=q:New+Horizons+Atlanta,+211+Perimeter+Center+Parkway+Atlanta,+GA+30346:nelat:47.7105436508957:nelong:-122.098600462867:swlat:47.4894563491043:swlong:-122.561399535133:nosp:0:adj:0:cs:1/5872/style=auto&amp;lat=33.925501&amp;lon=-84.345319&amp;z=16&amp;pid=5874">211 Perimeter Center Parkway</a>       <br /><a href="http://www.bing.com/maps/explore/?org=aj#5003/0.6002=q:New+Horizons+Atlanta,+211+Perimeter+Center+Parkway+Atlanta,+GA+30346:nelat:47.7105436508957:nelong:-122.098600462867:swlat:47.4894563491043:swlong:-122.561399535133:nosp:0:adj:0:cs:1/5872/style=auto&amp;lat=33.925501&amp;lon=-84.345319&amp;z=16&amp;pid=5874">Suite 200</a>       <br /><a href="http://www.bing.com/maps/explore/?org=aj#5003/0.6002=q:New+Horizons+Atlanta,+211+Perimeter+Center+Parkway+Atlanta,+GA+30346:nelat:47.7105436508957:nelong:-122.098600462867:swlat:47.4894563491043:swlong:-122.561399535133:nosp:0:adj:0:cs:1/5872/style=auto&amp;lat=33.925501&amp;lon=-84.345319&amp;z=16&amp;pid=5874">Atlanta, GA 30346</a></b><b></b></p>
<p><b>Speaker Bio:</b></p>
<p>Ed Wilson is one of the Microsoft Scripting Guys and a well-known scripting expert.&#160; He is a Microsoft-certified trainer who has delivered a popular Windows PowerShell workshop to Microsoft Premier Customers worldwide.&#160; He has written 8 books including 5 on Windows scripting, including: Windows PowerShell Scripting Guide, and Microsoft Windows PowerShell Step by Step both published by Microsoft Press.</p>
<p>He has also contributed to nearly a dozen other books, and is currently working on a PowerShell Best Practices book.&#160; Ed holds more than 20 industry certifications, including Microsoft Certified Systems Engineer (MCSE) and Certified Information Systems Security Professional (CISSP).&#160; Prior to coming to work for Microsoft he was a senior consultant for a Microsoft Gold Certified Partner where he specialized in Active Directory design and Exchange implementation.</p>
<p>In his spare time he enjoys woodworking, underwater photography, and scuba diving.</p>
<p><b>Live Meeting URL for remote participants:</b> <a href="https://www.livemeeting.com/cc/UserGroups/join?id=8RFF4R&amp;role=attend&amp;pw=dDs%405B%21-X">https://www.livemeeting.com/cc/UserGroups/join?id=8RFF4R&amp;role=attend&amp;pw=dDs%405B%21-X</a></p>
<p><b>Atlanta PowerShell User Group</b>: To receive the latest news and updates from the user group, sign up for the ATLPUG Mailing List at <a href="http://powershellgroup.org/content/atlanta-powershell-user-group-mailing-list">http://powershellgroup.org/content/atlanta-powershell-user-group-mailing-list</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/11/atlanta-powershell-user-group-november-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speaking at the PASS Summit Today</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/11/speaking-at-the-pass-summit-today/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/11/speaking-at-the-pass-summit-today/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 22:49:30 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PASS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[PASS Summit 2010]]></category>
		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/11/speaking-at-the-pass-summit-today/</guid>
		<description><![CDATA[I’ll be speaking at the PASS Summit at 3pm today in room 2AB. Due to the size and shape of the room I&#8217;ll be using a different slide deck than I uploaded to the PASS website a few weeks ago so I wanted to make sure that was available to everyone. I also wanted to go ahead and post the scripts that I’m planning on using so that people can follow along if they want.]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/IMG00373-20101109-0818.jpg"><img title="IMG00373-20101109-0818" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/IMG00373-20101109-0818_thumb.jpg" border="0" alt="IMG00373-20101109-0818" width="244" height="184" /></a>I’ll be speaking at the PASS Summit at 3pm today in room 2AB.  Due to the size and shape of the room I&#8217;ll be using a <a href="http://bit.ly/b9F45U">different slide deck</a> than I uploaded to the PASS website a few weeks ago so I wanted to make sure that was available to everyone.  I also wanted to go ahead and post the <a href="http://bit.ly/daOSM2">scripts</a> that I’m planning on using so that people can follow along if they want.</p>
<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/IMG00372-20101109-0817.jpg"><img title="IMG00372-20101109-0817" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/11/IMG00372-20101109-0817_thumb.jpg" border="0" alt="IMG00372-20101109-0817" width="244" height="184" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/11/speaking-at-the-pass-summit-today/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>Please Vote if You are Going to SQLRally</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/11/please-vote-if-you-are-going-to-sqlrally/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/11/please-vote-if-you-are-going-to-sqlrally/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 20:53:42 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[SQLRally]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/11/please-vote-if-you-are-going-to-sqlrally/</guid>
		<description><![CDATA[A few weeks back quite a few people asked me if I was going to be submitting a pre-con session on PowerShell for SQLRally.&#160; I hadn’t planned on submitting one but so many people asked me about it that I decided to go ahead and come up with one.&#160; My session is a half-day session and has been paired with another PowerShell session by PowerShell MVP Max Trinidad ( blog &#124; twitter ). You can read about the options here and if you’d like to go the the sessions that Max and I are putting together please vote for them here.&#160; Please only cast your vote for which ones you&#8217;d be willing to pay up to $199 to attend.&#160; Voting is open until 8 AM PST November 2, 2011. The winning sessions will be announced at the 2010 PASS Summit in two weeks. The details about my session are in the link but in short I plan to take Data Professionals from knowing nothing about PowerShell to being able to use it to simplify their lives in just 4 hours.&#160; I will go over a few techniques that I use and then I will be showing a lot of different code examples.&#160; If you’ve never worked with PowerShell before I’m sure you’ll be blown away by how little code is needed to build most of these practical everyday examples.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sqlpass.org/sqlrally/2011/"><img style="display: inline; float: right" title="SQLRally Logo" border="0" alt="SQLRally Logo" align="right" src="http://lh4.ggpht.com/_nNmzpgOs8Bg/TMb4733iwSI/AAAAAAAABtc/8ruE1gsT_sg/SQLRally%20Winner%5B12%5D.gif?imgmax=800" width="240" height="93" /></a>A few weeks back quite a few people asked me if I was going to be submitting a pre-con session on PowerShell for <a href="http://www.sqlpass.org/sqlrally/2011/">SQLRally</a>.&#160; I hadn’t planned on submitting one but so many people asked me about it that I decided to go ahead and come up with one.&#160; My session is a half-day session and has been paired with another <a href="http://www.maxtblog.com/index.php/2010/10/sqlrallymy-pre-conference-session-sql-powershell-for-the-dba/">PowerShell session</a> by PowerShell MVP <strong>Max Trinidad</strong> ( <a href="http://www.maxtblog.com/">blog</a> | <a href="http://twitter.com/MaxTrinidad">twitter</a> ).</p>
<p>You can read about the options <a href="http://www.sqlpass.org/sqlrally/2011/PreConsforVotingDba.aspx">here</a> and if you’d like to go the the sessions that Max and I are putting together please vote for them <a href="http://www.zoomerang.com/Survey/WEB22BD59JCQBT">here</a>.&#160; Please only cast your vote for which ones you&#8217;d be willing to pay up to $199 to attend.&#160; Voting is open until 8 AM PST November 2, 2011. The winning sessions will be announced at the <a href="http://www.sqlpass.org/summit/na2010/">2010 PASS Summit</a> in two weeks.</p>
<p>The details about my session are in the <a href="http://www.sqlpass.org/sqlrally/2011/PreConsforVotingDba.aspx">link</a> but in short I plan to take Data Professionals from knowing nothing about PowerShell to being able to use it to simplify their lives in just 4 hours.&#160; I will go over a few techniques that I use and then I will be showing a lot of different code examples.&#160; If you’ve never worked with PowerShell before I’m sure you’ll be blown away by how little code is needed to build most of these practical everyday examples.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/11/please-vote-if-you-are-going-to-sqlrally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mid October Free Training from PASS Virtual Chapters</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/10/mid-october-free-training-from-pass-virtual-chapters/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/10/mid-october-free-training-from-pass-virtual-chapters/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 14:10:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[BI]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Free Training]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1550</guid>
		<description><![CDATA[Introduction to PowerShell Getting started with Steam Insight and Complex Event Processing Applications Using Microsoft BI Tools to Access Oracle Applications Data _____________________________________________________________ Introduction to PowerShell Wednesday October 20th 12 pm EDT (GMT-4) Chad Miller Chad will get us started with an introduction to PowerShell as a command line for one-off tasks or automation in the DBA world. Basic PS principles and syntax will be covered. Get your proverbial DBA feet wet with a tool that can make your database and sysadmin life better than it was before! Bigger, stronger, faster. (Cue Bionic Man theme) Chad Miller Chad hails from the land of rocket launches, oranges, and alligators where he started the Tampa PowerShell User Group. Chad is the DBA for SQL Server and Manager of Database Administration for a shop supporting SQL Server, Oracle, and Informix, acts as coordinator for the SQL Server PowerShell Extensions CodePlex project, and maintains an active blog at http://sev17.com/author/chad-miller/ . How do I attend? Registration for the event is now open. *When you register you’ll get a calendar reminder for the event. _____________________________________________________________ Getting started with Steam Insight and Complex Event Processing Applications Wednesday October 20th 12 pm EDT (GMT-4) Chris Coneybeer Today we find our systems and users need to be able to quickly collect, analyze, and act upon data that is being streamed from an unlimited number of devices or systems in our enterprises. Frequently, this raw data is being collected from many different sources such as sensors on production lines, usage events from a website, or even just consumption data from a power meter. Generally this raw data goes through a time consuming process of collection, aggregation, and then querying before it can be used for business process decisions. SteamInsight is a new platform included with SQL Server 2008 R2 that is used to build Complex Event Processing (CEP) applications that are used to monitor these raw data streams. Using StreamInisght your applications will have the ability to analyze, correlate, and use the data contained in streams while it is in-flight. This is done by creating adapters that are responsible for monitoring streams and then writing queries against the adapters. During this session we will discuss what StreamInsight is, what stories it addresses in system architectures, and then we will look at some examples of using the Stream Insight platform and getting started with your own queries. Chris Coneybeer Chris is a C#/SQL developer with over 10 years of development experience working with Microsoft stack. Currently Chris works as an independent developer for small business and working in the banking industry as a contractor. Since his move the Phoenix area Chris has discovered the value and rich experience that community provides by sharing ideas and having open discussions. Chris enjoys working on connected systems and finding ways to leverage data for technology workers. During the years he has worked with VB6, VB.NET, C#.NET, ASP/ASP.NET, AJAX, XML, WCF, SSRS, SSIS, T-SQL, and other assorted technologies. His current interests include WCF, EF and WF improvements in the 4.0 framework along with SQL2008R2. Chris is the Vice-President of the Southeast Valley .NET User Group (SEVDNUG) in Chandler Arizona which supports local .NET developers through regular meetings and events. Recently he also gotten more involved with the Phoenix Connected Systems User Group(PCSUG) as Membership Director and is working with the leadership to grow the reach of the group. How do I attend? Live Meeting link _____________________________________________________________ Using Microsoft BI Tools to Access Oracle Applications Data Wednesday October 20th 12 pm EDT (GMT-4)&#160; Daryl Orts One of the challenges in using Microsoft’s BI tools (Reporting Services, Analysis Services, Excel, PowerPivot) to access Oracle applications data lies in building metadata models to make sense of the data.&#160; Whether you’re accessing the data directly in the transaction database or building a data warehouse, you’ll need data models that make sense of the Oracle database schema. This beginner to intermediate level presentation will discuss design approaches for building these models, including commercial products available from the presenter,&#160; Noetix Corporation How do I attend? Live Meeting link]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sqlpass.org/Community/VirtualChapters.aspx"><img title="pass_logo" border="0" alt="pass_logo" align="right" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/07/pass_logo_thumb.gif" width="83" height="64" /></a><strong>Introduction to PowerShell</strong>     <br /><b>Getting started with Steam Insight and Complex Event Processing Applications      <br /></b><strong><b>Using Microsoft BI Tools to Access Oracle Applications Data</b></strong><strong>      <br /></strong>_____________________________________________________________</p>
<p><strong><a href="http://powershell.sqlpass.org/">Introduction to PowerShell</a>       <br /><strong>Wednesday October 20th 12 pm EDT (GMT-4) </strong>      <br /></strong><strong>Chad Miller      <br /></strong></p>
<p>Chad will get us started with an introduction to PowerShell as a command line for one-off tasks or automation in the DBA world. Basic PS principles and syntax will be covered. Get your proverbial DBA feet wet with a tool that can make your database and sysadmin life better than it was before! Bigger, stronger, faster. (Cue Bionic Man theme)</p>
<p><strong>Chad Miller      <br /></strong>Chad hails from the land of rocket launches, oranges, and alligators where he started the Tampa PowerShell User Group. Chad is the DBA for SQL Server and Manager of Database Administration for a shop supporting SQL Server, Oracle, and Informix, acts as coordinator for the SQL Server PowerShell Extensions CodePlex project, and maintains an active blog at <a href="http://sev17.com/author/chad-miller/">http://sev17.com/author/chad-miller/</a> .</p>
<p><strong>How do I attend?</strong> <a href="https://www.livemeeting.com/lrs/8000181573/Registration.aspx?PageName=dx5snq956p1jp21w">Registration for the event is now open</a>.     <br />*When you register you’ll get a calendar reminder for the event.     <br />_____________________________________________________________</p>
<p><b><a href="http://bi.sqlpass.org/">Getting started with Steam Insight and Complex Event Processing Applications</a>       <br /></b><strong>Wednesday October 20th 12 pm EDT (GMT-4) </strong><b>     <br /><b>Chris Coneybeer</b></b></p>
<p>Today we find our systems and users need to be able to quickly collect, analyze, and act upon data that is being streamed from an unlimited number of devices or systems in our enterprises. Frequently, this raw data is being collected from many different sources such as sensors on production lines, usage events from a website, or even just consumption data from a power meter. Generally this raw data goes through a time consuming process of collection, aggregation, and then querying before it can be used for business process decisions. SteamInsight is a new platform included with SQL Server 2008 R2 that is used to build Complex Event Processing (CEP) applications that are used to monitor these raw data streams. Using StreamInisght your applications will have the ability to analyze, correlate, and use the data contained in streams while it is in-flight. This is done by creating adapters that are responsible for monitoring streams and then writing queries against the adapters. During this session we will discuss what StreamInsight is, what stories it addresses in system architectures, and then we will look at some examples of using the Stream Insight platform and getting started with your own queries. </p>
<p><b>Chris Coneybeer      <br /></b>Chris is a C#/SQL developer with over 10 years of development experience working with Microsoft stack. Currently Chris works as an independent developer for small business and working in the banking industry as a contractor. Since his move the Phoenix area Chris has discovered the value and rich experience that community provides by sharing ideas and having open discussions. Chris enjoys working on connected systems and finding ways to leverage data for technology workers. During the years he has worked with VB6, VB.NET, C#.NET, ASP/ASP.NET, AJAX, XML, WCF, SSRS, SSIS, T-SQL, and other assorted technologies. His current interests include WCF, EF and WF improvements in the 4.0 framework along with SQL2008R2. Chris is the Vice-President of the Southeast Valley .NET User Group (SEVDNUG) in Chandler Arizona which supports local .NET developers through regular meetings and events. Recently he also gotten more involved with the Phoenix Connected Systems User Group(PCSUG) as Membership Director and is working with the leadership to grow the reach of the group.</p>
<p><strong>How do I attend?</strong> <a href="https://www.livemeeting.com/cc/usergroups/join?id=5MKRZM&amp;role=attend&amp;pw=nx%7Bx4Q5GH">Live Meeting link</a></p>
<p>_____________________________________________________________</p>
<p> <strong><a href="http://oracle.sqlpass.org/">Using Microsoft BI Tools to Access Oracle Applications Data</a>     <br />Wednesday October 20th 12 pm EDT (GMT-4)&#160; <br /></strong>
<p><strong>Daryl Orts</strong></p>
<p>One of the challenges in using Microsoft’s BI tools (Reporting Services, Analysis Services, Excel, PowerPivot) to access Oracle applications data lies in building metadata models to make sense of the data.&#160; Whether you’re accessing the data directly in the transaction database or building a data warehouse, you’ll need data models that make sense of the Oracle database schema. </p>
<p>This beginner to intermediate level presentation will discuss design approaches for building these models, including commercial products available from the presenter,&#160; Noetix Corporation</p>
<p> <strong>How do I attend? </strong><a href="https://www.livemeeting.com/cc/UserGroups/join?id=RP8Z2T&amp;role=attend">Live Meeting link</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/10/mid-october-free-training-from-pass-virtual-chapters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Atlanta PowerShell Group &#8211; October Meeting</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/10/atlanta-powershell-group-october-meeting/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/10/atlanta-powershell-group-october-meeting/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 14:20:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Atlanta]]></category>
		<category><![CDATA[Creating GUIs]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1568</guid>
		<description><![CDATA[After a short summer break we’re glad to get back to business with PowerShell.  We’re very excited to have Mark Mitchell ( blog &#124; twitter ) dropping by to show us how to create GUIs with PowerShell Date: 10/19/2010 (Tuesday) 6:00pm EDT (GMT-4) Location: New Horizons Atlanta 211 Perimeter Center Parkway Suite 200 Atlanta, GA 30346 Phone: (770) 270-2000 Agenda: 6:00pm: Introductions and Opening Remarks and free pizza and soft drinks. 6:15pm: Creating PowerShell Graphical Interfaces – Mark Mitchell 7:15pm: Script Club 7:45pm: Giveaway: Multiple copies of Lee Holme&#8217;s &#8220;Windows PowerShell Cookbook&#8221; Speaker Bio: Mark Mitchell has been working in IT for 30 years. He has worked about half his career time as an independent consultant, and the rest in the employment of companies. Mark has built or supported applications ranging from Finance, Mortgage Banking, HR, Transportation, Billing, Manufacturing, Project Management, and Sales Order systems; Running on Mainframe, Unix, and Windows platforms.  Mark has worked with and designed Databases from Network(IDMS), hierarchical(IMS), and Relational(Oracle,SQL Server). Compiled languages of Cobol,Pascal/Delphi,VB,C/C++,ABAP(SAP),Java,C#. For Y2K, Mark rewrote a dBase shopfloor management application as an ASP web based application using a SQL Server backend. Mark Mitchell’s Scripting history: 1981 scripting mainframe editors (Wylbur, TSO/SPF-Clists ,VM/CMS) 1984 Dos batch scripts 1996 Unix bash scripting with SED and AWK. 1998 VBScript and Windows Scripting Host 2000 CScript, and Perl 2005 AutoIt 2008 came across PowerShell In January 2009, volunteered to learn enough about PowerShell to do a presentation for the Microsoft Professionals group, And then promptly found an Atlanta PowerShell MVP &#8211; Hal Rottenburg ( blog &#124; twitter ) to do it – in January 2010. Mark Mitchell has been active in the Microsoft developer community in Atlanta attending meetings of Microsoft Atlanta Professionals, Atlanta MDF(SQL Server), Atlanta SharePoint User Group, Atlanta .Net User group, and Atlanta PowerShell User Group. He has attended the SQL Saturday, SharePoint Saturday, CodeStock, Devlink, Atlanta Code Camp, and ReMixAtlanta conferences. Mark has built 5 of his own desktop computers over the last 10 years, and one of those computers that has never been connected to the internet – dedicated entirely to music composition and recording, with terabytes of sound libraries. Mark plays Keyboards,Guitar,Bass,flute,violin, and has sung in choirs. He is also a semi-professional photographer.   Live Meeting: http://www.livemeeting.com/cc/UserGroups/join?id=JGK9RJ&#38;role=attend&#38;pw=gh%3D*258FbRegistration: http://www.powershellgroup.org/atlanta.ga]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/10/PoSh.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="PoSh" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/10/PoSh_thumb.png" border="0" alt="PoSh" width="132" height="105" align="right" /></a>After a short summer break we’re glad to get back to business with PowerShell.  We’re very excited to have Mark Mitchell ( <a href="http://designandcode.net/">blog</a> | <a href="http://twitter.com/mitchellm44">twitter</a> ) dropping by to show us how to create GUIs with PowerShell <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/10/wlEmoticon-smile1.png" alt="Smile" /></p>
<p><strong>Date: </strong>10/19/2010 (<strong><span style="color: #0000ff;">Tuesday</span></strong>)<span style="color: #0000ff;"> 6:00pm</span> EDT (GMT-4)</p>
<p><strong>Location:</strong><br />
New Horizons Atlanta<br />
<strong><span style="color: #0000ff;">211 Perimeter Center Parkway Suite 200<br />
Atlanta, GA 30346</span><br />
Phone:</strong> (770) 270-2000</p>
<p><strong>Agenda:</strong><br />
6:00pm: Introductions and Opening Remarks and <strong>free pizza and soft drinks.</strong><br />
6:15pm: <strong>Creating PowerShell Graphical Interfaces</strong> – Mark Mitchell<br />
7:15pm: Script Club<br />
7:45pm: Giveaway: <strong>Multiple copies of Lee Holme&#8217;s &#8220;Windows PowerShell Cookbook&#8221;</strong></p>
<p><strong>Speaker Bio:</strong></p>
<div id="scid:84E294D0-71C9-4bd0-A0FE-95764E0368D9:7459cd14-d105-4c30-8227-eca1215981f9" class="wlWriterEditableSmartContent" style="margin: 0px; display: inline; float: right; padding: 0px;"><a id="map-de41c6b4-eec8-4b7c-8d89-71de6186eaca" title="View map" href="http://www.bing.com/maps/default.aspx?v=2&amp;cp=33.9247~-84.34547&amp;lvl=13&amp;style=r&amp;sp=aN.33.92413_-84.34655_PoSh_&amp;mkt=en-us&amp;FORM=LLWR"><img src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/10/map-53d923bfb6ea.jpg" alt="Map picture" width="320" height="240" /></a></div>
<p>Mark Mitchell has been working in IT for 30 years. He has worked about half his career time as an independent consultant, and the rest in the employment of companies. Mark has built or supported applications ranging from Finance, Mortgage Banking, HR, Transportation, Billing, Manufacturing, Project Management, and Sales Order systems; Running on Mainframe, Unix, and Windows platforms.  Mark has worked with and designed Databases from Network(IDMS), hierarchical(IMS), and Relational(Oracle,SQL Server). Compiled languages of Cobol,Pascal/Delphi,VB,C/C++,ABAP(SAP),Java,C#. For Y2K, Mark rewrote a dBase shopfloor management application as an ASP web based application using a SQL Server backend.</p>
<p>Mark Mitchell’s Scripting history:</p>
<ul>
<li>1981 scripting mainframe editors (Wylbur, TSO/SPF-Clists ,VM/CMS)</li>
<li>1984 Dos batch scripts</li>
<li>1996 Unix bash scripting with SED and AWK.</li>
<li>1998 VBScript and Windows Scripting Host</li>
<li>2000 CScript, and Perl</li>
<li>2005 AutoIt</li>
<li>2008 came across PowerShell</li>
</ul>
<p>In January 2009, volunteered to learn enough about PowerShell to do a presentation for the Microsoft Professionals group, And then promptly found an Atlanta PowerShell MVP &#8211; Hal Rottenburg ( <a href="http://halr9000.com/">blog</a> | <a href="http://twitter.com/halr9000">twitter</a> ) to do it – in January 2010.</p>
<p>Mark Mitchell has been active in the Microsoft developer community in Atlanta attending meetings of <a href="http://atlantamspros.com/default.aspx">Microsoft Atlanta Professionals</a>, <a href="http://www.atlantamdf.com/">Atlanta MDF(SQL Server)</a>, <a href="http://www.atlspug.com/default.aspx">Atlanta SharePoint User Group</a>, <a href="http://www.atldotnet.org/default.aspx">Atlanta .Net User group</a>, and <a href="http://powershellgroup.org/atlanta.ga">Atlanta PowerShell User Group</a>. He has attended the <a href="http://www.sqlsaturday.com/">SQL Saturday</a>, <a href="http://www.sharepointsaturday.org/default.aspx">SharePoint Saturday</a>, <a href="http://codestock.org/">CodeStock</a>, Devlink, Atlanta Code Camp, and ReMixAtlanta conferences.</p>
<p>Mark has built 5 of his own desktop computers over the last 10 years, and one of those computers that has never been connected to the internet – dedicated entirely to music composition and recording, with terabytes of sound libraries. Mark plays Keyboards,Guitar,Bass,flute,violin, and has sung in choirs. He is also a semi-professional photographer.</p>
<p><strong> </strong></p>
<p><strong>Live Meeting: <a href="http://www.livemeeting.com/cc/UserGroups/join?id=JGK9RJ&amp;role=attend&amp;pw=gh%3D*258Fb">http://www.livemeeting.com/cc/UserGroups/join?id=JGK9RJ&amp;role=attend&amp;pw=gh%3D*258Fb</a></strong><strong>Registration:</strong> <a href="http://www.powershellgroup.org/atlanta.ga">http://www.powershellgroup.org/atlanta.ga</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/10/atlanta-powershell-group-october-meeting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;ll Be Speaking at SQL Saturday #49 in Orlando</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/10/ill-be-speaking-at-sql-saturday-49-in-orlando/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/10/ill-be-speaking-at-sql-saturday-49-in-orlando/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 14:15:00 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Saturday]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/10/ill-be-speaking-at-sql-saturday-49-in-orlando/</guid>
		<description><![CDATA[We’ve worked with the organizers of SQL Saturday #49 to be able to bring you a full day line up of PowerShell but it get’s even better.&#160; In addition to myself and the usual Florida crew of PowerShell-for-SQL speakers, as luck would have it Microsoft Scripting Guy Ed Wilson and the Scripting Wife just happened to be on vacation in Orlando that very weekend!&#160; &#160; I’ll be doing my intermediate session on PowerShell to give those scripts one last run through before choosing what to show off at the Summit.&#160; If you’ve seen my beginner session in Tampa, Jacksonville, or Miami this one picks up and builds on that one.&#160; Not much has changed for the intermediate session since Columbia but it is a long car ride down there and I’m not driving so we’ll see if I come up with something new.&#160; I hope to see you there. Here’s the lineup: Start Time PowerShell 09:00 AM Maximo Trinidad Working with SQL Server &#8211; SQLPS 10:15 AM Aaron Nelson The Dirty Dozen: PowerShell Scripts for Busy DBAs 11:30 AM Aaron Nelson PowerShell 2.0 Beyond the Dirty Dozen 01:15 PM Ron Dameron Why a DBA Should Learn PowerShell (MINI) 01:30 PM Ronald Dameron Automate Login Administration &#38; Compliance Reports 02:45 PM Ed Wilson Windows PowerShell Best Practices for SQL DBA’s 04:00 PM Chad Miller ETL with PowerShell]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/10/image.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/10/image_thumb.png" width="244" height="108" /></a>We’ve worked with the organizers of SQL Saturday #49 to be able to bring you a full day line up of PowerShell but it get’s even better.&#160; In addition to myself and the usual Florida crew of PowerShell-for-SQL speakers, as luck would have it Microsoft Scripting Guy Ed Wilson and the Scripting Wife just happened to be on vacation in Orlando that very weekend!&#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/2010/10/wlEmoticon-openmouthedsmile.png" />&#160; </p>
<p>I’ll be doing my intermediate session on PowerShell to give those scripts one last run through before choosing what to show off at the Summit.&#160; If you’ve seen my beginner session in Tampa, Jacksonville, or Miami this one picks up and builds on that one.&#160; Not much has changed for the intermediate session since Columbia but it is a long car ride down there and I’m not driving so we’ll see if I come up with something new.&#160; I hope to see you there.</p>
<p>Here’s the lineup:</p>
<table style="width: 100%; border-collapse: collapse; color: #333333" id="ctl00_ContentPlaceHolder1_GridView2" border="0" cellspacing="0" cellpadding="4">
<tbody>
<tr>
<th scope="col">Start Time</th>
<th scope="col">PowerShell</th>
</tr>
<tr style="background-color: #f7f6f3; color: #333333">
<td>09:00 AM</td>
<td><a href="/viewsession.aspx?sat=49&amp;sessionid=1870">Maximo Trinidad           <br />Working with SQL Server &#8211; SQLPS</a></td>
</tr>
<tr style="background-color: white; color: blue">
<td>10:15 AM</td>
<td><a href="/viewsession.aspx?sat=49&amp;sessionid=2202">Aaron Nelson           <br />The Dirty Dozen: PowerShell Scripts for Busy DBAs</a></td>
</tr>
<tr style="background-color: #f7f6f3; color: #333333">
<td>11:30 AM</td>
<td><a href="/viewsession.aspx?sat=49&amp;sessionid=2203">Aaron Nelson           <br />PowerShell 2.0 Beyond the Dirty Dozen</a></td>
</tr>
<tr style="background-color: white; color: blue">
<td>01:15 PM</td>
<td><a href="/viewsession.aspx?sat=49&amp;sessionid=2350">Ron Dameron           <br />Why a DBA Should Learn PowerShell (MINI)</a></td>
</tr>
<tr style="background-color: #f7f6f3; color: #333333">
<td>01:30 PM</td>
<td><a href="/viewsession.aspx?sat=49&amp;sessionid=2207">Ronald Dameron           <br />Automate Login Administration &amp; Compliance Reports</a></td>
</tr>
<tr style="background-color: white; color: blue">
<td>02:45 PM</td>
<td><a href="/viewsession.aspx?sat=49&amp;sessionid=2753">Ed Wilson           <br />Windows PowerShell Best Practices for SQL DBA’s</a></td>
</tr>
<tr style="background-color: #f7f6f3; color: #333333">
<td>04:00 PM</td>
<td><a href="/viewsession.aspx?sat=49&amp;sessionid=2155">Chad Miller           <br />ETL with PowerShell</a></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/10/ill-be-speaking-at-sql-saturday-49-in-orlando/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Announcing the New PowerShell Virtual Chapter of PASS!</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/10/announcing-the-new-powershell-virtual-chapter-of-pass/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/10/announcing-the-new-powershell-virtual-chapter-of-pass/#comments</comments>
		<pubDate>Thu, 14 Oct 2010 02:08:22 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PASS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Training Event]]></category>
		<category><![CDATA[Free Training]]></category>
		<category><![CDATA[LiveMeeting]]></category>
		<category><![CDATA[Virtual Chapter]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/?p=1545</guid>
		<description><![CDATA[We are very excited to announce the new PowerShell Virtual Chapter of PASS!  What is a Virtual Chapter?  PASS Virtual Chapters are forums where SQL Server Professionals from around the world can communicate with others who have similar interests and face similar challenges.  Think of it this way, PASS Chapters unite the SQL Server Community from a geographical perspective, Virtual Chapters unite the community based on common interests in a specific discipline. What will the new PowerShell Virtual Chapter do?  Our primary mission is holding Live Meetings every month featuring free training from around the world.  We plan to archive the presentations for you to watch on demand and highlight articles and blogs that will interest our members.  This Virtual Chapter is headed up by top professionals from around the US: Ben Miller ( blog &#124; twitter ), Chad Miller [no relation that I’m aware of] ( blog &#124; twitter ), Lars Rasmussen ( blog &#124; twitter ), Peter Schott ( blog &#124; twitter ), and Aaron Nelson ( blog &#124; twitter ).  We will start things off next Wednesday with our first presentation. Here is the schedule through the end of the year.   We are currently looking for speakers for next year. Wednesday October 20th 12 pm EDT (GMT-4) – Presenter Chad Miller Wednesday November 17th 1 pm EST (GMT -5) – Presenter Aaron Nelson Wednesday December 15th 1 pm EST (GMT -5) – Presenter Peter Schott Chad Miller will get us started with an introduction to PowerShell as a command line for one-off tasks or automation in the DBA world. Basic PS principles and syntax will be covered. Get your proverbial DBA feet wet with a tool that can make your database and sysadmin life better than it was before! Bigger, stronger, faster. (Cue Bionic Man theme) Chad Miller Chad hails from the land of rocket launches, oranges, and alligators where he started the Tampa PowerShell User Group. Chad is the DBA for SQL Server and Manager of Database Administration for a shop supporting SQL Server, Oracle, and Informix, acts as coordinator for the SQL Server PowerShell Extensions CodePlex project, and maintains an active blog at http://sev17.com/author/chad-miller/ . How do I attend? Registration for the event is now open. *When you register you&#8217;ll get a calendar reminder for the event.]]></description>
			<content:encoded><![CDATA[<p><a href="http://powershell.sqlpass.org/Home.aspx"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; float: right; padding-top: 0px; border-width: 0px;" title="pass_logo_thumb" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/10/pass_logo_thumb.gif" border="0" alt="pass_logo_thumb" width="83" height="64" align="right" /></a>We are very excited to announce the new <strong><span style="color: #2015a4;"><a href="http://powershell.sqlpass.org/">PowerShell Virtual Chapter of PASS</a></span></strong>!  What is a <em>Virtual Chapter</em>?  <a href="http://www.sqlpass.org/Community/VirtualChapters.aspx">PASS Virtual Chapters</a> are forums where SQL Server Professionals from around the world can communicate with others who have similar interests and face similar challenges.  Think of it this way, PASS Chapters unite the SQL Server Community from a geographical perspective, Virtual Chapters unite the community based on common interests in a specific discipline.</p>
<p>What will the new PowerShell Virtual Chapter do?  Our primary mission is holding Live Meetings every month featuring<strong> free training</strong> from around the world.  We plan to archive the presentations for you to watch on demand and highlight articles and blogs that will interest our members.  This Virtual Chapter is headed up by top professionals from around the US: Ben Miller ( blog | twitter ), Chad Miller [no relation that I’m aware of] ( <a href="http://sev17.com">blog</a> | <a href="http://twitter.com/cmille19">twitter</a> ), Lars Rasmussen ( <a href="http://larsrasmussen.blogspot.com/">blog</a> | <a href="http://twitter.com/larsra">twitter</a> ), Peter Schott ( <a href="http://schottsql.blogspot.com/">blog</a> | <a href="http://twitter.com/paschott">twitter</a> ), and Aaron Nelson ( <a href="http://sqlvariant.com/wordpress/">blog</a> | <a href="http://twitter.com/SQLvariant">twitter</a> ).</p>
<p> We will start things off next Wednesday with our first presentation. Here is the schedule through the end of the year.  <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/10/wlEmoticon-smile.png" alt="Smile" /> We are currently looking for speakers for next year.</p>
<p><strong>Wednesday October 20th 12 pm EDT (GMT-4) – Presenter Chad Miller<br />
</strong><strong>Wednesday November 17th 1 pm EST (GMT -5) – Presenter Aaron Nelson<br />
</strong><strong>Wednesday December 15th 1 pm EST (GMT -5) – Presenter Peter Schott</strong></p>
<p>Chad Miller will get us started with an introduction to PowerShell as a command line for one-off tasks or automation in the DBA world. Basic PS principles and syntax will be covered. Get your proverbial DBA feet wet with a tool that can make your database and sysadmin life better than it was before! Bigger, stronger, faster. (Cue Bionic Man theme)</p>
<p><strong>Chad Miller<br />
</strong>Chad hails from the land of rocket launches, oranges, and alligators where he started the Tampa PowerShell User Group. Chad is the DBA for SQL Server and Manager of Database Administration for a shop supporting SQL Server, Oracle, and Informix, acts as coordinator for the SQL Server PowerShell Extensions CodePlex project, and maintains an active blog at <a href="http://sev17.com/author/chad-miller/">http://sev17.com/author/chad-miller/</a> .</p>
<p><strong>How do I attend?</strong> <a href="https://www.livemeeting.com/lrs/8000181573/Registration.aspx?PageName=dx5snq956p1jp21w">Registration for the event is now open</a>.<br />
*When you register you&#8217;ll get a calendar reminder for the event.</p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/10/announcing-the-new-powershell-virtual-chapter-of-pass/feed/</wfw:commentRss>
		<slash:comments>4</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>SQL Saturday #46 Raleigh Code and Slides</title>
		<link>http://sqlvariant.com/wordpress/index.php/2010/09/sql-saturday-46-raleigh-code-and-slides/</link>
		<comments>http://sqlvariant.com/wordpress/index.php/2010/09/sql-saturday-46-raleigh-code-and-slides/#comments</comments>
		<pubDate>Sat, 18 Sep 2010 16:15:14 +0000</pubDate>
		<dc:creator>Aaron Nelson</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Saturday]]></category>
		<category><![CDATA[Slide Deck]]></category>
		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://sqlvariant.com/wordpress/index.php/2010/09/sql-saturday-46-raleigh-code-and-slides/</guid>
		<description><![CDATA[Well I don’t know about the attendees but I sure had a lot of fun during my PowerShell session at SQL Saturday #46 in Raleigh.&#160; I promised some folks that I would blog out my code and slides that I used ASAP.&#160;&#160; Here are the slides I used and more importantly here are the scripts.&#160; Grant Fritchey ( blog &#124; twitter ) was nice enough to snap a shot of me telling a Developer in the audience what I thought about how many steps it takes in PowerShell to use ADO.Net I’ll post some more details about the event later since I want to get this code out however while I’m at it I’d like to mention that:&#160; For the first time in my short speaking career (and quite possibly the last) I had the largest audience of any session in my room.]]></description>
			<content:encoded><![CDATA[<p><a href="http://sqlvariant.com/wordpress/wp-content/uploads/2010/09/SQLSaturday46Raleigh.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="SQLSaturday46Raleigh" border="0" alt="SQLSaturday46Raleigh" src="http://sqlvariant.com/wordpress/wp-content/uploads/2010/09/SQLSaturday46Raleigh_thumb.jpg" width="395" height="160" /></a> Well I don’t know about the attendees but I sure had a lot of fun during my PowerShell session at <a href="http://www.sqlsaturday.com/46/schedule.aspx">SQL Saturday #46 in Raleigh</a>.&#160; I promised some folks that I would blog out my code and slides that I used ASAP.&#160;&#160; Here are the <a href="http://bit.ly/aasEsE">slides</a> I used and more importantly here are the <a href="http://bit.ly/aj1ZiK">scripts</a>.&#160; </p>
</p>
<p>Grant Fritchey ( <a href="http://scarydba.wordpress.com/">blog</a> | <a href="http://twitter.com/GFritchey">twitter</a> ) was nice enough to snap a shot of me telling a Developer in the audience what I thought about how many steps it takes <a href="http://twitter.com/GFritchey/statuses/24851056482">in PowerShell to use ADO.Net</a> <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>I’ll post some more details about the event later since I want to get this code out however while I’m at it I’d like to mention that:&#160; For the first time in my short speaking career (and quite possibly the last) I had the largest audience of any session in my room. <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' />  <img src='http://sqlvariant.com/wordpress/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://sqlvariant.com/wordpress/index.php/2010/09/sql-saturday-46-raleigh-code-and-slides/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>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>
	</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 01:56:48 -->
