We currently use Batch files to load procedures, execute script files and call stored procedures by calling the sql sefver utilities cmdutil, dtexec, and osql.
Based on the value of the returned exit codes, we determine the next step to run.
Batch files seem a little primitive to me and I imagine that I would be happier writing this “job control flow” code in a driver .NET program, but I assume that most developers would choose to use some sort of scripting language to do this.
I am considering using VB WSH Script since it appears to give me better language constructs (eg, if then else) and access to COM objects, but I suppose that even that is a little dated and that I should be looking into Powershell.
My question is this:
What are the advantages/disadvanagtes of using Powershell over compiled .NET code for developing a Workflow control program? I suspect that the development environment and compile time checking using the Visual Studio IDE would make me more productive than using script.
I was doing a hello world app to try and utilize one of my .NET libraries from PS and I got the impression that PS just blows over bad code. Does it have sufficient error handling capabilities compared to compiled .NET code?
Powershell can do anything that you would in a batch file and anything you can using C#.
It is a very good scripting language ( the ease with which you can script in Ruby and Python can be found in Powershell as well ) and there are some nice IDEs for it as well. Given that it is not completely supported in VS, there are some efforts in that area as well like the PowerGUI VS
With Powershell you can do error management using exit codes like you would elsewhere and also
try-catchexceptions and other constructs liketrap,throwetc. Error management is rich in Powershell. You can also use C# code in Powershell using cmdlets likeAdd-Type.Subjective part of the answer:
What you seem to want to do seems ideal for scripting. And Powershell is the natural choice for scripting on Windows. I don’t see how “compile time checking” makes you more productive, I would have thought scripting languages had the advantage of making you productive.
I don’t really understand what you mean by
PS just blows over bad code– but Powershell is just like any other language and bad code or not depends on how you are writing the code.