May 1, 2012 at 7:05 pm
Could someone please provide me the powershell script for the below query.
i have two text files,
one file contains the list of SQL server's and another file have few sql queries.
i am looking for a powershell script or windows batch file that pick up the server name from first file and run the sql commands which is in 2nd text file and keep the output in seperate text file.
May 1, 2012 at 8:20 pm
A little research will go a long way on this one. Pretty basic PowerShell aspects:
1: Reading files: Get-Content Cmdlet
2: Executing queries: Getting Data out of SQL Server from Powershell[/url]
3: Write to file: Add-Content Cmdlet
May 1, 2012 at 10:18 pm
If you have specific questions, we can help, but spend a little time on those articles and you should be able to put something together.
May 2, 2012 at 9:11 am
I am new to powershell.It will be great if you provide the powershell script of the query. I tried to frame by using your suggestions, but somehow it is not working.
May 2, 2012 at 9:24 am
Did you get any of the scripts from Chad's article working? Those show you how to connect to SQL Server and run something.
From there, you might look over this one as well: http://www.sqlservercentral.com/articles/powershell/76561/
I don't have an exact script that does what you want, and I'm not going to spend time building one when it doesn't appear you've done anything. We are happy to help with specific questions, but we aren't here to do your work. "somehow it is not working" doesn't imply you did anything. Showing the specific error, or explaining the results from your efforts lead to specific questions. Why isn't my loop working, or why can't I connect to SQL Server. Those we help with.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply