<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.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>Hey, Scripting Guy! How Can I Use the SQL Server Mini-Shell Version of Windows PowerShell?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2009/05/28/how-can-i-use-the-sql-server-mini-shell-version-of-windows-powershell.aspx</link><description>Hey, Scripting Guy! One thing I do not understand is why the SQL Server team wrote its own version of Windows PowerShell. I thought Windows PowerShell was supposed to standardize things. But the SQL Server team has one version of Windows PowerShell, the</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Hey, Scripting Guy! How Can I Use the SQL Server Mini-Shell Version of Windows PowerShell?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2009/05/28/how-can-i-use-the-sql-server-mini-shell-version-of-windows-powershell.aspx#3376621</link><pubDate>Tue, 21 Dec 2010 17:00:45 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3376621</guid><dc:creator>Buck Woody</dc:creator><description>&lt;p&gt;No - you can just install the &amp;quot;Client Tools&amp;quot; from 2K8 or higher to get the snap in. Or just run this command with the right server name: &lt;/p&gt;
&lt;p&gt;# Connect and run a command using SQL Native Client, Returns a recordset&lt;/p&gt;
&lt;p&gt;# Create and open a database connection&lt;/p&gt;
&lt;p&gt;$sqlConnection = new-object System.Data.SqlClient.SqlConnection &amp;quot;server=(local);database=AdventureWorks;Integrated Security=sspi&amp;quot;&lt;/p&gt;
&lt;p&gt;$sqlConnection.Open()&lt;/p&gt;
&lt;p&gt;# Create a command object&lt;/p&gt;
&lt;p&gt;$sqlCommand = $sqlConnection.CreateCommand()&lt;/p&gt;
&lt;p&gt;$sqlCommand.CommandText = &amp;quot;SELECT @@VERSION&amp;quot; &lt;/p&gt;
&lt;p&gt;# Execute the Command&lt;/p&gt;
&lt;p&gt;$sqlReader = $sqlCommand.ExecuteReader()&lt;/p&gt;
&lt;p&gt;# Parse the records&lt;/p&gt;
&lt;p&gt;while ($sqlReader.Read()) &lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;Write-Host $sqlReader[&amp;quot;FirstName&amp;quot;] &lt;/p&gt;
&lt;p&gt;Write-Host $sqlReader[&amp;quot;LastName&amp;quot;]&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;# Close the database connection&lt;/p&gt;
&lt;p&gt;$sqlConnection.Close()&lt;/p&gt;
&lt;p&gt;$Cellrange.Font.Bold = $True&lt;/p&gt;
&lt;p&gt;$Cellrange.EntireColumn.AutoFit()&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3376621" width="1" height="1"&gt;</description></item><item><title>re: Hey, Scripting Guy! How Can I Use the SQL Server Mini-Shell Version of Windows PowerShell?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2009/05/28/how-can-i-use-the-sql-server-mini-shell-version-of-windows-powershell.aspx#3342507</link><pubDate>Wed, 07 Jul 2010 14:23:57 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3342507</guid><dc:creator>Ben Weeks</dc:creator><description>&lt;p&gt;I would like to connect to SQL server remotely, for example:&lt;/p&gt;
&lt;p&gt;(Invoke-Sqlcmd -ServerInstance $ServerInstance -InputFile &amp;quot;C:\WEBTECHY\SQL\databaseusers.sql&amp;quot; -Variable $VariableArray | ConvertTo-XML -NoTypeInformation).save(&amp;quot;C:\WEBTECHY\BACKUPS\$ServerInstance\$DatabaseName-Logins.xml&amp;quot;)&lt;/p&gt;
&lt;p&gt;I can connect to a remote SQL Server if the local machine has SQL Server installed and the snapin added, however, I am unable to do from a machine that does not have full SQL Server installed it seems. I have tried just installing the following SQL Server 2008 features:&lt;/p&gt;
&lt;p&gt;# Client Tools Connectivity&lt;/p&gt;
&lt;p&gt;# Management Tools - Basic&lt;/p&gt;
&lt;p&gt;I was hoping that would install the Snap-In. However, I still can&amp;#39;t install the snap-in ... is a full SQL install of the database engine really required?&lt;/p&gt;
&lt;p&gt;NB I don&amp;#39;t want to have to enable remote PowerShell on the DB servers if I can help it.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3342507" width="1" height="1"&gt;</description></item></channel></rss>