<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Dan's Blog : PowerShell</title><link>http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx</link><description>Tags: PowerShell</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Using PowerShell to Get Data &amp; Log File Sizes</title><link>http://blogs.msdn.com/dtjones/archive/2009/03/21/using-powershell-to-get-data-log-file-sizes.aspx</link><pubDate>Sun, 22 Mar 2009 00:42:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9496563</guid><dc:creator>dtjones</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/dtjones/comments/9496563.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dtjones/commentrss.aspx?PostID=9496563</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dtjones/rsscomments.aspx?PostID=9496563</wfw:comment><description>&lt;p&gt;I was playing around with PowerShell today (yes I’m was geeking out on Saturday afternoon) to learn how to access Performance Counters using PowerShell. My mission was to write a script that would return the Data File and Log File sizes for each database and a total for the instance. The good news is SQL Server already provides a bunch of fun performance counters and PowerShell has built-in support for accessing performance counters. I thought this was pretty cool so I decided to share it. In addition, I hadn’t blogged in a while and I was feeling bad about that. &lt;/p&gt;  &lt;p&gt;There are two groups of scripts and sample output below: 1) Data File Space and 2) Log File Space.&lt;/p&gt;  &lt;p&gt;Sorry about the formatting of the output I’m just being lazy today – after all it is Saturday.&lt;/p&gt;  &lt;p&gt;Have fun with it!&lt;/p&gt;  &lt;p&gt;Oh, btw: I was doing this on a Win7 machine (which I also need to give an update on) so I had to launch PS as administrator so it had access to the perf counters (same should be true on Vista and Windows Server 2K8). If you don’t launch as admin you’ll get an error that looks like this:&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000" size="2" face="Courier New"&gt;Get-Counter : The specified instance is not present.      &lt;br /&gt;At line:1 char:26       &lt;br /&gt;+ $DBDataFile = Get-Counter &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;#160; -Counter '\MSSQL$SQL2K8_01:Databases(*)\Data File(s) Size (KB)' -MaxSamples 1       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; + CategoryInfo&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; : InvalidResult: (:) [Get-Counter], Exception       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; + FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.GetCounterCommand&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Data File Space&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;#Displays the total Data File size for each database (including system databases)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;$DBDataFile = Get-Counter -Counter '\MSSQL$SQL2K8_01:Databases(*)\Data File(s) Size (KB)' -MaxSamples 1&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;$DBDataFile.CounterSamples | where-object -FilterScript {($_.InstanceName -ne &amp;quot;_total&amp;quot;)} | sort-object -Property InstanceName | format-table @{Label = &amp;quot;Database&amp;quot;; Expression={$_.InstanceName}}, @{Label = &amp;quot;Total Data File(s) Size (MB)&amp;quot;; Express={$_.CookedValue/1000}} -AutoSize&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;Database Total Data File(s) Size (MB)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;-------- ----------------------------&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;ansicheck 2.304&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;master 4.096&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;model 1.28&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;msdb 10.752&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;mssqlsystemresource 61.696&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;pbm-prototype 2.048&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;tempdb 8.192&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;We can also just grab the total Data File space used by the instance:&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;$DBDataFile = Get-Counter -Counter '\MSSQL$SQL2K8_01:Databases(*)\Data File(s) Size (KB)' -MaxSamples 1&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;$DBDataFile.CounterSamples | where-object -FilterScript {($_.InstanceName -eq &amp;quot;_total&amp;quot;)} | sort-object -Property InstanceName | format-table @{Label = &amp;quot;Database&amp;quot;; Expression={$_.InstanceName}}, @{Label = &amp;quot;Total Data File(s) Size (MB)&amp;quot;; Express={$_.CookedValue/1000}} -AutoSize&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;Database Total Data File(s) Size (MB)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;-------- ----------------------------&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;_total 90.368&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Log File Space&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;#Displays the total Log File size for each database (including system databases)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;$DBLogFile = Get-Counter -Counter '\MSSQL$SQL2K8_01:Databases(*)\Log File(s) Size (KB)' -MaxSamples 1&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;$DBLogFile.CounterSamples | where-object -FilterScript {($_.InstanceName -ne &amp;quot;_total&amp;quot;)} | sort-object -Property InstanceName | format-table @{Label = &amp;quot;Database&amp;quot;; Expression={$_.InstanceName}}, @{Label = &amp;quot;Total Log File(s) Size (MB)&amp;quot;; Express={$_.CookedValue/1000}} -AutoSize&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;Database Total Log File(s) Size (MB)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;-------- ---------------------------&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;ansicheck 0.496&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;master&amp;#160;&amp;#160;&amp;#160; 1.016&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;model 0.504&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;msdb 0.504&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;mssqlsystemresource 0.504&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;pbm-prototype 1.016&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;tempdb 0.504&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;We can also just grab the total Log File space used by the instance:&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;$DBLogFile = Get-Counter -Counter '\MSSQL$SQL2K8_01:Databases(*)\Log File(s) Size (KB)' -MaxSamples 1&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#008000" size="2" face="Courier New"&gt;$DBLogFile.CounterSamples | where-object -FilterScript {($_.InstanceName -eq &amp;quot;_total&amp;quot;)} | sort-object -Property InstanceName | format-table @{Label = &amp;quot;Database&amp;quot;; Expression={$_.InstanceName}}, @{Label = &amp;quot;Total Log File(s) Size (MB)&amp;quot;; Express={$_.CookedValue/1000}} –AutoSize&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;Database Total Log File(s) Size (MB)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;-------- ---------------------------&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#0000a0" size="2" face="Courier New"&gt;_total 4.544&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9496563" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>PowerShell vs. T-SQL or Why Did We Add PowerShell Support in SQL2K8</title><link>http://blogs.msdn.com/dtjones/archive/2008/08/29/powershell-vs-t-sql-or-why-did-we-add-powershell-support-in-sql2k8.aspx</link><pubDate>Fri, 29 Aug 2008 19:29:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8905682</guid><dc:creator>dtjones</dc:creator><slash:comments>11</slash:comments><comments>http://blogs.msdn.com/dtjones/comments/8905682.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dtjones/commentrss.aspx?PostID=8905682</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dtjones/rsscomments.aspx?PostID=8905682</wfw:comment><description>&lt;p&gt;&lt;font color="#0000a0"&gt;The following write-up was originally an email I sent to&lt;/font&gt; &lt;a href="http://sqlblog.com/blogs/allen_white/default.aspx" target="_blank"&gt;Allan White&lt;/a&gt; &lt;font color="#0000a0"&gt;(SQL Server MVP) in the context of a discussion on PowerShell and some of the PowerShell community postings questioning why SQL Server needed PowerShell support @ all given the strength of T-SQL. Allan and others encouraged me to post the response. I realize there are times when the SQL Server product team appears opaque. In general this is not intentional. There are situations when we're working on very new stuff that cannot be discussed publicly (we function in a very competitive market), but generally we want to engage with the community and share the reasons we make certain decisions. I hope you find this posting informative and interesting. Note: I edited the original email just a little so that it made sense without the additional back and forth threads.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Within Microsoft we have a concept called Common Engineering Criteria (CEC). The goal of CEC is to establish consistency across IT products (Windows Server, Exchange, SQL Server, BizTalk, System Center, etc). Some of the requirements of CEC include items like virtualization support, security requirements, System Center support, localization requirements, and installation and patching requirements. I&amp;#8217;m sure I don&amp;#8217;t need to go into detail on why this is a good thing for our customers.&lt;/p&gt;  &lt;p&gt;One of the latest CEC requirements is support for PowerShell. The old requirement used to be generic support for scripting. Imagine a world where every product used a different scripting syntax and had different constructs for error handling and procedural execution. Yuck! Just the cost to develop and maintain this would be enormous. There would be no consistency and each team would reinvent the wheel. This all might be fine if users never used more than one product. But we know that&amp;#8217;s not the case. Lines of responsibility are blurring and IT professionals have to learn and use multiple products. Developers also must use multiple products.&lt;/p&gt;  &lt;p&gt;While DBAs have traditionally been a specialized bunch and typically work solely with SQL Server we see this changing. For example, think of SharePoint. I had a number of people come up to me @ TechEd this year asking questions about SQL Server from a SharePoint perspective. These people have never written Transact-SQL and have no clue what a foreign key relationship is. They have no interest in learning T-SQL, rather they have a business need to keep the environment up and running &amp;#8211; that&amp;#8217;s what they&amp;#8217;re measured on. If both products (SharePoint and SQL Server) implement a similar scripting language this person is instantly more comfortable &amp;#8211; there&amp;#8217;s automatic orientation. Yes there are new nouns and verbs to learn but there isn&amp;#8217;t new syntax to learn. The fact that both products leverage the same scripting language places power in the user&amp;#8217;s hands. They don&amp;#8217;t have to &amp;#8220;shell out&amp;#8221; of one environment to make something happen in another.&lt;/p&gt;  &lt;p&gt;Transact-SQL is a &lt;u&gt;good&lt;/u&gt; scripting language but it&amp;#8217;s not model driven. We will continue to invest in and evolve T-SQL. But we&amp;#8217;ll also continue to invest in and evolve the models over DDL and DML. The model over DDL is SMO. The model over DML is EDM. We built PBM over SMO. This gave us instant backward compatibility with SQL2K5 and SQL2K. If we had to develop our own model over T-SQL we would have had to build the backward compatibility on our own. Frankly we wouldn&amp;#8217;t have done this as the cost would&amp;#8217;ve been too great. We also expose PBM in PowerShell which opens up use cases that wouldn&amp;#8217;t be possible without extending the T-SQL language (an expensive proposition) or forcing DBAs to write C# or VB to accomplish seemingly simple tasks.&lt;/p&gt;  &lt;p&gt;Take a database backup as an example. As part of the backup script I may want to find a volume which has greater than a minimum amount disk space and back-up to that drive. How do I do this in T-SQL? Or take a script that needs to be aware of the OS or processor the instance is running on. How do I get that from T-SQL? I&amp;#8217;ve had a number of requests for help building policies which we just can&amp;#8217;t do because either we don&amp;#8217;t have a facet to support it or T-SQL can&amp;#8217;t get access to the information. But if PBM had PowerShell support we&amp;#8217;d be golden. As an aside, I really wish we added PowerShell support to PBM in the form of an ExecutePowerShellScript() function. We didn&amp;#8217;t because of time constraints. Yes we can always add this stuff to T-SQL but we&amp;#8217;ll be in a perpetual state of catch up. That&amp;#8217;s a frustrating place for us and our customers.&lt;/p&gt;  &lt;p&gt;Both PowerShell and our implementation on PowerShell are v1 products. They will evolve and get better. SMO is a v2 product and it&amp;#8217;s evolving and getting better. In SQL11 we&amp;#8217;ll make investments in T-SQL. Our goal in SQL Server manageability is to get out of the business of delivery one off tools and move to a state where everything is model driven. This creates an environment that is far more consistent and predictable. It allows us to build capability once and expose it in many places. For example, we want to get to the point where all we have to do is add a new object to SMO and it&amp;#8217;s automatically available in PowerShell, SSMS, PBM, System Center, etc without making changes to those environments. &lt;/p&gt;  &lt;p&gt;APIs aren&amp;#8217;t always user friendly. The implementation may be pure from a coding and relationship perspective but from a usability perspective it may be hard to work with. Take a table object in SMO. It takes a lot of &amp;#8220;work&amp;#8221; to construct a new table in SMO. It&amp;#8217;s far easier in T-SQL. But if I don&amp;#8217;t know T-SQL and I know PowerShell wouldn&amp;#8217;t a create-table cmdlet be valuable to me? The same goes for backing up a database. This is where the power of models and abstractions are realized. After all, when was the last time you wrote assembly code? &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8905682" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>TechEd North America Session Videos</title><link>http://blogs.msdn.com/dtjones/archive/2008/07/31/teched-north-america-session-videos.aspx</link><pubDate>Thu, 31 Jul 2008 18:00:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8793421</guid><dc:creator>dtjones</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/dtjones/comments/8793421.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dtjones/commentrss.aspx?PostID=8793421</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dtjones/rsscomments.aspx?PostID=8793421</wfw:comment><description>&lt;p&gt;In shameless self promotion the video of the talk I did on &lt;a href="http://www.microsoft.com/emea/spotlight/sessionh.aspx?videoid=984" target="_blank"&gt;PowerShell and SQL Server&lt;/a&gt; has been posted to the web. I haven't watched this as I just can't bring myself to sit and watch myself for an hour but the session evaluations were pretty good. Therefore I think the odds are pretty good you'll get something out of this session, especially if you're new to PowerShell. A bunch of other talks have also been posted. Here's the &lt;a href="http://www.microsoft.com/emea/spotlight/event.aspx?id=104" target="_blank"&gt;landing page&lt;/a&gt; for the videos.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8793421" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx">PowerShell</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/TechEd/default.aspx">TechEd</category></item><item><title>Launching Vanilla PowerShell from SSMS</title><link>http://blogs.msdn.com/dtjones/archive/2008/07/01/launching-vanilla-powershell-from-ssms.aspx</link><pubDate>Tue, 01 Jul 2008 20:22:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8677898</guid><dc:creator>dtjones</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dtjones/comments/8677898.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dtjones/commentrss.aspx?PostID=8677898</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dtjones/rsscomments.aspx?PostID=8677898</wfw:comment><description>&lt;p&gt;One of the criticisms of our PowerShell implementation is the integration with Management Studio launches our custom minishell. With just a few simple key strokes you can add a custom tool menu item and toolbar button. To do this select &amp;quot;External Tools...&amp;quot; from the &amp;quot;Tools&amp;quot; menu in Management Studio.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/ExternalToolsMenu.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="194" alt="ExternalToolsMenu" src="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/ExternalToolsMenu_thumb.png" width="393" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;The following dialog is displayed.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/ExternalToolsDialog.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="363" alt="ExternalToolsDialog" src="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/ExternalToolsDialog_thumb.png" width="374" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The above picture shows the dialog filled in to launch the vanilla PowerShell shell. You could add custom arguments, such as -nologo, if you desire and you can set the default directory. You could also use this to run a specific script. The title you enter will show up in the &amp;quot;Tools&amp;quot;. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/CustomToolMenuItem.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="183" alt="CustomToolMenuItem" src="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/CustomToolMenuItem_thumb.png" width="387" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Once you've registered the custom tool you can add it to any toolbar. Here I'll add it to the default toolbar. Just select &amp;quot;Customize...&amp;quot; from the &amp;quot;Tools&amp;quot; menu.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/CustomizeMenu.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="203" alt="CustomizeMenu" src="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/CustomizeMenu_thumb.png" width="363" border="0" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;The Customize dialog will be displayed. Unfortunately Visual Studio doesn't replace the generic &amp;quot;External Command 1&amp;quot;. In this example I only have one external tool defined so I'll grab &amp;quot;External Command 1&amp;quot; and drag it to the toolbar. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/CustomizeDialog.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="356" alt="CustomizeDialog" src="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/CustomizeDialog_thumb.png" width="464" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This adds a button to the toolbar to launch the custom tool. Thankfully Visual Studio replaces the generic name with the name entered into the Title field.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/CustomToolbarButton.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="78" alt="CustomToolbarButton" src="http://blogs.msdn.com/blogfiles/dtjones/WindowsLiveWriter/LaunchingVanillaPowerShellfromSSMS_12C9A/CustomToolbarButton_thumb.png" width="438" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The first-class integration on the Object Explorer context menu will launch you into SQLPS.exe directly to the selected object. This integration won't do the same but if you need to shell out into vanilla PowerShell this is a quick way to do so from within SSMS. If you combine this with the &lt;a href="http://blogs.msdn.com/mwories/archive/2008/06/14/SQL2008_5F00_Powershell.aspx" target="_blank"&gt;registration of the SQL Server provider extensions in a vanilla PS environment&lt;/a&gt; you might just get close to the best of both worlds.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8677898" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/Management+Studio/default.aspx">Management Studio</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>The SQLPS Firestorm Part Duex</title><link>http://blogs.msdn.com/dtjones/archive/2008/06/24/the-sqlps-firestorm-part-duex.aspx</link><pubDate>Wed, 25 Jun 2008 03:45:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8649890</guid><dc:creator>dtjones</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dtjones/comments/8649890.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dtjones/commentrss.aspx?PostID=8649890</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dtjones/rsscomments.aspx?PostID=8649890</wfw:comment><description>&lt;p&gt;On the &lt;a href="http://blogs.msdn.com/powershell/archive/2008/06/23/sql-minishells.aspx" target="_blank"&gt;PowerShell team's blog&lt;/a&gt; Architect Jeffrey Snover addresses the recent firestorm on SQLPS.&lt;/p&gt;  &lt;p&gt;BTW: he was a lot nicer about the engagement model than I would have been. I do want all feedback, positive and critical. Just make it constructive. Getting nasty and throwing insults just makes you look like an idiot and ensures the person you want to receive your message will stop listening.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8649890" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>The SQLPS Firestorm</title><link>http://blogs.msdn.com/dtjones/archive/2008/06/18/the-sqlps-firestorm.aspx</link><pubDate>Thu, 19 Jun 2008 09:15:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8620465</guid><dc:creator>dtjones</dc:creator><slash:comments>11</slash:comments><comments>http://blogs.msdn.com/dtjones/comments/8620465.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dtjones/commentrss.aspx?PostID=8620465</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dtjones/rsscomments.aspx?PostID=8620465</wfw:comment><description>&lt;p&gt;Within the PowerShell community there's a firestorm raging over SQLPS.exe our mini-shell that we're introducing in SQL2K8. In his &lt;a href="http://blogs.msdn.com/mwories/archive/2008/06/14/SQL2008_5F00_Powershell.aspx" target="_blank"&gt;blog&lt;/a&gt; Michiel does a good job explaining the mini-shell and provides a script you can use to register the SQL Server provider extensions in a vanilla PS environment.&lt;/p&gt;  &lt;p&gt;I love it when people who obviously have zero commercial software experience pontificate about what's right and wrong. Actually I don't love it. It something that pisses me off big time. These individuals think they're &amp;quot;helping&amp;quot; but they're not. They make claims that they want to understand but they don't really. To them the world is binary - they're TRUE and everyone who disagrees with them is FALSE. In elementary school we called these people bullies.&lt;/p&gt;  &lt;p&gt;I'm purposefully not naming names here as it will do no good. I have no interest going head to head with them. It's a no win proposition - in fact everyone ends up loosing. &lt;/p&gt;  &lt;p&gt;I don't like using this blog to air my opinions, I much rather focusing purely on technology and SQL Server. But they're defamation of the SQL Server team is simply uncalled for.&lt;/p&gt;  &lt;p&gt;I'm very proud of the work the team did in SQL2K8. Is everything perfect? Absolutely not. Are we adding a ship load of value to the product? Absolutely. &lt;/p&gt;  &lt;p&gt;If you don't like what we've down with PowerShell you're free to roll your own. PowerShell is an open environment for which you can register your own providers and build your own cmdlets. There's no restriction that states you must use sqlps.exe. Even within SQL Server Agent you can use the cmdshell subsystem to call powershell.exe directly. But we believe the vast majority of people will find value in sqlps.exe and the PowerShell subsystem in Agent. Hence why we built it.&lt;/p&gt;  &lt;p&gt;Send us your feedback through &lt;a href="http://connect.microsoft.com/sqlserver"&gt;http://connect.microsoft.com/sqlserver&lt;/a&gt; and I promise we'll listen. It doesn't mean we'll implement every suggestion but we'll listen. I've been developing software @ MS for over 4 years and the amount of debate and discussion that goes into key decisions is often mind numbing. Maybe it looks like we simply pull the answer out of our ass but that's not the case. We look at it from every angle and consider all of our constraints to arrive at the most optimum solution.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8620465" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>TechEd 2008 is Done!</title><link>http://blogs.msdn.com/dtjones/archive/2008/06/13/teched-2008-is-done.aspx</link><pubDate>Fri, 13 Jun 2008 23:44:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8594973</guid><dc:creator>dtjones</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dtjones/comments/8594973.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dtjones/commentrss.aspx?PostID=8594973</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dtjones/rsscomments.aspx?PostID=8594973</wfw:comment><description>&lt;p&gt;I'm writing this on the plane from Orlando back to Seattle. I have lots of thoughts on TechEd that I'll try to get through before I run out of battery or the guy in front of me snaps my laptop display. I also want to answer a few of the questions that came up that I couldn't immediately answer. I'll post the code from the sessions on another blog post. The PBM code will be posted to the PBM &lt;a href="http://blogs.msdn.com/sqlpbm" target="_blank"&gt;blog&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;I am thoroughly impressed by our customers. They have incredible passion for our products and an endless desire to learn how to use our products more effectively, intelligently, efficiently, and completely. I thank each and every one of you for making my job so fun and pleasurable. Thank you for coming up and asking questions (whenever and wherever), thank you for submitting your evals - I take the feedback to heart, and thank you for betting your business on SQL Server. Without you I'd probably be a starving musician.&lt;/p&gt;  &lt;p&gt;I did a ton of time at the booth, co-presented one interactive theater on using SQL2K8 for compliance, participated in two Tech-Ed Online Panels (TEOPs): Compliance and Automating DBA Tasks, presented a breakout (BRK) session on PowerShell and co-presented a session on Policy-Based Management. &lt;/p&gt;  &lt;p&gt;Interactive Theater: I'm undecided if I like this format or not. Maybe it's just that compliance is a tough topic to discuss since there is so much interpretation that has to happen and there's no one-size-fits-all solution. I co-presented this with Il-Sung Lee a security PM in SQL Server. Il-Sung is so knowledgeable about his space and gave the audience a very good taste of Transparent Data Encryption (don't forget to backup the certificate!) and Auditing. I had directed on person that came to the security kiosk to the session. They came up to me afterward and thanked me.&lt;/p&gt;  &lt;p&gt;TEOP: Compliance: This was fun although we didn't have much of an audience. I really like this format and encourage the TechEd planners to extend it. The people on the panel make all the difference. &lt;/p&gt;  &lt;p&gt;TEOP: Automating DBA Tasks: Wow, I was up there with Allen White (SQL MVP), Steve Jones (SQL MVP), Kevin Kline (SQL MVP), and Buck Woody (former SQL MVP and now a PM on the SQL Server team). Talk about a humbling experience. It was absolutely fantastic. These guys are terrific and posses such incredible knowledge about SQL Server and the role of the DBA. Great job guys!&lt;/p&gt;  &lt;p&gt;BRK: PowerShell: The feedback on this session was that I didn't spend enough time on SQL Server and too much time on vanilla PowerShell. Honestly this was by design and I think after people get back to the office and start using PowerShell they'll understand why I structure the session this way. One question that came up was the use of DAC (Dedicated Admin Connection). This is not support within PowerShell or our PowerShell provider. Another question was the use of SQL Logins. It's possible but not totally clean. It's documented in BOL &lt;a href="http://msdn.microsoft.com/en-us/library/cc281947(SQL.100).aspx" target="_blank"&gt;here&lt;/a&gt;. There were more questions which I asked people to email. I'm still waiting for the email! Once I get them I'll post them.&lt;/p&gt;  &lt;p&gt;BRK: PBM: I want to thank Peter DeBetta (SQL MVP) for co-presenting with me. I think Peter knows some facets (pun intended) of PBM better than I. BTW: My wife won't let me name the boy Wequel Sequel Jones - probably a good thing. This was, however, a tough session. It'd didn't flow the way I wanted it to. The feedback was that it was a little disjointed. Not to mention I messed up and thought the session started at 4:45 rather than 4:30. Sorry for blowing the first 7 or 8 minutes. But hey who doesn't like a good Bugs Bunny cartoon. The passion for PBM is immense. I remain convinced PBM is going to forever transform the management of the data platform. Y'all will get to say you were there when it all started. There were also some questions during this session that I didn't have the answer to. If you're out there please email your question. If you forgot my email address you can always send it through the blog. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Thank you for making my experience at TechEd valuable and memorable. I don't like taking time away from my family unless it's truly valuable and fruitful. Once again you, the customer, have satisfied both. I hope you got as much out of the experience as I did.&lt;/p&gt;  &lt;p&gt;One final note: If you're the guy that came up to me at Universal asking about my round at Pebble Beach I apologize for costing you $10. I pared a few holes (namely 7 and 17!). But I had a few disasters (namely 2 and 8). We don't have much sand on our courses in Seattle so that part of my game is out of practice. Also it was my first full round in 6 months and the first round after breaking my collar bone in January. I won't try snowboarding again!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8594973" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dtjones/archive/tags/Policy/default.aspx">Policy</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server/default.aspx">SQL Server</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx">PowerShell</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/TechEd/default.aspx">TechEd</category></item><item><title>PowerShell Resources</title><link>http://blogs.msdn.com/dtjones/archive/2008/06/06/powershell-resources.aspx</link><pubDate>Sat, 07 Jun 2008 00:50:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8579043</guid><dc:creator>dtjones</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dtjones/comments/8579043.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dtjones/commentrss.aspx?PostID=8579043</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dtjones/rsscomments.aspx?PostID=8579043</wfw:comment><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;SQL Server Books Online&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/cc281954(SQL.100).aspx" target="_blank"&gt;PowerShell Overview&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/cc281939(SQL.100).aspx" target="_blank"&gt;SQL Server PowerShell Help&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/cc281945(SQL.100).aspx" target="_blank"&gt;SQL Server Learning PowerShell&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;PowerShell Team&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.microsoft.com/powershell" target="_blank"&gt;MSDN PowerShell Site&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/powershell/" target="_blank"&gt;PowerShell Team Blog&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/powershell/attachment/1561580.ashx" target="_blank"&gt;Cheat Sheet&lt;/a&gt; (This is Great!)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Books&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://search.barnesandnoble.com/Windows-Powershell-in-Action/Bruce-Payette/e/9781932394900/?itm=1" target="_blank"&gt;Windows PowerShell in Action&lt;/a&gt; by Bruce Payette &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.amazon.com/Windows-PowerShell-Cookbook-Exchange-2007/dp/0596528493/ref=pd_bbs_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1210609482&amp;amp;sr=8-1" target="_blank"&gt;Windows PowerShell Cookbook&lt;/a&gt; by Lee Holmes &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Other&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx" target="_blank"&gt;PowerShell Script Center on TechNet&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/buckwoody/" target="_blank"&gt;Buck Woody's Blog&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8579043" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dtjones/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category><category domain="http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>More PowerShell</title><link>http://blogs.msdn.com/dtjones/archive/2008/03/29/more-powershell.aspx</link><pubDate>Sun, 30 Mar 2008 05:00:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8343931</guid><dc:creator>dtjones</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/dtjones/comments/8343931.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dtjones/commentrss.aspx?PostID=8343931</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dtjones/rsscomments.aspx?PostID=8343931</wfw:comment><description>&lt;p&gt;Check out this &lt;a href="http://www.leeholmes.com/blog/BgShellNdashBackgroundShell.aspx" target="_blank"&gt;blog entry&lt;/a&gt; for BgShell a new PowerShell host. I'm just amazed at the endless possibility PowerShell provides. I haven't pulled this down yet, but I could imagine using it to automate common daily tasks. The problem I encounter is I don't have that many repetitive tasks; although if I could get it to reply to my email for me that would be very cool!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8343931" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Getting Started with PowerShell</title><link>http://blogs.msdn.com/dtjones/archive/2008/03/07/getting-started-with-powershell.aspx</link><pubDate>Fri, 07 Mar 2008 18:59:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8100765</guid><dc:creator>dtjones</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/dtjones/comments/8100765.aspx</comments><wfw:commentRss>http://blogs.msdn.com/dtjones/commentrss.aspx?PostID=8100765</wfw:commentRss><wfw:comment>http://blogs.msdn.com/dtjones/rsscomments.aspx?PostID=8100765</wfw:comment><description>&lt;p&gt;The February CTP for SQL2K8 included first class support for PowerShell. Many people have ask how they can get started with PowerShell - not just using PowerShell to interact with SQL Server but just using PowerShell in general. PowerShell was a wealth of powerful features built-in. Here are a few PowerShell resources to get you started. In short, it's time to throw out those VBS scripts and move to the powerful world of PowerShell. After all, they it wouldn't have &amp;quot;power&amp;quot; in the name if it wasn't &amp;quot;powerful&amp;quot;! &lt;/p&gt;  &lt;p&gt;Main PowerShell page: &lt;a title="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx"&gt;http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Getting Started Guide: &lt;a title="http://msdn2.microsoft.com/en-us/library/aa973757.aspx" href="http://msdn2.microsoft.com/en-us/library/aa973757.aspx"&gt;http://msdn2.microsoft.com/en-us/library/aa973757.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Channel 9 PowerShell Wiki: &lt;a title="http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki" href="http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki"&gt;http://channel9.msdn.com/wiki/default.aspx/Channel9.WindowsPowerShellWiki&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;On Demand Web Cast (Windows PowerShell and Manageability Improvements in Windows Server 2008): &lt;a title="http://technet.microsoft.com/en-us/bb899729.aspx" href="http://technet.microsoft.com/en-us/bb899729.aspx"&gt;http://technet.microsoft.com/en-us/bb899729.aspx&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8100765" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/dtjones/archive/tags/PowerShell/default.aspx">PowerShell</category></item></channel></rss>