<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><title type="html">Michiel Wories&amp;#39; WebLog</title><subtitle type="html" /><id>http://blogs.msdn.com/b/mwories/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/b/mwories/atom.aspx" /><generator uri="http://telligent.com" version="5.6.50428.7875">Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><updated>2004-12-22T14:51:00Z</updated><entry><title>An insightful article on a recent Windows Azure service disruption</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2012/03/23/an-insightful-article-on-a-recent-windows-azure-service-disruption.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2012/03/23/an-insightful-article-on-a-recent-windows-azure-service-disruption.aspx</id><published>2012-03-23T00:17:29Z</published><updated>2012-03-23T00:17:29Z</updated><content type="html">&lt;p&gt;&lt;span style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: SimSun; mso-fareast-theme-font: minor-fareast; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"&gt;This was such a great read that I wanted to share it out...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: SimSun; mso-fareast-theme-font: minor-fareast; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"&gt;&lt;a href="http://blogs.msdn.com/b/windowsazure/archive/2012/03/10/summary-of-windows-azure-service-disruption-on-feb-29th-2012.aspx"&gt;http://blogs.msdn.com/b/windowsazure/archive/2012/03/10/summary-of-windows-azure-service-disruption-on-feb-29th-2012.aspx&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: SimSun; mso-fareast-theme-font: minor-fareast; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"&gt;&lt;span style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: SimSun; mso-fareast-theme-font: minor-fareast; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"&gt;A factual, actionable, and humble article... Makes me feel proud to work at Microsoft.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: SimSun; mso-fareast-theme-font: minor-fareast; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"&gt;&lt;span style="font-family: 'Calibri','sans-serif'; font-size: 11pt; mso-fareast-font-family: SimSun; mso-fareast-theme-font: minor-fareast; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA;"&gt;-Michiel&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10286671" width="1" height="1"&gt;</content><author><name>Michiel Wories - MSFT</name><uri>http://blogs.msdn.com/mwories_4000_hotmail.com/ProfileUrlRedirect.ashx</uri></author><category term="Microsoft" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Microsoft/" /><category term="Windows Azure" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Windows+Azure/" /></entry><entry><title>The use of Write-Host and SQL Server Agent PowerShell job steps</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2009/09/30/the-use-of-write-host-and-sql-server-agent-powershell-job-steps.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2009/09/30/the-use-of-write-host-and-sql-server-agent-powershell-job-steps.aspx</id><published>2009-10-01T01:42:00Z</published><updated>2009-10-01T01:42:00Z</updated><content type="html">&lt;P&gt;SQL Server Agent implements a job subsystem that allows users to directly run PowerShell scripts in SQL Server Agent. Internally this is implemented by reusing the SQLPS.EXE shell stub (which is another shape of POWERSHELL.EXE, but preconfigured for SQL Server).&lt;/P&gt;
&lt;P&gt;When SQL Server Agent starts SQLPS.EXE, it does not do this through the console (there is no console attached).&lt;/P&gt;
&lt;P&gt;The $Host variable will indicate what host is attached to your runtime. When running SQLPS.EXE on a console this will be your host:&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: Courier; FONT-SIZE: 9pt; mso-bidi-font-size: 11.0pt"&gt;PS C:\Users\mwories&amp;gt; $Host&lt;BR&gt;&lt;BR&gt;Name&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: ConsoleHost&lt;BR&gt;Version&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: 2.0&lt;BR&gt;InstanceId&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: 40b6135d-0f89-4b12-b44e-d3d70a729343&lt;BR&gt;UI&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: System.Management.Automation.Internal.Host.InternalHostUserInterface&lt;BR&gt;CurrentCulture&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: en-US&lt;BR&gt;CurrentUICulture : en-US&lt;BR&gt;PrivateData&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy&lt;BR&gt;IsRunspacePushed : False&lt;BR&gt;Runspace&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: System.Management.Automation.Runspaces.LocalRunspace&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;However print the host variable in an Agent Job and you will see this:&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 10pt" class=MsoNormal&gt;&lt;SPAN style="LINE-HEIGHT: 115%; FONT-FAMILY: Courier; FONT-SIZE: 9pt; mso-bidi-font-size: 11.0pt"&gt;Name&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: Default Host&lt;BR&gt;Version&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: 2.0&lt;BR&gt;InstanceId&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: 9cf1e259-93b1-476f-8c3f-6fe9cf935aab&lt;BR&gt;UI&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: System.Management.Automation.Internal.Host.InternalHostUserInterface&lt;BR&gt;CurrentCulture&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: en-US&lt;BR&gt;CurrentUICulture : en-US&lt;BR&gt;PrivateData&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;: &lt;BR&gt;IsRunspacePushed : &lt;BR&gt;Runspace&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The article &lt;A title="How PowerShell Works" href="http://msdn.microsoft.com/en-us/library/ms714658(VS.85).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ms714658(VS.85).aspx"&gt;How PowerShell Works&lt;/A&gt; explains well how the runspace interacts with the host.&lt;/P&gt;
&lt;P&gt;The Host implement PSHostUserInterface and PSHostRawUserInterface that form the display interface. These may not implement certain methods for the Default Host. And indeed, for the Default Host (the host an Agent Job receives, as there is no console), the method that implements Write-Host is not available, and it will fail with the following message:&lt;/P&gt;
&lt;P&gt;Executed as user: REDMOND\mwories. A job step received an error at line 3 in a PowerShell script. The corresponding line is 'write-host 'foobar''. Correct the script and reschedule the job. The error information returned by PowerShell is: '&lt;STRONG&gt;Cannot invoke this function because the current host does not implement it&lt;/STRONG&gt;.&amp;nbsp; '.&amp;nbsp; Process Exit Code -1.&amp;nbsp; The step failed.&lt;/P&gt;
&lt;P&gt;Now what to do when you want to create your scripts to run in a console but also hosts that may not have a console, and may not implement any host output interface?&lt;/P&gt;
&lt;P&gt;This will work.&lt;/P&gt;
&lt;P&gt;if ($host.Name -eq "ConsoleHost")&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;write-host 'foobar'&lt;BR&gt;}&lt;/P&gt;
&lt;P&gt;Of course you can find ways to simplify your scripts by wrapping this in a function that only writes output when a console is attached.&lt;/P&gt;
&lt;P&gt;If there is any output that you like to be logged, it will not appear in the SQL Agent output. It is therefore better to use Write-Output if you want to provide some kind of output that shows up in SQL Agent output or history.&lt;/P&gt;
&lt;P&gt;Hope this helps to understand the PowerShell subsystem in SQL Server Agent a bit better.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9901576" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>PowerShell Tips &amp; Tricks: Getting more detailed error information from PowerShell</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2009/06/08/powershell-tips-tricks-getting-more-detailed-error-information-from-powershell.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2009/06/08/powershell-tips-tricks-getting-more-detailed-error-information-from-powershell.aspx</id><published>2009-06-08T18:41:00Z</published><updated>2009-06-08T18:41:00Z</updated><content type="html">&lt;P&gt;Allen White wrote this handy blogpost on how to handle error message and get more information out of an error record:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://sqlblog.com/blogs/allen_white/archive/2009/06/08/handling-errors-in-powershell.aspx" mce_href="http://sqlblog.com/blogs/allen_white/archive/2009/06/08/handling-errors-in-powershell.aspx"&gt;http://sqlblog.com/blogs/allen_white/archive/2009/06/08/handling-errors-in-powershell.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;There is an addtional method to get more information available. I found myself sending this little code snippet in email to many, and almost always I get the response that it saved that person with a ton of work, as new users to PowerShell are often left bewildered by the sparse error information; I had colleagues grabbing for the debugger to find the more detailed error messages...&lt;/P&gt;
&lt;P&gt;An example; let's generate a simple error (recreate master will not work on most systems):&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;$db = new Microsoft.SqlServer.Management.Smo.Database&lt;BR&gt;$db.Name = "master"&lt;BR&gt;$db.Parent = get-item .&lt;BR&gt;$db.Create()&lt;BR&gt;Exception calling "Create" with "0" argument(s): "Create failed for Database 'master'. "&lt;BR&gt;At line:1 char:11&lt;BR&gt;+ $db.Create( &amp;lt;&amp;lt;&amp;lt;&amp;lt; )&lt;BR&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not very helpful is it?&lt;/P&gt;
&lt;P&gt;Here is where this little gem comes in:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;$error[0]|format-list -force&lt;/STRONG&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Now let's take a look at the details this emits:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Exception&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;: System.Management.Automation.MethodInvocationException:&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Exception calling "Create" with "0" argument(s): "Crea&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; te failed for Database 'master'. " ---&amp;gt; Microsoft.SqlSe&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rver.Management.Smo.FailedOperationException: Create fa&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iled for Database 'master'.&amp;nbsp; ---&amp;gt; Microsoft.SqlServer.M&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; anagement.Common.ExecutionFailureException: An exceptio&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n occurred while executing a Transact-SQL statement or &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; batch. ---&amp;gt; System.Data.SqlClient.SqlException: Databas&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e 'master' already exists. Choose a different database &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at System.Data.SqlClient.SqlConnection.OnError(SqlEx&lt;BR&gt;&lt;EM&gt;&amp;lt;cutting middle part out&amp;gt;&lt;BR&gt;&lt;/EM&gt;TargetObject&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;BR&gt;CategoryInfo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : NotSpecified: (:) [], MethodInvocationException&lt;BR&gt;FullyQualifiedErrorId : DotNetMethodTargetInvocation&lt;BR&gt;ErrorDetails&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : &lt;BR&gt;InvocationInfo&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : System.Management.Automation.InvocationInfo&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;BR&gt;Well, now THAT's more like it!&lt;/P&gt;
&lt;P mce_keep="true"&gt;As you can see the -force flag does a couple of nice things.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;It concatenates the error messages into a somewhat understandable result.&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;It dumps stack information + all other error information avalable.&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P mce_keep="true"&gt;Generally it's a time saver as you have this command readily available for you at the command line.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Do you have any tips on error handling? I'd love to hear about it.&lt;/P&gt;
&lt;P mce_keep="true"&gt;-Michiel&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9708370" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="Powershell" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Powershell/" /></entry><entry><title>Talking about SQLPS (SQL Server Powershell extensions) on Runas Radio</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2008/09/24/talking-about-sqlps-sql-server-powershell-extensions-on-runas-radio.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2008/09/24/talking-about-sqlps-sql-server-powershell-extensions-on-runas-radio.aspx</id><published>2008-09-24T20:42:00Z</published><updated>2008-09-24T20:42:00Z</updated><content type="html">&lt;P&gt;I was recently interviewed on RunAs Radio on the new Powershell extensions that we developed for SQL Server 2008.&lt;/P&gt;
&lt;P&gt;If you want to learn more about SQL Server Powershell download the podcast here : &lt;A href="http://www.runasradio.com/default.aspx?showNum=75"&gt;http://www.runasradio.com/default.aspx?showNum=75&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;If you listened to it then please post your feedback here.&lt;/P&gt;
&lt;P&gt;Happy listening!&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8963907" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="Microsoft" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Microsoft/" /><category term="Powershell" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Powershell/" /></entry><entry><title>What? No cmdlets? -- SQL Server Powershell</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2008/06/25/what-no-cmdlets-sql-server-powershell.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2008/06/25/what-no-cmdlets-sql-server-powershell.aspx</id><published>2008-06-25T10:25:00Z</published><updated>2008-06-25T10:25:00Z</updated><content type="html">&lt;P&gt;When you start using the SQL Server Powershell extensions, you will find there are not a whole lot of cmdlets. The expectation is indeed that Powershell support means: cmdlets for every administrative operation you can perform. Did we miss something here? Nope, this is by design. We &lt;U&gt;do&lt;/U&gt; intend to ship more cmdlets for common admin tasks, but our first goal was to unlock as many Object Models as we could in the first release.&lt;/P&gt;
&lt;P&gt;We did provide some basic cmdlets to start you off with. We know that DBA's willl have tons of T-SQL scripts that they will not abandon immediately in favor of Powershell. These scripts can be integrated with Invoke-Sqlcmd. We also provided a cmdlet to evaluate Policies, something that will come in handy if you have a lot of servers to manage (see one of my previous posts that contains a reference to an excellent blog entry from Lara on this subject).&lt;/P&gt;
&lt;P&gt;Right now you will find that you can navigate to four different object models:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;SQL Server Relational Managenent Objects (SMO)&lt;/LI&gt;
&lt;LI&gt;Policy Based Management Objects (DMF)&lt;/LI&gt;
&lt;LI&gt;Data Collection (DC)&lt;/LI&gt;
&lt;LI&gt;Server Registration&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;An interesting fact is that the SQL Provider that provides access to these models is almost totally agnostic about these models. It does navigation, and serves these objects to the Powershell host, but without any code that is aware of each of these models. It's made pretty generic and the plan is to start covering all other services (Analysis Server's AMO, RS, etc.) in the same fashion.&lt;/P&gt;
&lt;P&gt;Now, back to 'where are the cmdlet's'.&lt;/P&gt;
&lt;P&gt;We do plan to provider various common cmdlets for common tasks, such as backup, restore, transfer, adding logins and users (pending customer research). But with the provider serving up objects you have almost instant access to any adminstrative commands you need. Let me illustrate this with an example:&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.0pt"&gt;PS C:\&amp;gt; cd SQLSERVER:\SQL\W2K3-TEST3\KATMAI\Logins&lt;BR&gt;PS SQLSERVER:\SQL\W2K3-TEST3\KATMAI\Logins&amp;gt; $t=get-item TEST&lt;BR&gt;PS SQLSERVER:\SQL\W2K3-TEST3\KATMAI\Logins&amp;gt; $t.ChangePassword("asdasd182eqwke111AA")&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&lt;FONT size=3&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;With tab-completion you will be able to browse the available methods quickly, and&amp;nbsp;changing the&amp;nbsp;password is then a piece of cake.&amp;nbsp; 
&lt;P&gt;Another thing to point out is that if you take a look at SMO, DMF, DC, RS, AMO, and the other object models you will find there are hundreds of different of objects and literally thousands of operations you can perform. Strictly speaking, if you were to provider full coverage you would end up with hundreds (maybe over a thousand)&amp;nbsp;cmdlets. This makes discoverability quite cumbersome (let alone it is a huge investment to unlock something that is inherently available). And the complexity of some of the cmdlets would make it not&amp;nbsp;practical. Take for example the Transact-SQL statement to create a table. This is a very hard thing to encapsulate in a cmdlet (or new-item). Go try to think up the cmdlet to support all of CREATE TABLE. This is where the provider will be your friend. Issue a Get-Item to grab the parent. Instantiate a new SMO object and modify it to your liking. Then parent it with the reference you received from the Provider and create it. This is how this looks like:&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 8pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 10.0pt"&gt;cd SQLSERVER:\SQL\W2K3-MVP\DEFAULT\Databases\tempdb&lt;BR&gt;$t = new-object Microsoft.SqlServer.Management.Smo.Table&lt;BR&gt;$t.Parent = (get-item .)&lt;BR&gt;$t.Name ="test"&lt;BR&gt;$c = new-object Microsoft.SqlServer.Management.Smo.Column&lt;BR&gt;$c.Parent = $t&lt;BR&gt;$c.Name = "c1"&lt;BR&gt;$c.DataType = ([Microsoft.SqlServer.Management.Smo.DataType]::Int)&lt;BR&gt;$t.Columns.Add($c)&lt;BR&gt;$t.Create()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/SPAN&gt;This is a simple example. Creating a basic database is even simpler. But if you need more options, it's all there, under your fingertips. And you don't need to wait until we provide a cmdlet for it. But we &lt;U&gt;will&lt;/U&gt; provide cmdlets for everyday tasks. If you have any opinion which cmdlets are important to you, it would be good to hear from you.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8651649" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="Microsoft" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Microsoft/" /><category term="Powershell" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Powershell/" /></entry><entry><title>Some background on the use of minishells, such as SQLPS</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2008/06/23/some-background-on-the-use-of-minishells-such-as-sqlps.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2008/06/23/some-background-on-the-use-of-minishells-such-as-sqlps.aspx</id><published>2008-06-23T19:58:00Z</published><updated>2008-06-23T19:58:00Z</updated><content type="html">&lt;P&gt;Jeffrey Snover posted a very clear article about minishells and SQL Server's use of it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="http://blogs.msdn.com/powershell/archive/2008/06/23/sql-minishells.aspx" mce_href="http://blogs.msdn.com/powershell/archive/2008/06/23/sql-minishells.aspx"&gt;http://blogs.msdn.com/powershell/archive/2008/06/23/sql-minishells.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Jeffrey is Powershell's Architect, well respected in the Powershell community, and it's good to read about his perspective on this.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8642883" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="Microsoft" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Microsoft/" /><category term="Powershell" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Powershell/" /></entry><entry><title>Evaluating SQL Server Policies through Powershell</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2008/06/20/evaluating-sql-server-policies-through-powershell.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2008/06/20/evaluating-sql-server-policies-through-powershell.aspx</id><published>2008-06-20T20:27:00Z</published><updated>2008-06-20T20:27:00Z</updated><content type="html">&lt;P&gt;I found this ping-back on my previous blog post which gives a good overview of one very useful cmdlet that we ship with the Powershell extensions that SQL Server 2008 will deliver. A very helpful article one of the SQL Server MVPs, &lt;A class="" href="http://sqlblog.com/blogs/lara_rubbelke/default.aspx" target=_blank mce_href="http://sqlblog.com/blogs/lara_rubbelke/default.aspx"&gt;Lara Rubbelke&lt;/A&gt;, on the use of &lt;STRONG&gt;Invoke-PolicyEvaluation&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;A href="http://sqlblog.com/blogs/lara_rubbelke/archive/2008/06/19/evaluating-policies-on-demand-through-powershell.aspx"&gt;&lt;FONT face=Calibri color=#800080 size=3&gt;http://sqlblog.com/blogs/lara_rubbelke/archive/2008/06/19/evaluating-policies-on-demand-through-powershell.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8625977" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="Microsoft" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Microsoft/" /><category term="Powershell" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Powershell/" /></entry><entry><title>SQL Server Powershell is here!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2008/06/14/sql2008_5F00_powershell.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2008/06/14/sql2008_5F00_powershell.aspx</id><published>2008-06-15T01:35:00Z</published><updated>2008-06-15T01:35:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;I am very excited that SQL Server will ship with a pretty solid first release of Powershell extensions with SQL Server 2008. The SQL Server Powershell extensions deliver on a vision that we’ll expand on in the next releases to come. So what’s in this release of SQL Server Powershell?&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="COLOR: #1f497d; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;SQLPS&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="COLOR: #1f497d"&gt; – a minishell that gives you a complete pre-configured Powershell with all of SQL Server’s extensions preloaded.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="COLOR: #1f497d; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;SQL Server Agent integration&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="COLOR: #1f497d"&gt; – A new job subsystem for Powershell&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="COLOR: #1f497d; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;SQL Server Management Studio Integration&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="COLOR: #1f497d"&gt; – context menus on every applicable node in Object Explorer (with connection context reuse. Including SQL security!)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="COLOR: #1f497d; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;Four new Providers!&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="COLOR: #1f497d"&gt; – new providers for SQL Server relational engine, Registered Servers, Data Collection, and SQL Server Policy Management&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="COLOR: #1f497d; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;SQLCMD integration&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="COLOR: #1f497d"&gt; – SQLCMD compatible script execution within Powershell (reuses the SQL Server connection context, and even database context of the provider!)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="COLOR: #1f497d; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;SQL Server Policy Management&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="COLOR: #1f497d"&gt; &lt;B style="mso-bidi-font-weight: normal"&gt;integration&lt;/B&gt; – Allows evaluation of any Policy&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="COLOR: #1f497d; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;Various other cmdlets&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="COLOR: #1f497d"&gt; – support the provider, such as conversion of a SMO Urn to a Powershell path, encoding and decoding of SQL identifiers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="COLOR: #1f497d; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;SQL Server Powershell redist&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="COLOR: #1f497d"&gt; – allows you to install SQL Server Powershell with your application or on any machine you need to have it on (this still being built so with the caveat it may be shipped later, or being cut altogether – don’t flame me yet).&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;As always with every release, a lot of things were left on the cutting floor, such as Powershell editor integration &amp;amp; execution within SSMS (with grid output), Powershell script generation from any SSMS menu, SMO objects generating Powershell script, more cmdlets that address common user scenarios, Analysis Server support. And this doesn’t include a long list of ideas that for the sake of brevity will not discuss here.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;The excitement about this release is palpable, and there is no shortness of ideas for the next releases. I think you’ll be pleased with this first release.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;---&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;From recent posts and email I know there is some explanation needed why we ship ‘pre-packaged’ SQLPS functionality. Let me address that here as well.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;SQLPS is slated to be replacing SQLCMD and other tools that people now use to do ad-hoc management and management task automation. It’s more than that, we want &lt;U&gt;uniformity of management&lt;/U&gt; across ALL of SQL Server services, whether it is Analysis Server, SQL Server, Integration Services, Reporting Services etc.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;SQLPS.exe is a Minishell (also called “custom shell”). It is a form of pre-packaging of Powershell functionality, and it is available to anyone who wants to do this (make-shell). It &lt;U&gt;is&lt;/U&gt; regular Powershell, albeit with limitations that the Powershell team decided to impose on it – it is a ‘closed’ shell, which doesn’t allow adding other snapins.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;We are shipping SQLPS to make life of our DBA’s a whole lot easier. If they need to have quick access to the SQL providers, assemblies, cmdlets, default security settings, everything is there. We could have possibly done this through a startup script but not everything can be accomplished this way. We are changing the default security settings, without affecting the settings for overall Powershell. Minishells have their own settings.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;We also use SQLPS to execute SQL Agent jobs. We pipe the data into SQLPS, as we cannot pass it on the cmdline. From that perspective it serves our purpose very well. This is somewhat harder (if not impossible) to accomplish using the startup script approach.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;That said, in the next release we will look into it to ship a SQPS that is more flexible. Listening to the feedback, we should have a form of packaging that allows users to add cmdlets/providers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;We are however not stopping anyone to create their own startup scripts that include the cmdlets and/or providers for SQL Server, Exchange, IIS etc. etc. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;To get you started on this, here is a script that exactly does that:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: #1f497d; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;#&lt;BR&gt;# Initialize-SqlpsEnvironment.ps1&lt;BR&gt;#&lt;BR&gt;# Loads the SQL Server provider extensions&lt;BR&gt;#&lt;BR&gt;# Usage: Powershell -NoExit -Command "&amp;amp; '.\Initialize-SqlPsEnvironment.ps1'"&lt;BR&gt;#&lt;BR&gt;# Change log:&lt;BR&gt;# June 14, 2008: Michiel Wories&lt;BR&gt;#&amp;nbsp;&amp;nbsp; Initial Version&lt;BR&gt;# June 17, 2008: Michiel Wories&lt;BR&gt;#&amp;nbsp;&amp;nbsp; Fixed issue with path that did not allow for snapin\provider:: prefix of path&lt;BR&gt;#&amp;nbsp;&amp;nbsp; Fixed issue with provider variables. Provider does not handle case yet&lt;BR&gt;#&amp;nbsp;&amp;nbsp; that these variables do not exist (bug has been filed)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: #1f497d; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;$ErrorActionPreference = "Stop"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: #1f497d; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;$sqlpsreg="HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.SqlServer.Management.PowerShell.sqlps"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: #1f497d; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;if (Get-ChildItem $sqlpsreg -ErrorAction "SilentlyContinue")&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw "SQL Server Powershell is not installed."&lt;BR&gt;}&lt;BR&gt;else&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $item = Get-ItemProperty $sqlpsreg&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $sqlpsPath = [System.IO.Path]::GetDirectoryName($item.Path)&lt;BR&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: #1f497d; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;#&lt;BR&gt;# Preload the assemblies. Note that most assemblies will be loaded when the provider&lt;BR&gt;# is used. if you work only within the provider this may not be needed. It will reduce&lt;BR&gt;# the shell's footprint if you leave these out.&lt;BR&gt;#&lt;BR&gt;$assemblylist = &lt;BR&gt;"Microsoft.SqlServer.Smo",&lt;BR&gt;"Microsoft.SqlServer.Dmf ",&lt;BR&gt;"Microsoft.SqlServer.SqlWmiManagement ",&lt;BR&gt;"Microsoft.SqlServer.ConnectionInfo ",&lt;BR&gt;"Microsoft.SqlServer.SmoExtended ",&lt;BR&gt;"Microsoft.SqlServer.Management.RegisteredServers ",&lt;BR&gt;"Microsoft.SqlServer.Management.Sdk.Sfc ",&lt;BR&gt;"Microsoft.SqlServer.SqlEnum ",&lt;BR&gt;"Microsoft.SqlServer.RegSvrEnum ",&lt;BR&gt;"Microsoft.SqlServer.WmiEnum ",&lt;BR&gt;"Microsoft.SqlServer.ServiceBrokerEnum ",&lt;BR&gt;"Microsoft.SqlServer.ConnectionInfoExtended ",&lt;BR&gt;"Microsoft.SqlServer.Management.Collector ",&lt;BR&gt;"Microsoft.SqlServer.Management.CollectorEnum"&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;BR&gt;foreach ($asm in $assemblylist)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $asm = [Reflection.Assembly]::LoadWithPartialName($asm)&lt;BR&gt;}&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;#&lt;BR&gt;# Set variables that the provider expects (mandatory for the SQL provider)&lt;BR&gt;#&lt;BR&gt;Set-Variable -scope Global -name SqlServerMaximumChildItems -Value 0&lt;BR&gt;Set-Variable -scope Global -name SqlServerConnectionTimeout -Value 30&lt;BR&gt;Set-Variable -scope Global -name SqlServerIncludeSystemObjects -Value $false&lt;BR&gt;Set-Variable -scope Global -name SqlServerMaximumTabCompletion -Value 1000&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;#&lt;BR&gt;# Load the snapins, type data, format data&lt;BR&gt;#&lt;BR&gt;Push-Location&lt;BR&gt;cd $sqlpsPath&lt;BR&gt;Add-PSSnapin SqlServerCmdletSnapin100&lt;BR&gt;Add-PSSnapin SqlServerProviderSnapin100&lt;BR&gt;Update-TypeData -PrependPath SQLProvider.Types.ps1xml &lt;BR&gt;update-FormatData -prependpath SQLProvider.Format.ps1xml &lt;BR&gt;Pop-Location&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;Write-Host -ForegroundColor Yellow 'SQL Server Powershell extensions are loaded.'&lt;BR&gt;Write-Host&lt;BR&gt;Write-Host -ForegroundColor Yellow 'Type "cd SQLSERVER:\" to step into the provider.'&lt;BR&gt;Write-Host&lt;BR&gt;Write-Host -ForegroundColor Yellow 'For more information, type "help SQLServer".'&lt;BR&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: #1f497d; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: #1f497d; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 11.0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Now, go and use SQL Server Powershell :-). Give us your feedback, and I promise you we’ll listen to it, and we’ll keep on improving on it. This is written for you, the DBA, the IT-PRO, the casual user who needs to do some ad hoc administration or anyone else who uses Powershell for their administrative tasks.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Michiel&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8598595" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="Microsoft" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Microsoft/" /><category term="Powershell" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Powershell/" /></entry><entry><title>How to change the SQL Server password programmatically</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2006/11/03/wmi_5F00_change_5F00_password.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2006/11/03/wmi_5F00_change_5F00_password.aspx</id><published>2006-11-04T02:32:00Z</published><updated>2006-11-04T02:32:00Z</updated><content type="html">&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;Every now and the question comes up how to programmatically modify the service account or password of SQL Server. There basically two ways to accomplish this, using SMO, or WMI. This article shows you how to use WMI and VBScript to accomplish this task.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;There are a couple of things you need to know.&lt;/FONT&gt;&lt;/P&gt;
&lt;UL style="MARGIN-TOP: 0in" type=disc&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;SQL Server &lt;U&gt;does not need a reboot&lt;/U&gt; when the password is modified. We (SQL Server Team) spent quite a bit of time ensuring you do not suffer any unnecessary downtime when performing an operation that has to happen regularly, when password are expiring. Everyone likes a ‘no reboot’ clause, right?&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;When changing the account and password, the service does need a reboot, but the WMI Provider does this for you. In fact, if the service is not started it will be brought up for a short moment. If it already running it will be restarted. The reasons are as follows:&lt;/FONT&gt;&lt;/LI&gt;
&lt;UL style="MARGIN-TOP: 0in" type=circle&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: list 1.0in"&gt;&lt;FONT face="Times New Roman" size=3&gt;The service master key needs to be re-encrypted&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level2 lfo1; tab-stops: list 1.0in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Various other security settings are done&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Because the WMI Provider performs various operations besides changing the service account, other account change methods like ‘sc’ or the standard service control panel are not supported. You may see that the service will not start in some cases.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in"&gt;&lt;FONT face="Times New Roman" size=3&gt;Changing the password only tells the service that the password has changed. If you want to change the account’s password, use a command like NET USER. You need to run that first.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;The following scripts allow you to change the service account + password, or only the password:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;setaccount.vbs:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt"&gt;‘ Set the account and password&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt"&gt;set svr = GetObject("WINMGMTS:\\.\root\Microsoft\SqlServer\ComputerManagement:SqlService.ServiceName='MSSQL$&lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;&lt;st1:State w:st="on"&gt;&lt;st1:place w:st="on"&gt;YUKON&lt;/st1:place&gt;&lt;/st1:State&gt;',SQLServiceType=1")&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt"&gt;svr.SetServiceAccount ".\TestUser", "NewPassword!!"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;setpwd.vbs:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt"&gt;‘ Set the password&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt"&gt;set svr = GetObject("WINMGMTS:\\.\root\Microsoft\SqlServer\ComputerManagement:SqlService.ServiceName='MSSQL$&lt;st1:place w:st="on"&gt;&lt;st1:State w:st="on"&gt;YUKON&lt;/st1:State&gt;&lt;/st1:place&gt;',SQLServiceType=1")&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'; mso-bidi-font-size: 12.0pt"&gt;svr.SetServiceAccountPassword "", "NewPassword2!!"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;You need to change 'MSSQL$&lt;st1:State w:st="on"&gt;YUKON&lt;/st1:State&gt;' to match your instance name (replace ‘&lt;st1:State w:st="on"&gt;&lt;st1:place w:st="on"&gt;YUKON&lt;/st1:place&gt;&lt;/st1:State&gt;’ with the instance name, or the entire string with MSSQLSERVER for the default instance). Of course the account and password need to be changed as well.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;Try this on a test server first before running this on a production server.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;I hope this is helpful,&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Times New Roman" size=3&gt;Michiel&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=948273" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="WMI Samples" scheme="http://blogs.msdn.com/b/mwories/archive/tags/WMI+Samples/" /></entry><entry><title>Add oil to fire: SMO and Monad -- a flammable combination</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2006/01/03/smo-msh.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2006/01/03/smo-msh.aspx</id><published>2006-01-03T22:35:00Z</published><updated>2006-01-03T22:35:00Z</updated><content type="html">&lt;P&gt;&lt;a href="http://blogs.msdn.com/euanga/"&gt;Euan&lt;/A&gt; pointed me to&amp;nbsp;&lt;A href="http://pluralsight.com/blogs/dan/archive/2005/12/29/17703.aspx"&gt;an interesting article about the use of Monad together with SMO&lt;/A&gt;. Those who know me well, know I am somewhat of a scripting biggot and still install Cygwin on all of my boxes as I cannot live without bash, awk, perk, sed, expr and the various other UNIX tools that I have used over the years. I have been somewhat of a Monad sceptic, but once I saw what the vision behind it was I was quickly turned around. Now history will tell whether MSH is going to be the big hit I expect it to be. But there are several teams here already deeply investing in it and Exchange is a team that already showcases a deep use of Monad and event built their management UI on top of it. SQL Server DBA's have potentially a lot to gain from a good Monad implementation with a set of well implemented cmdlets*.&lt;/P&gt;
&lt;P&gt;I'd love to know what type of cmdlets you'd like to see for SQL Server/SMO, bye the way... This is something we're looking into for the next release.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;*If want to know what a cmdlet is, take a look at &lt;/FONT&gt;&lt;A href="http://download.microsoft.com/download/1/8/f/18f8cee2-0b64-41f2-893d-a6f2295b40c8/TW04038_WINHEC2004.ppt"&gt;&lt;FONT size=2&gt;this deck&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=2&gt;&amp;nbsp;or this &lt;/FONT&gt;&lt;A href="http://winfx.msdn.microsoft.com/library/default.asp?url=/library/en-us/monad_conc/html/0aa32589-4447-4ead-a5dd-a3be99113140.asp"&gt;&lt;FONT size=2&gt;MSDN article&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=2&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=508874" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="Powershell" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Powershell/" /></entry><entry><title>SQL Server 2005 -- it's a wrap; but wait -- it's just the beginning!</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/10/28/sql-server-2005-it-s-a-wrap-but-wait-it-s-just-the-beginning.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/10/28/sql-server-2005-it-s-a-wrap-but-wait-it-s-just-the-beginning.aspx</id><published>2005-10-28T18:54:00Z</published><updated>2005-10-28T18:54:00Z</updated><content type="html">&lt;P&gt;I'm sure there are lots of coworkers blogging about this. &lt;U&gt;We're done with SQL Server 2005&lt;/U&gt; and it's a very interesting and good feeling. Having worked 5 year on the project, many long days, many weekends, having to fight many battles, and at the same time giving an incredible amount of attention to the security of our products with various massive security initiatives, shipping SQL Server 2000 SP3 (which was a big SP) and many other parallel work items made this a very high intensity effort of the entire team. One of my co-workers, Kirk, called it &lt;A href="http://sqljunkies.com/WebLog/knight_reign/archive/2005/10/27/17227.aspx"&gt;closure&lt;/A&gt;. I am not calling it that. It's more of a sense of letting a bright and smart prodigy go into the world, ready to do many great works. At the same time keeping an eye out and providing guidance where needed. It's a good feeling, not of closure, but of endless possibilities. The prodigy will be doing more than its masters can imagine it's capable of. The future of SQL Server 2005 is very bright...!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=486260" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /></entry><entry><title>SMO Samples Galore</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/10/25/smo-samples-galore.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/10/25/smo-samples-galore.aspx</id><published>2005-10-25T19:47:00Z</published><updated>2005-10-25T19:47:00Z</updated><content type="html">&lt;P&gt;With much of the SQL Server 2005 devcelopment behind us, I am starting to have some more time &lt;a href="http://blogs.msdn.com/mwories/articles/category/11245.aspx"&gt;to post some SMO samples&lt;/A&gt;. Most of these are inspired on questions in the beta newsgroups or the &lt;A href="http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=88"&gt;SMO/DMO forum&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Additionally, SQL Server 2005 ships with a pretty wide variety of samples. In fact, there are more SMO samples than there are for any other product area, and we have been adding samples up till a a few weeks ago (from here it is pretty much locked down).&lt;/P&gt;
&lt;P&gt;Let me know if you have any sample requests!&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=484717" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="SMO Samples" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SMO+Samples/" /></entry><entry><title>TechED: SMO session done! Now what?</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/07/06/436142.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/07/06/436142.aspx</id><published>2005-07-06T20:19:00Z</published><updated>2005-07-06T20:19:00Z</updated><content type="html">&lt;P&gt;The SMO session was on today! Wow the Euro-crowd is tough! (which I heard uttered by various speakers after being shell shocked by unexpected scores) Jet lag and lack of sleep last few days made this session a hard nut to crack. (the proverb "I can do this in my sleep" is something that really needs to be taken of my list of valid proverbs by the way :-) Nevertheless lots of positive responses and I think the SMO message was well understood and also we're slowly but surely getting &lt;a href="http://blogs.msdn.com/mwories/archive/2005/07/05/435637.aspx"&gt;Project Mercury&lt;/A&gt; off the ground!&lt;/P&gt;
&lt;P&gt;Once back in Redmond, I'm going to see that features are closed down and make sure we have a fully functional version ready to put out to you.&lt;/P&gt;
&lt;P&gt;An additional benefit of being at TechED, is that you meet so many people (duh!). For example &lt;a href="http://blogs.msdn.com/betsya"&gt;Betsy Aoki&lt;/A&gt; and I will have a chat to see how we can get source management implemented.&lt;/P&gt;
&lt;P&gt;Thank you all for attending the session and supporting this effort, and it's good to see so many people are starting to sign themselves in as a member of &lt;A href="http://microsoftsqltools.com"&gt;http://microsoftsqltools.com&lt;/A&gt;&amp;nbsp;(especially considering the site is yet somewhat underdeveloped).&lt;/P&gt;
&lt;P&gt;Michiel&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=436142" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Project code named 'Mercury' (not "SQL Server Web Data Administrator")</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/07/05/435637.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/07/05/435637.aspx</id><published>2005-07-05T14:51:00Z</published><updated>2005-07-05T14:51:00Z</updated><content type="html">&lt;P&gt;Granted, I was asking for this. When we were starting the development of the follow-up version of (here comes the culprit) the new &lt;B style="mso-bidi-font-weight: normal"&gt;SQL Server Web Data Administrator&lt;/B&gt;, Euan was still my boss and asked me to change the name. Long story short, Shipping SQL Server has priority, and I couldn't imagine myself sitting in a room full with lawyers in that stage pondering over names.&lt;/P&gt;
&lt;P&gt;We thought up a code name at the time (I think Euan came up with this) which is ‘Mercury’.&lt;/P&gt;
&lt;P&gt;So, if you see ‘SQL Server Web Data Administrator’ just read it as ‘&lt;B style="mso-bidi-font-weight: normal"&gt;Mercury&lt;/B&gt;’ (or “Project code named ‘Mercury’ ”) if the site has not been updated yet.&lt;/P&gt;
&lt;P&gt;I was going to ask you for suggestions for a new name (this being a shared source project, so why not have a name figured out by the community as well)… I will figure that one out once I get back from TechED Europe. &lt;/P&gt;
&lt;P&gt;So there, Euan! [:D] Project Mercury is &lt;A href="http://microsoftsqltools.com/"&gt;here&lt;/A&gt;. And being demoed Wednesday at TechED.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=435637" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>Upcoming at TechED: Web Based SQL Server Management Tool (Shared Source!)</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/07/04/435324.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/07/04/435324.aspx</id><published>2005-07-04T20:00:00Z</published><updated>2005-07-04T20:00:00Z</updated><content type="html">&lt;P&gt;Visual Studio .NET 2003 shipped &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=C039A798-C57A-419E-ACBC-2A332CB7F959&amp;amp;displaylang=en"&gt;a web based sample application for management of SQL Server&lt;/A&gt;, based on ASP.NET and SQL-DMO. We're currently working on an updated version of that tool. This is a quick list of the things that we change:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Revamped UI 
&lt;LI&gt;Improved navigation 
&lt;LI&gt;Improved architecture to make adding new components easier 
&lt;LI&gt;Fully based on ASP.NET 2.0 and SMO 
&lt;LI&gt;Works now with SQL Server 2000 and SQL Server 2005&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;We focussed on extensibility, so adding new features is a breeze. In fact, I created Assembly management from scratch within 2 hours on the plane to TechED, which I will demo coming Wednesday.&lt;/P&gt;
&lt;P&gt;This tool is going to be made available as a Shared Source project. This means you can contribute to this project if you sign up to be a team member; or download the code and modify it for your own purposes (and push your changes back to the development team). We're not ready yet to allow you to sign up for team member, as we're still working on the '1.0 release', but if you're curious how it looks like, take a look at &lt;A href="http://microsoftsqltools.com/"&gt;http://microsoftsqltools.com/&lt;/A&gt;. You can already sign up as member, and place feature requests as well. If you feel strong about certain features, I advice you to place feedback already. The earlier you are, the more chance it will make it as a feature!&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;If you're at TechED Europe,&amp;nbsp;you can see a demo of this new tool:&lt;BR&gt;&lt;/STRONG&gt;"&lt;FONT color=#000080&gt;&lt;STRONG&gt;DAT310 Programming SQL Server Management Objects (SMO)&lt;/STRONG&gt;&lt;/FONT&gt;" (&lt;STRONG&gt;Wed Jul 6 12:00 - 13:15)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=435324" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /></entry><entry><title>SQL Server 2005 Easter Egg</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/06/24/432436.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/06/24/432436.aspx</id><published>2005-06-25T02:06:00Z</published><updated>2005-06-25T02:06:00Z</updated><content type="html">&lt;P&gt;In &lt;A href="http://www.sqlpass.org/community/sig/dba/april_newsletter/drapers_article.cfm"&gt;an interview with Gert Drapers&lt;/A&gt;, SQLCMD was mentioned&amp;nbsp;as SQL Server 2005's Easter Egg (Gert: "one of the biggest productivity gains for DBA’s in terms of automation"). I hope that I can pull this feature somewhat out of obscurity :-)&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msevents.microsoft.com/cui/WebCastEventDetails.aspx?EventID=1032275435&amp;amp;EventCategory=5&amp;amp;culture=en-US&amp;amp;CountryCode=US"&gt;Watch the SQL Server 2005 Scripting Webcast&lt;/A&gt; which covers most of SQLCMD's features. And when you're done, check out some webcast resources I posted &lt;A href='http://blogs.msdn.com/admin/blogs/&lt;img%20border="0"%20src="http://www.mseventseurope.com/teched/05/pre/content/banners/images/signatures/teched-speak-s-150.gif"&gt;'&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;You can find Gert at &lt;A href="http://www.sqldev.net/"&gt;www.sqldev.net&lt;/A&gt;&amp;nbsp;(and soon he will be roaming the VS buildings).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;IMG src="http://www.mseventseurope.com/teched/05/pre/content/banners/images/signatures/teched-speak-s-150.gif" border=0&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=432436" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author></entry><entry><title>SQL Server: Table Partitioning in SQL Server 2005</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/06/24/table-partitioning-sample.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/06/24/table-partitioning-sample.aspx</id><published>2005-06-24T22:07:00Z</published><updated>2005-06-24T22:07:00Z</updated><content type="html">&lt;DIV&gt;Table and Index partitioning is one if the new SQL Server 2005 features that willl improve life for the DBA and application developer quite a bit. It allows Indexes and Tables to be partitioned across multiple file groups. Partitioned tables and indexes, are fully manageable with SMO. Here is a quick sample to get you started, with not too much explanation as speaks for itself, mostly. Let me know if you have questions!&lt;/DIV&gt;
&lt;DIV&gt;&lt;BR&gt;Server svr = new Server();&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Database db = new Database(svr, "MyDatabase");&lt;BR&gt;db.FileGroups.Add(new FileGroup(db, "PRIMARY"));&lt;BR&gt;db.FileGroups.Add(new FileGroup(db, "SECONDARY"));&lt;BR&gt;db.FileGroups[0].Files.Add(new DataFile(db.FileGroups[0], "datafile1", @"c:\db1.mdf"));&lt;BR&gt;db.FileGroups[1].Files.Add(new DataFile(db.FileGroups[1], "datafile2", @"c:\db2.mdf"));&lt;BR&gt;db.Create();&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;PartitionFunction pf = new PartitionFunction(db, "MyPartitionFunction");&lt;BR&gt;pf.PartitionFunctionParameters.Add(new PartitionFunctionParameter(pf, DataType.Int));&lt;BR&gt;pf.RangeType = RangeType.Left;&lt;BR&gt;pf.RangeValues = new object[] { 5000 };&lt;BR&gt;pf.Create();&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;PartitionScheme ps = new PartitionScheme(db, "MyPartitionScheme");&lt;BR&gt;ps.PartitionFunction = "MyPartitionFunction";&lt;BR&gt;ps.FileGroups.Add("PRIMARY");&lt;BR&gt;ps.FileGroups.Add("SECONDARY");&lt;BR&gt;ps.Create();&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Table t = new Table(db, "MyTable");&lt;BR&gt;t.Columns.Add(new Column(t, "c1", DataType.Int));&lt;BR&gt;t.Columns.Add(new Column(t, "c2", DataType.VarChar(100)));&lt;BR&gt;t.PartitionScheme = "MyPartitionScheme";&lt;BR&gt;t.PartitionSchemeParameters.Add(new PartitionSchemeParameter(t, "c1"));&lt;BR&gt;t.Create();&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;// Script out the objects (for educational purposes; optional) &lt;BR&gt;SqlSmoObject[] objs = new SqlSmoObject[4];&lt;BR&gt;objs[0] = db;&lt;BR&gt;objs[1] = pf;&lt;BR&gt;objs[2] = ps;&lt;BR&gt;objs[3] = t;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;for (int i = 0; i &amp;lt; 4; i++)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("-- " + objs[i].ToString());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (string s in ((IScriptable)(objs[i])).Script())&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(s);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("GO");&lt;BR&gt;}&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;IMG src="http://www.mseventseurope.com/teched/05/pre/content/banners/images/signatures/teched-speak-s-150.gif" border=0&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=432333" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="SMO Samples" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SMO+Samples/" /></entry><entry><title>Scripting in Microsoft SQL Server 2005 -- Web Cast has finished</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/06/21/scripting-webcast.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/06/21/scripting-webcast.aspx</id><published>2005-06-21T22:03:00Z</published><updated>2005-06-21T22:03:00Z</updated><content type="html">&lt;P&gt;I just finished the &lt;STRONG&gt;Scripting in Microsoft SQL Server 2005 &lt;/STRONG&gt;webcast.&lt;/P&gt;
&lt;P&gt;Thanks all for being online (and also thank you MVP's for answering questions!) I was a little nervous doing this (it's a big deck with lots of demos) but I think it went quite OK.&lt;/P&gt;
&lt;P&gt;Let me know if you have any requests/comments!&lt;/P&gt;
&lt;P&gt;&lt;a href="http://blogs.msdn.com/mwories/articles/scripting_webcast_resources.aspx"&gt;Q&amp;amp;A, Samples, Demo Script has been posted (click here).&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#000080&gt;
&lt;P&gt;Michiel&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;Forums: &lt;A href="http://forums.microsoft.com/msdn"&gt;http://forums.microsoft.com/msdn&lt;/A&gt;&amp;nbsp;(for SQLCMD go to &lt;EM&gt;SQL Server Tools General&lt;/EM&gt;)&lt;/P&gt;
&lt;P&gt;Blogs of MVP's&amp;nbsp;who helped answering questions:&lt;BR&gt;&lt;A title=http://spaces.msn.com/members/drsql href="http://spaces.msn.com/members/drsql"&gt;&lt;FONT face=Arial size=2&gt;http://spaces.msn.com/members/drsql&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;(Louis Davidson)&lt;BR&gt;&lt;A title=http://users.drew.edu/skass href="http://users.drew.edu/skass"&gt;&lt;FONT face=Arial size=2&gt;http://users.drew.edu/skass&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;(Steve Kass)&lt;BR&gt;&lt;A href="http://sqljunkies.com/WebLog/ktegels"&gt;http://sqljunkies.com/WebLog/ktegels&lt;/A&gt;&amp;nbsp;(Ken Tegels)&lt;BR&gt;&lt;A title=http://www.sqlskills.com/blogs/kimberly href="http://www.sqlskills.com/blogs/kimberly"&gt;&lt;FONT face=Verdana size=2&gt;http://www.sqlskills.com/blogs/kimberly&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;(Kimberly Tripp)&lt;BR&gt;&lt;BR&gt;&lt;IMG src="http://www.mseventseurope.com/teched/05/pre/content/banners/images/signatures/teched-speak-s-150.gif" border=0&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=431188" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /></entry><entry><title>SQL Server: Capture Object changes with SMO Capture Mode</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/05/31/capture-mode.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/05/31/capture-mode.aspx</id><published>2005-06-01T00:51:00Z</published><updated>2005-06-01T00:51:00Z</updated><content type="html">&lt;P class=MsoNormal&gt;In a previous article I have showed how a SMO object can be serialized into a Transact-SQL script, which allows you to recreate the object. What if you want to have the script that is emitted when you changed one or more properties of an object? In that case Capture Mode comes in handy. This switches the ServerConnection object in a state where it starts capturing all statements that SMO emits instead of sending these to the server. The following sample illustrates how it is used.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=MsoNormal&gt;Server svr = new Server();&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;Database db = svr.Databases["MySmoTestDatabase"];&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;// First create new test database, if it does not exist&lt;BR&gt;if (db == null)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; db = new Database(svr, "MySmoTestDatabase");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.Create();&lt;BR&gt;}&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;// Set an option (we flip it to on or off depending orginal state)&lt;BR&gt;db.DatabaseOptions.AutoClose = !db.DatabaseOptions.AutoClose;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;// Switch SMO in capture mode&lt;BR&gt;svr.ConnectionContext.SqlExecutionModes = SqlExecutionModes.CaptureSql;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;// Now perform the operation&lt;BR&gt;db.Alter();&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;// Don't forget to switch back&lt;BR&gt;svr.ConnectionContext.SqlExecutionModes = SqlExecutionModes.ExecuteSql;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;// Put database back in original state&lt;BR&gt;db.Refresh();&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;// Print script&lt;BR&gt;foreach (string s in svr.ConnectionContext.CapturedSql.Text)&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(s);&lt;BR&gt;}&lt;/PRE&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;Note the Refresh() near the end. This is needed to bring back the Database object in sync with the server again. It’s not enough to execute the script (if you would do that) to bring it in sync with the server.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;

&lt;img border="0" src="http://www.mseventseurope.com/teched/05/pre/content/banners/images/signatures/teched-speak-s-150.gif"&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=423575" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="SMO Samples" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SMO+Samples/" /></entry><entry><title>SQL Server: SMO Scripting Basics</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/05/07/basic-scripting.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/05/07/basic-scripting.aspx</id><published>2005-05-07T21:51:00Z</published><updated>2005-05-07T21:51:00Z</updated><content type="html">&lt;P class=MsoNormal&gt;Let's first clarify what I mean by "scripting". It often happens during talks or when I explain SMO fundamentals that eyes gloss over, shortly after which the "what * do you mean by scripting" question pops up (replace the * with your favorite combination of&amp;nbsp;adjective and noun to indicate bewilderment). For people who, unlike me, do not live their lives in SQL land, "scripting" means&amp;nbsp;typically some kind of language script, like perl, VBScript, or others, that allows you, without the use of a development environment to author and execute code". Not so in this case. If I were to be precise, it means "serialize a SMO or DMO object into Transact-SQL". So now we have this out of the way, let's take a look at SMO Scripting.&lt;/P&gt;
&lt;P class=MsoNormal&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;SMO objects, when either just instantiated and not yet persisted, or just retrieved from the server, carry state. For example a StoredProcedure object has a name, a schema, a text body, and maybe some other optional properties. This state can be serialized into a Transact-SQL script that you may store, modify, or execute. As SQL Server’s primary language is Transact-SQL, it’s obvious that one of the tasks that the SMO object model has to perform very well is scripting. SMO objects can be scripted in 5 different ways:&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI class=MsoNormal&gt;By calling the &lt;B&gt;Script()&lt;/B&gt; method on the object. 
&lt;LI class=MsoNormal&gt;By instantiating a &lt;B&gt;Scripter object&lt;/B&gt;, and pass in a reference of the object(s) to be scripted. 
&lt;LI class=MsoNormal&gt;Advanced scripting: &lt;B&gt;generating a script in 3 distinct phases&lt;/B&gt; (discovery, list, script) 
&lt;LI class=MsoNormal&gt;By using the &lt;B&gt;Transfer object&lt;/B&gt;. 
&lt;LI class=MsoNormal&gt;Indirectly, by &lt;B&gt;capturing the SQL output&lt;/B&gt; of the objects&lt;/LI&gt;&lt;/OL&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;I will discuss 1 and 2 and will dedicate some more posts on the other more advanced topics.&lt;/P&gt;
&lt;H3&gt;&lt;A name=_Toc102900547&gt;Basic Scripting&lt;/A&gt;&lt;/H3&gt;
&lt;P class=MsoNormal&gt;Let’s start with scripting an existing object, with no options specified (installing AdventureWorks will help running these samples):&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;&lt;PRE&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;();&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;foreach&lt;/SPAN&gt; (&lt;SPAN&gt;string&lt;/SPAN&gt; s &lt;SPAN&gt;in&lt;/SPAN&gt; svr.Databases[&lt;SPAN&gt;"AdventureWorks"&lt;/SPAN&gt;].StoredProcedures[&lt;SPAN&gt;"uspGetEmployeeManagers"&lt;/SPAN&gt;, &lt;SPAN&gt;"dbo"&lt;/SPAN&gt;].Script())&lt;BR&gt;{&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console&lt;/SPAN&gt;.WriteLine(s);&lt;BR&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P&gt;If you run this code, the script should be emitted to the console. So far pretty straightforward eh?&lt;/P&gt;
&lt;H3&gt;Scripting Options&lt;/H3&gt;
&lt;P&gt;If you want to do more than just scripting the object, there are scripting options that you can pass into the Script() method. There 2 ways to pass in Scripting options. The following 2 samples illustrate the different methods of passing in scripting options.&lt;/P&gt;
&lt;TABLE class=MsoTableGrid cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;StoredProcedure&lt;/SPAN&gt;&lt;SPAN&gt; sp = svr.Databases[&lt;SPAN&gt;"AdventureWorks"&lt;/SPAN&gt;].StoredProcedures[&lt;SPAN&gt;"uspGetEmployeeManagers"&lt;/SPAN&gt;, &lt;SPAN&gt;"dbo"&lt;/SPAN&gt;];&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;ScriptingOptions&lt;/SPAN&gt;&lt;SPAN&gt; so = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;ScriptingOptions&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;so.IncludeHeaders = &lt;SPAN&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;so.SchemaQualify = &lt;SPAN&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;foreach&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;SPAN&gt;string&lt;/SPAN&gt; s &lt;SPAN&gt;in&lt;/SPAN&gt; sp.Script(so))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console&lt;/SPAN&gt;&lt;SPAN&gt;.WriteLine(s);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P&gt;In the next sample, you use the ScriptOption class. This class has various static members that each return an instance of a ScriptionOption class.&lt;/P&gt;
&lt;TABLE class=MsoTableGrid cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;StoredProcedure&lt;/SPAN&gt;&lt;SPAN&gt; sp = svr.Databases[&lt;SPAN&gt;"AdventureWorks"&lt;/SPAN&gt;].StoredProcedures[&lt;SPAN&gt;"uspGetEmployeeManagers"&lt;/SPAN&gt;, &lt;SPAN&gt;"dbo"&lt;/SPAN&gt;];&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;foreach&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;SPAN&gt;string&lt;/SPAN&gt; s &lt;SPAN&gt;in&lt;/SPAN&gt; sp.Script(&lt;SPAN&gt;ScriptOption&lt;/SPAN&gt;.IncludeHeaders + &lt;SPAN&gt;ScriptOption&lt;/SPAN&gt;.SchemaQualify))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console&lt;/SPAN&gt;&lt;SPAN&gt;.WriteLine(s);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P&gt;You can take advantage of the fact that the ScriptOption static members returns a ScriptingOption class (through &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfimplicit.asp"&gt;implict conversion&lt;/A&gt;), as you can use it as an alternative to construct a Scriptingoption class:&lt;/P&gt;
&lt;TABLE class=MsoTableGrid cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;ScriptingOptions&lt;/SPAN&gt;&lt;SPAN&gt; so = &lt;SPAN&gt;ScriptOption&lt;/SPAN&gt;.IncludeHeaders;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;so.SchemaQualify = &lt;SPAN&gt;true&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;H3&gt;Script modified objects&lt;/H3&gt;
&lt;P class=MsoNormal&gt;You can modify and script an object, without persisting its state. This sample shows how this can be accomplished:&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;TABLE class=MsoTableGrid cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;&lt;PRE&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;();&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;StoredProcedure&lt;/SPAN&gt; sp = svr.Databases[&lt;SPAN&gt;"AdventureWorks"&lt;/SPAN&gt;].StoredProcedures[&lt;SPAN&gt;"uspGetEmployeeManagers"&lt;/SPAN&gt;, &lt;SPAN&gt;"dbo"&lt;/SPAN&gt;];&lt;BR&gt;&lt;BR&gt;sp.TextHeader = &lt;SPAN&gt;"-- Scripted at "&lt;/SPAN&gt; + &lt;SPAN&gt;DateTime&lt;/SPAN&gt;.Now.ToString() + &lt;SPAN&gt;"\n\n"&lt;/SPAN&gt; + sp.TextHeader;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;foreach&lt;/SPAN&gt; (&lt;SPAN&gt;string&lt;/SPAN&gt; s &lt;SPAN&gt;in&lt;/SPAN&gt; sp.Script())&lt;BR&gt;{&lt;BR&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console&lt;/SPAN&gt;.WriteLine(s);&lt;BR&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;Ensure that you either call the Refresh() method on the object once you are done, or persist the object by calling Alter(), as this temporary state may cause problems when this object is referenced again for other purposes.&lt;/P&gt;
&lt;H3&gt;Script non-existing objects&lt;/H3&gt;
&lt;P&gt;Alternative, you can instantiate a new object, and emit the script for it, without requiring it to exist on the server. In fact the below script will not even connect to the server; this happens all on your client. &lt;/P&gt;
&lt;TABLE class=MsoTableGrid cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;();&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;Database&lt;/SPAN&gt; db = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Database&lt;/SPAN&gt;(svr, &lt;SPAN&gt;"MyDatabase"&lt;/SPAN&gt;);&lt;BR&gt;&lt;BR&gt;db.DatabaseOptions.AutoClose = &lt;SPAN&gt;true&lt;/SPAN&gt;;&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;foreach&lt;/SPAN&gt; (&lt;SPAN&gt;string&lt;/SPAN&gt; s &lt;SPAN&gt;in&lt;/SPAN&gt; db.Script())&lt;BR&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console&lt;/SPAN&gt;&lt;SPAN&gt;.WriteLine(s);&lt;BR&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;H3&gt;Using the Scripter object&lt;/H3&gt;
&lt;P&gt;If you call the Script() method on an object, what actually happens, is that in the background a Scripter() object is instantiated, which performs the various scripting operations. Whereas each object knows how to emit script, the Scripter object pulls it all together, and does special processing before or while generating the output. Let’s take a look how the Scripter object can be used to accomplish the same task as above (scripting a database). &lt;/P&gt;
&lt;TABLE class=MsoTableGrid cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;Database&lt;/SPAN&gt;&lt;SPAN&gt; db = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Database&lt;/SPAN&gt;(svr, &lt;SPAN&gt;"MyDatabase"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;db.DatabaseOptions.AutoClose = &lt;SPAN&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;Scripter&lt;/SPAN&gt;&lt;SPAN&gt; scripter = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Scripter&lt;/SPAN&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;scripter.Server = svr;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;scripter.Options.IncludeHeaders = &lt;SPAN&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;scripter.Options.SchemaQualify = &lt;SPAN&gt;true&lt;/SPAN&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;SqlSmoObject&lt;/SPAN&gt;&lt;SPAN&gt;[] objs = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;SqlSmoObject&lt;/SPAN&gt;[1];&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;objs[0] = db;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;scripter.Script(objs);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;foreach&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;SPAN&gt;string&lt;/SPAN&gt; s &lt;SPAN&gt;in&lt;/SPAN&gt; scripter.Script(objs))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console&lt;/SPAN&gt;&lt;SPAN&gt;.WriteLine(s);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P&gt;The above samples I have touched on the basis of the scripting operations. In the next posts I will elaborate and show you more complex and elaborate ways to generate script. We made scripting extremely flexible, and hope that this first post helps you to get started with scripting.&lt;/P&gt;&lt;SPAN&gt;Enjoy!&lt;/SPAN&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=415398" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="SMO Samples" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SMO+Samples/" /></entry><entry><title>Sql Server: Everything you always wanted to know about SMO Connections</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/05/02/smoconnections.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/05/02/smoconnections.aspx</id><published>2005-05-03T00:40:00Z</published><updated>2005-05-03T00:40:00Z</updated><content type="html">&lt;P&gt;There are several ways of controlling connections in SMO -- you can control pretty much any aspect of a SMO connection.&lt;/P&gt;
&lt;H3&gt;Pooled connections&lt;/H3&gt;
&lt;P&gt;Let's take a look at a typical way how you would obtain a connection using a simple C# sample:&lt;/P&gt;
&lt;TABLE class=MsoNormalTable id=table1 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;();&lt;BR&gt;&lt;SPAN&gt;Console&lt;/SPAN&gt;.WriteLine(svr.Information.Product + &lt;SPAN&gt;" "&lt;/SPAN&gt; + svr.Information.VersionString + &lt;SPAN&gt;" "&lt;/SPAN&gt; + svr.Information.ProductLevel);&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P&gt;When you run this sample it will print the version, and edition, but you will also notice that the Connect() call is missing. Is there a need to call Connect()? The answer is both "yes", and "no". When you do &lt;B&gt;not&lt;/B&gt; call Connect(), SMO will automatically obtain a connection from the connection pool when it needs one (in this case when accessing the svr.Information.VersionString/Edition properties), and after the operation has finished it will return that connection to the pool. This is a nice model as it stops you from needing to worry about when to call Disconnect(). SMO will do that bookkeeping for you and if your application has to exit because of a failure you do not need to release the connection -- SMO already has done that for you. &lt;/P&gt;
&lt;H3&gt;Explicitly connecting&lt;/H3&gt;
&lt;P&gt;You can override that behavior by explicitly connecting:&lt;/P&gt;
&lt;TABLE class=MsoNormalTable id=table2 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;();&lt;BR&gt;&lt;B&gt;svr.ConnectionContext.Connect();&lt;/B&gt;&lt;BR&gt;&lt;SPAN&gt;Console&lt;/SPAN&gt;.WriteLine(svr.Information.Product + &lt;SPAN&gt;" "&lt;/SPAN&gt; + svr.Information.VersionString + &lt;SPAN&gt;" "&lt;/SPAN&gt; + svr.Information.ProductLevel);&lt;BR&gt;&lt;B&gt;svr.ConnectionContext.Disconnect();&lt;/B&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P&gt;What happens here is that SMO will obtain a connection from the connection pool on your request, and will &lt;B&gt;not&lt;/B&gt; automatically release it to the pool, until you call Disconnect(). &lt;/P&gt;
&lt;P&gt;This is very much the same pattern that you would use in SQL-DMO. Also, if you are not able to connect to the server, you will get an exception during the Connect() call. However, there is one slight difference. The connection that is obtained comes from a connection pool. If you call Disconnect() and Connect() in succession then you will likely get the connection from the pool, so this allows you to efficiently manage your connections. Connection pooling means the connection is not immediately closed. It’s up to the connection pool to close it when the lifetime expires.&lt;/P&gt;
&lt;H3&gt;Non pooled connections&lt;/H3&gt;
&lt;P&gt;In some cases you want to not draw connections from a pool, but make sure that you get a non-pooled connection that you can hold on as long as your application is running. This can be helpful when running in single-user mode, or when you are paranoid about SMO to do the right thing with your connections and want to have complete control over the connections that are managed. This can be simply accomplished by setting the NonPooledConnection property to true.&lt;/P&gt;
&lt;TABLE class=MsoNormalTable id=table3 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;();&lt;BR&gt;&lt;B&gt;svr.ConnectionContext.NonPooledConnection = &lt;SPAN&gt;true&lt;/SPAN&gt;;&lt;/B&gt;&lt;BR&gt;&lt;SPAN&gt;Console&lt;/SPAN&gt;.WriteLine(svr.Information.Product + &lt;SPAN&gt;" "&lt;/SPAN&gt; + svr.Information.VersionString + &lt;SPAN&gt;" "&lt;/SPAN&gt; + svr.Information.ProductLevel);&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P&gt;The connection is then a dedicated connection that will not be returned to the pool. SMO will again, like with pooled connections, connect on demand, but in this case it will hold on to&amp;nbsp;the connection&amp;nbsp;until you specifically call Disconnect(). Connecting is in this case much more expensive, as there will not be a connection in the pool. This type of connection however guarantees that you have that connection for the lifetime of your application. For example, &lt;SPAN&gt;SQL Server Management Studio&lt;/SPAN&gt; uses such a connection.&lt;/P&gt;
&lt;H3&gt;Sharing connections between processes&lt;/H3&gt;
&lt;P&gt;You can share connections between SMO Server instances, and pass and Create a new ServerConnection object based on an existing object, which is helpful if you need multiple connections with the same setting:&lt;/P&gt;
&lt;TABLE class=MsoNormalTable id=table4 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;
&lt;DIV&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;();&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;svr.ConnectionContext.NonPooledConnection = &lt;SPAN&gt;true&lt;/SPAN&gt;; &lt;SPAN&gt;// comment this out to see what happens to the SPID's&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Console&lt;/SPAN&gt;.WriteLine(svr.ConnectionContext.ProcessID);&lt;SPAN&gt;&lt;BR&gt;// do work...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;// Pass the connection on to new Server instance -- the connection is reused&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr2 = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;(&lt;B&gt;svr.ConnectionContext&lt;/B&gt;);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;Console&lt;/SPAN&gt;&lt;SPAN&gt;.WriteLine(svr2.ConnectionContext.ProcessID);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;// do work...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;// The Copy() method will create a new object, and will use a new connection to the server&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;Server&lt;/SPAN&gt;&lt;SPAN&gt; svr3 = &lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;Server&lt;/SPAN&gt;(&lt;B&gt;svr2.ConnectionContext.Copy()&lt;/B&gt;);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Console&lt;/SPAN&gt;&lt;SPAN&gt;.WriteLine(svr3.ConnectionContext.ProcessID);&lt;BR&gt;&lt;SPAN&gt;// do work...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P&gt;If you run this example, you will see that the ProcessID (SPID) only differs for svr3, as it will not use the existing connection.&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;&lt;STRONG&gt;&lt;EM&gt;Comment out the indicated line, and see if you understand what's happening! (please post a response, don't be shy! ;-).&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H3&gt;Other settings&lt;/H3&gt;
&lt;P&gt;There are various other settings of the ServerConnection object that can be manipulated to finetune SMO's behavior. Examples of this are MaxPoolSize, PooledConnectionLifeTime. Take a look at the object and you will find that all possible connection settings are available.&lt;/P&gt;
&lt;H3&gt;Some interesting facts&lt;/H3&gt;
&lt;UL&gt;
&lt;LI class=MsoNormal&gt;The default instance is assumed when you do not specify a server name 
&lt;LI class=MsoNormal&gt;SMO uses Integrated security by default (the most secure option) 
&lt;LI class=MsoNormal&gt;Once you have connected, you cannot change the properties of the ServerConnection object. You need to get a new ServerConnection object or use Copy() if you want a new connection with the same properties. &lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Important note&lt;/H3&gt;&lt;SPAN&gt;SMO allows you to pass on ServerConnections to different Server instances, but be very careful when doing so. SMO is making assumptions about various settings, so if you change settings, for example you grab the ServerConnection for other purposes than using it for SMO, and issue a SET NOEXEC ON, then SMO will fail to execute the statements. This will cause SMO to respond unpredictable, with application exceptions likely to occur. It is strongly discouraged to reuse connections for other uses than in SMO. Use pooling and obtain a dedicated connection for purposes other than using it with SMO.&lt;/SPAN&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=414087" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /></entry><entry><title>SQL Server: Tuning your SMO Application for great performance -- PART 2</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/05/02/smoperf2.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/05/02/smoperf2.aspx</id><published>2005-05-02T11:21:00Z</published><updated>2005-05-02T11:21:00Z</updated><content type="html">&lt;P class=MsoNormal&gt;In the previous post I provided you with a fundamental tool to minimize the amount of SQL statements emitted and therefore limit expensive network round-trips (and SQL statements) using the &lt;B&gt;Server.SetDefaultInitFields()&lt;/B&gt; method. In this post I will provide you with some more detail about this method, alongside with a recommendation about its use.&lt;BR&gt;&lt;BR&gt;Let's take a quick look at the optimized sample that I provided last article:&lt;BR&gt;&lt;BR&gt;&lt;SPAN&gt;&lt;BR&gt;Server svr = new Server();&lt;BR&gt;&lt;BR&gt;Database db = svr.Databases["AdventureWorks"];&lt;BR&gt;&lt;B&gt;svr.SetDefaultInitFields(typeof(Table), "CreateDate");&lt;/B&gt;&lt;BR&gt;foreach (Table t in db.Tables)&lt;BR&gt;{&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console.WriteLine(t.Schema + "." + t.Name + " " + t.CreateDate);&lt;BR&gt;}&lt;BR&gt;&lt;/SPAN&gt;&lt;BR&gt;This optimization is particular to this piece of code,&amp;nbsp;but the setting is global to the Server instance so every time you will retrieve a Table object later in your code, it will load the same fields as just specified. It's recommended to save the state of the previous SetDefaultInitFields setting so you can set it to the same value after you have retrieved your objects. The following sample shows you have to save the state, and then set if back to that state:&lt;BR&gt;&lt;SPAN&gt;&lt;BR&gt;Server svr = new Server();&lt;BR&gt;&lt;BR&gt;Database db = svr.Databases["AdventureWorks"];&lt;BR&gt;&lt;BR&gt;&lt;B&gt;StringCollection sc = svr.GetDefaultInitFields(typeof(Table));&lt;/B&gt;&lt;BR&gt;&lt;BR&gt;svr.SetDefaultInitFields(typeof(Table), "CreateDate");&lt;BR&gt;foreach (Table t in db.Tables)&lt;BR&gt;{&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Console.WriteLine(t.Schema + "." + t.Name + " " + t.CreateDate);&lt;BR&gt;}&lt;BR&gt;&lt;B&gt;svr.SetDefaultInitFields(typeof(Table), sc);&lt;/B&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;BR&gt;The reason you want to be careful with this is that the SetDefaultInitFields setting is global to the Server object reference, and you are likely to hold on to the Server object instance reference (svr in the above example) to perform additional work with it. For example, if you were to call Refresh() on the Tables collection, any additional operation that would cause a table object to be instantiated in the collection will use the latest SetDefaultInitFields setting.&lt;BR&gt;&lt;BR&gt;SetDefaultInitFields has a few more helpful overloads that I will describe here:&lt;/P&gt;
&lt;TABLE class=MsoNormalTable cellPadding=0&gt;

&lt;TR&gt;
&lt;TD&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;SetDefaultInitFields(System.Type typeObject, System.Boolean allFields)&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;Specifies all properties are fetched when the specified object is instantiated. When set to false, the fields will be reset to default.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;SetDefaultInitFields(System.Boolean allFields)&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P class=MsoNormal&gt;&lt;SPAN&gt;Specifies all properties are fetched when &lt;B&gt;any&lt;/B&gt; object is instantiated. When set to false, the fields will be reset to default..&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;SPAN&gt;&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Recommendation: make sure your application is aware of this global Server state, and either specifically set the fields or reset to the previous value. If you do not take care about this, you may see sudden application degradation (or your customers may start to notice), and as it will be very hard to test all code paths you cannot know beforehand how your application is going to behave in the future if· this is not carefully managed. Also, if you pass the Server reference on to another library that component may change the field settings and cause 'mysterious' performance degradation that may be hard to debug.&lt;/SPAN&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=413906" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="SMO Samples" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SMO+Samples/" /></entry><entry><title>Starting with SQL Server 2005 WMI with help of Scriptomatic</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/04/27/sql-wmi-scriptomatic.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/04/27/sql-wmi-scriptomatic.aspx</id><published>2005-04-28T05:40:00Z</published><updated>2005-04-28T05:40:00Z</updated><content type="html">&lt;P&gt;SQL Server 2005 introduces a new WMI Provider that allows configuration of Services, Client Network Protocols, and Server Protocols. This is a great improvement for DBA that are managing many SQL Servers, as WMI allows you to query and modify SQL Server configuration settings remotely.&lt;/P&gt;
&lt;P&gt;Now, everyone who has&amp;nbsp;worked with WMI knows it's not easy to write a WMI program. You need to know the namespace, class names, etc. Everything that helps developers so well in VS (IntelliSense, object browsers) is not available to the scripters that are working on a bare system. I typically have a couple of WMI templates on my pen drive and start from there.&lt;/P&gt;
&lt;P&gt;I recently ran into &lt;STRONG&gt;&lt;FONT color=#006400&gt;Scriptomatic&lt;/FONT&gt;&lt;/STRONG&gt;. It's a great tool to give you good starting points for creating WMI scripts. It&amp;nbsp;provides you with a dropdown of namespaces available on the system, and classes within the selected namespace. It even allows creation of Perl&amp;nbsp;scripts...!&lt;/P&gt;
&lt;P&gt;Download it &lt;A href="http://www.microsoft.com/technet/scriptcenter/tools/scripto2.mspx"&gt;here&lt;/A&gt;&amp;nbsp;and then select the &lt;STRONG&gt;&lt;FONT color=#006400&gt;root\Microsoft\SqlServer\ComputerManagement&lt;/FONT&gt;&lt;/STRONG&gt; namespace; select the &lt;STRONG&gt;&lt;FONT color=#006400&gt;SqlService class&lt;/FONT&gt; &lt;/STRONG&gt;and voila, a ready to run script is displayed in the window. Quite nice! Here is an VbScript example:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000 size=1&gt;On Error Resume Next&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000 size=1&gt;Const wbemFlagReturnImmediately = &amp;amp;h10&lt;BR&gt;Const wbemFlagForwardOnly = &amp;amp;h20&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000 size=1&gt;arrComputers = Array("C3PO")&lt;BR&gt;For Each strComputer In arrComputers&lt;BR&gt;&amp;nbsp;&amp;nbsp; WScript.Echo&lt;BR&gt;&amp;nbsp;&amp;nbsp; WScript.Echo "=========================================="&lt;BR&gt;&amp;nbsp;&amp;nbsp; WScript.Echo "Computer: " &amp;amp; strComputer&lt;BR&gt;&amp;nbsp;&amp;nbsp; WScript.Echo "=========================================="&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000 size=1&gt;&amp;nbsp;&amp;nbsp; Set objWMIService = GetObject("winmgmts:\\" &amp;amp; strComputer &amp;amp; "\root\Microsoft\SqlServer\ComputerManagement")&lt;BR&gt;&amp;nbsp;&amp;nbsp; Set colItems = objWMIService.ExecQuery("SELECT * FROM SqlService", "WQL", _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wbemFlagReturnImmediately + wbemFlagForwardOnly)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#008000 size=1&gt;&amp;nbsp;&amp;nbsp; For Each objItem In colItems&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "AcceptPause: " &amp;amp; objItem.AcceptPause&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "AcceptStop: " &amp;amp; objItem.AcceptStop&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strAdvancedProperties = Join(objItem.AdvancedProperties, ",")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "AdvancedProperties: " &amp;amp; strAdvancedProperties&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "BinaryPath: " &amp;amp; objItem.BinaryPath&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "Clustered: " &amp;amp; objItem.Clustered&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strDependencies = Join(objItem.Dependencies, ",")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "Dependencies: " &amp;amp; strDependencies&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "Description: " &amp;amp; objItem.Description&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "DisplayName: " &amp;amp; objItem.DisplayName&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "ErrorControl: " &amp;amp; objItem.ErrorControl&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "ExitCode: " &amp;amp; objItem.ExitCode&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "HostName: " &amp;amp; objItem.HostName&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "ProcessId: " &amp;amp; objItem.ProcessId&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "ServiceName: " &amp;amp; objItem.ServiceName&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "SQLServiceType: " &amp;amp; objItem.SQLServiceType&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "StartMode: " &amp;amp; objItem.StartMode&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "StartName: " &amp;amp; objItem.StartName&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo "State: " &amp;amp; objItem.State&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo&lt;BR&gt;&amp;nbsp;&amp;nbsp; Next&lt;BR&gt;Next&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=412801" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="WMI Samples" scheme="http://blogs.msdn.com/b/mwories/archive/tags/WMI+Samples/" /></entry><entry><title>SQL Server: Tuning your SMO Application for great performance - PART 1 (featured at TechED)</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2005/04/22/smoperf1.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2005/04/22/smoperf1.aspx</id><published>2005-04-22T23:16:00Z</published><updated>2005-04-22T23:16:00Z</updated><content type="html">&lt;P&gt;&lt;FONT face=Arial color=#000000&gt;I'm ramping up for TechED 2005 (Both USA and Europe) and will be giving a couple of talks on SMO. This is a repost of an article from SqlJunkies, as I am still moving these blog entries to MSDN. Ping&lt;/FONT&gt;&lt;FONT face=Arial color=#000000&gt;&amp;nbsp;me if you are visiting TechED and are interested in certain SMO topics.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;
&lt;HR&gt;

&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Unlike SQL-DMO, &lt;FONT color=#0000ff&gt;SQL Server Management Objects (SMO)&lt;/FONT&gt; gives you a fairly fine level of control how data is retrieved from the server.&lt;BR&gt;&lt;BR&gt;When using default behavior, an SMO object transitions into the following states:&lt;BR&gt;&lt;BR&gt;1. Partially instantiated -- some properties are available (such as Name, Schema)&lt;BR&gt;2. Fully instantiated -- all low cost properties are retrieved in bulk when you retrieve any of these&lt;BR&gt;3. Expensive properties -- are fetched when needed, one at the time (such as database space)&lt;BR&gt;&lt;BR&gt;The rationale behind this is to allow the object model to scale when a high number of objects need to be retrieved, for example when populating a collection of 10,000 tables. In contrast, SQL-DMO always fetches all properties when populating a collection. This can be compared with doing a 'select * from xxx', when you only want to know something about name and the creation date of the object. SMO fetches only the minimal set of properties that are required to populate the collection (i.e. for Table, Name and Schema are needed to uniquely identify the object).&lt;BR&gt;&lt;BR&gt;Now here comes the catch: if your application does fetch extra properties, besides the minimally required ones, it will submit a query to retrieve these extra properties. This can cause your application to become extremely 'chatty', and will likely cause it to perform not as good (or just bluntly bad). This is especially noticed when doing 'foreach' enumerations, such as shown in the example below:&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#000080&gt;Server svr = new Server();&lt;BR&gt;&lt;BR&gt;Database db = svr.Databases["AdventureWorks"];&lt;BR&gt;foreach (Table t in db.Tables)&lt;BR&gt;{&lt;BR&gt;Console.WriteLine(t.Schema + "." + t.Name + " " + t.CreateDate);&lt;BR&gt;}&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;You can inspect the result by switching SQL Profiler on and looking at the number of batches that are emitted to SQL Server.&lt;BR&gt;&lt;BR&gt;When running above sample you will find about 155 rows in the SQL Profiler. The application is certainly chattier than it should be. This app's performance is especially down the drain on networks with a higher latency than a typical LAN, but even on a LAN it does not perform very well.&lt;BR&gt;&lt;BR&gt;Enter &lt;B&gt;Server.SetDefaultInitFields()&lt;/B&gt;. This call allows you to set the fields that are retrieved when the object gets initialized. This would add one extra line to the above sample:&lt;BR&gt;&lt;FONT color=#000080&gt;&lt;BR&gt;Server svr = new Server();&lt;BR&gt;&lt;BR&gt;Database db = svr.Databases["AdventureWorks"];&lt;BR&gt;&lt;B&gt;svr.SetDefaultInitFields(typeof(Table), "CreateDate");&lt;/B&gt;&lt;BR&gt;foreach (Table t in db.Tables)&lt;BR&gt;{&lt;BR&gt;Console.WriteLine(t.Schema + "." + t.Name + " " + t.CreateDate);&lt;BR&gt;}&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;Note that you do not have to indicate any of fields that are retrieved by default (Name, Schema).&lt;BR&gt;&lt;BR&gt;After running the above sample, you will find &lt;B&gt;only 11&lt;/B&gt; rows in SQL Profiler, and you will also notice that the first sample you could see it fill the screen line by line (I'm running this on a 1.8Ghz P4 Toshiba notebook with 1Gb of memory) and the optimized sample flashes by and disappears in a split second (could have added some timing to the sample, but for clarity I keeping it as short as possible.&lt;BR&gt;&lt;BR&gt;&lt;FONT color=#0000ff size=2&gt;The bottom line is that you need to understand your application behavior and tuning will make a big difference. With more options to tune SMO, the responsibility to tune your application has shifted to you, as SMO cannot guess what your application is going to request. &lt;I&gt;"With great power comes great responsibility"&lt;/I&gt; :-)&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;Next post will be on some of the more advanced tuning options SMO has to offer. If you have a special request about what you like me post on in the SMO space (or SQL-DMO, SQLCMD, OSQL, SQL WMI Provider, SQL Computer Manager, or XP's for that matter), then let me know.&lt;BR&gt;&lt;BR&gt;Michiel Wories (a PM on the SQL Server Team)&lt;BR&gt;---&lt;BR&gt;See also: &lt;A title=http://staff.develop.com/bobb/weblog/PermaLink.aspx?guid=0c070aff-a30f-4669-b0ae-ef7a2cde81c6 href="http://staff.develop.com/bobb/weblog/PermaLink.aspx?guid=0c070aff-a30f-4669-b0ae-ef7a2cde81c6" target=_blank&gt;http://staff.develop.com/bobb/weblog/PermaLink.aspx?guid=0c070aff-a30f-4669-b0ae-ef7a2cde81c6&lt;/A&gt;&lt;BR&gt;---&lt;BR&gt;This posting is provided "AS IS" with no warranties, and confers no rights. &lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=410875" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="SMO Samples" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SMO+Samples/" /></entry><entry><title>Moving over to a new blog... And something about me</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/mwories/archive/2004/12/22/330234.aspx" /><id>http://blogs.msdn.com/b/mwories/archive/2004/12/22/330234.aspx</id><published>2004-12-22T22:51:00Z</published><updated>2004-12-22T22:51:00Z</updated><content type="html">&lt;div&gt;Moving over my blog from sqljunkies. At sqljunkies I had made a start with some background articles about&amp;nbsp;SQL Server Management Objects&amp;nbsp;and I have a whole bunch of articles lined up for this blog. &lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;A&amp;nbsp;quick introduction --&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;I moved from The Netherlands to the U.S. and started working for Microsoft about 3 1/2&amp;nbsp;years ago. Before this I had worked as Principal Architect for a large ERP company, responsible for the architecture of Development Tools and Runtime. In '99 I&amp;nbsp;attended an (mostly) academic Lab organized by the .NET Framework/CLR team on a very early versions of the C#, the CLR and the .NET Framework&amp;nbsp;in order to see whether we could move our language and application over to the CLR. We had developed our own Language/Runtime in the late 80's which looked very similar to .NET Runtime, it being slightly different as it runs always interpreted code -- JIT compilation was out of the question if you have to support more than 10000 applications on 30+ platforms -- you will be surprised how unreliable certain compilers are if throw enough code at them and this would blow the test matrix out of the water, not thinking about the possible support nightmare this would be as well.&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;At the Lab I was intrigued&amp;nbsp;by the vision that Microsoft had by developing a language and platform independent runtime (which we had reaped the benefits of for already 10 years) and in 2000 I decided it was time to move to a new challenge and Microsoft had moved to the top of my list&amp;nbsp;before&amp;nbsp;ABN-AMRO which offered be a job as Architect, and another offer to become CTO&amp;nbsp;for&amp;nbsp;an Internet startup (bricks and clicks type). The choice for Microsoft was easily made, and after being grilled by the interviewers, I received an offer to go work with the SQL Server team (to be frank I thought I flunked the interview which I've heard is not an uncommon reaction after being hammered to bits for a full day). It's been a dream come true and a fun ride. SQL Server is an amazing product built by an amazing set of people and I'm pretty happy that I can be a part of such a major release as Yukon.... My team is SQL Server Tools -- see also&amp;nbsp;&lt;A href="http://blogs.msdn.com/euanga"&gt;Euan Garden's blog&lt;/a&gt;.&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;Well, that all for now. Wishing you&amp;nbsp;all happy holidays and a good 2005 (which is going to be an exciting year for the SQL Server team&amp;nbsp;as well :-)&lt;/div&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;div&gt;If anyone wants to say hi, please do.&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=330234" width="1" height="1"&gt;</content><author><name>mwories</name><uri>http://blogs.msdn.com/mwories/ProfileUrlRedirect.ashx</uri></author><category term="Personal" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Personal/" /><category term="SQL Server" scheme="http://blogs.msdn.com/b/mwories/archive/tags/SQL+Server/" /><category term="Microsoft" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Microsoft/" /><category term="Netherlands/Europe" scheme="http://blogs.msdn.com/b/mwories/archive/tags/Netherlands_2F00_Europe/" /></entry></feed>