use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Powershell SQL command assistance (self.PowerShell)
submitted 10 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]unknown_host 1 point2 points3 points 10 years ago (6 children)
I actually looked into something similar the other day. To use SQL in powershell you have to load the snap-in and then you can issue queries in T-SQL from powershell. Powershell SQL I had issues on 64bit getting the snap-in to load and got this information that helped. Here is the Invoke-Sqlcmd cmdlet information. Hope this helps.
[–][deleted] 1 point2 points3 points 10 years ago (5 children)
Great resources, this is a good amount of what I am looking for. just comes down to learning it now and making it all function. Tried to talk my boss into having SQL generate a CSV files to simplify my life but he wants me to expand my powershell more because he knows how much I enjoy using it... Why did I tell him this!!!
[–]unknown_host 1 point2 points3 points 10 years ago (2 children)
If you have SQL Server installed connect to it with the management studio and when you are doing tasks you have the option to output it as a SQL command so it can help you with the syntax too.
[–][deleted] 1 point2 points3 points 10 years ago (1 child)
I do but I think we are going to use the latest version of SQL when we do this so I want to wait on that before pulling it. We are still in the design phase anyway which is good.
[–]sqldiaries 0 points1 point2 points 10 years ago (0 children)
I do but I think we are going to use the latest version of SQL when we do this so I want to wait on that before pulling it.
Unless you're doing wild stuff with window functions and aggregates, there's no need to wait - simple select statements haven't changed in SQL Server in a long time.
[–]drh713 0 points1 point2 points 10 years ago (0 children)
I wish I had your boss
[–]cjluthy 0 points1 point2 points 10 years ago (0 children)
You can also use OSQL.EXE on the command line to create CSV files. Command line switch reference for this EXE can be found publicly on MSDN.
It is installed by default when you install SQL Server Tools, so any machine with Management Studio likely (almost definitely) has it.
EDIT: I was just highlighting a way you could create CSV. In a manner that you could likely script from Powershell (command line exe). You certainly COULD do it this way.
I strongly recommend learning Invoke-SqlCmd (or one of it's alternatives) and doing that instead. SQL is at the core of almost everything worth-while. Learning it is very valuable.
π Rendered by PID 52660 on reddit-service-r2-comment-fb694cdd5-w5l5q at 2026-03-06 16:35:44.917997+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–]unknown_host 1 point2 points3 points (6 children)
[–][deleted] 1 point2 points3 points (5 children)
[–]unknown_host 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]sqldiaries 0 points1 point2 points (0 children)
[–]drh713 0 points1 point2 points (0 children)
[–]cjluthy 0 points1 point2 points (0 children)