Before this morning I was completely oblivious to the fact that powershell existed so please excuse the myriad of perhaps obvious questions I need to ask.
I have been looking on the web but it is still completely baffling so I ask for your help in building my understanding of this.
I need to...
Connect to a web server 10.xx.xx.xx
Is this possible and if so how would I even go about attempting it?
Thank you in advance for any help...
SO the SQL Script is fairly meaty;
DECLARE @startdate CHAR(8)
Select VL3ADVICE1NUM As "Advice Num",
That was quite a task to start with when you have never heard about Powershell before. My opinion is that it is possible to do with powershell, however a lot is undetermined and you need to dig into the details a bit more. My suggestion would be to split this task up into smaller subtasks/scripts/functions and get to work.
1. What kind of "connection" to a web-server are we talking about? Are you connecting to a webservice, if so which type WDSL/WCF or are you planing on parsing html? Could you get the data you need from the webserver some other way?
The scheduling bit is the last piece of the puzzle and when you have all the other stuff ready, it should be a breeze to start your powershell script/function/module with the taskscheduler.
So when you are satisfied with your investigation/design of the solution do one or a combination of the following items:
1. Start to learn Powershell by reading tutorials/watching youtube/reading blogs (here at powershell.org)/buy Don Jones CBS nuggets on powershell (I have not watched them, however I suspect they are pretty good)
Best of luck, it looks like a cool project. Please post any specific questions you might have.
Agree with Tore, we need a lot more information about your scenario. Specifically what you're saying about connecting to the web server.
If you need to get started, begin here with a connection to the SQL server. First, create $conn, on the second line fill in your connection string to this server.
$conn = New-Object System.Data.SqlClient.SqlConnection
Check Don's article here on getting started with SQL and PowerShell. You can see in his example how you'd go about defining your SQL Query (pull the code from reportpositions.sql and paste it into $cmd.commandtext) and you'll end up with the results of your query stored in $cmd.
From there, you can export your data into whatever format you need using PowerShell commands. For example, to store the values from $cmd into a file called 'Report Positions 03.10.2014.csv' use this command:
$date = get-date -uformat "%m.%d.%Y"
So, that should be a number of clues to point you in the right direction.
Why do you need to connect to the webserver to run the SQL in the first place? Is the database residing on the webserver?
If yes to the DB residing on the webserver then the first thing to do is to move it immediately to a dedicated server. You do not want to be running complex T-SQL scripts on your webserver.
Then where ever you run this use Task Scheduler, correct. Then check this
You must be logged in to reply to this topic.