SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Powershell- Is it easy as everyone claims?

Where ever you read, people claim that power shell is so easy that even a dummy can do it. Really? I beg to differ. Power shell is as easy as any other scripting/programming language. At least that is what I think.

Yes, it is true that even a dummy can do a small script in Power shell to print "Hello World". But if you really want to use the power of power shell it is no cake walk. Yea, you can copy scripts from the internet to get lots of things done but do you know exactly what is being done?

About two months back I though I would write a script to get the file names in a particular directory into a table. For this particular exercise I could not just use dir command. I had to use the Get-ChildItem. Then I had to figure out how to open a database connection, how to do a select query and also how to do an insert. Was I able to do it? Yes, I was. But am I sure I wrote it in the best possible way? I have no clue.

And let us not forget about security. What holes are we opening up on to the Database server by using Power shell? Are we trying to understand before we start using it? You better look at what execution policy you want to use for your script.


Posted by Steve Jones on 8 March 2010

I think that Powershell is easy for someone that understands basic programming. That's not to say it's easy to get things done, but it is easy to learn. You build up scripts to handle sections and then put those scripts together.

In terms of is it a good way to program? I think for administrative tasks that a production DBA needs, it's great. Or a sysadmin,etc. In terms of putting it out there for other uses, I'm not sure. It's built to make repeatable things happen for administrators, not as another type of programming.

Posted by BuckWoody on 8 March 2010

It's easy-peasy. Here's a great place to get started: www.informit.com/.../content.aspx

And it's like anything else - as secure as you make it. It was, however, designed to be very secure out of the box.

Leave a Comment

Please register or log in to leave a comment.