Invoke-SQLCmd cmdlet for Windows Powershell - by SQL_Guru

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


3
0
Sign in
to vote
ID 291527 Comments
Status Closed Workarounds
Type Suggestion Repros 0
Opened 8/7/2007 10:05:27 AM
Access Restriction Public

Description

I've developed my own Invoke-SQL.ps1 powershell script for querying SQL Server, but it doesn't have lots of features.  Please develop an Invoke-SQLCmd cmdlet for Windows Powershell that loosely matches the syntax of SQLCMD.exe.  This would allow me to easily do queries against multiple servers and combine the information from the servers.

I'll include the script I've put together so far as an example.
Sign in to post a comment.
Posted by Stephen Mills on 3/27/2012 at 3:53 PM
Although this was added, Invoke-SQLCmd has relatively little in the way of functionality. The biggest defect is that you can't tell which result set a set of rows came from. i.e. "select name as [Name] from sys.databases;Select @@servername as [Name]; select name as [Name] from sys.server_principals". Good luck figuring out the name of the server. If it had some way of determining the result set it came from, you could look at the second result set to get the name of the server.
Posted by Microsoft on 10/10/2007 at 11:26 AM
SQL Guru,

I'm resolving this suggestion as fixed as this functionality should be in CTP6 of SQL Server 2008.

-Richard Waymire
Program Manager, SQL Server
Posted by Microsoft on 8/16/2007 at 12:24 PM
SQL Guru,

We are very interested in powershell for the next release of SQL Server, and appreciate your suggestion that we provide this functionality.

-Richard Waymire
Program Manager, SQL Server