How do you use PowerShell?

Question!

Windows PowerShell came out last year and got great reviews from many .net bloggers (Hanselman comes to mind). It seemed to be touted as a great new utility that somehow made everything that you would ever do on the command line easier, and integrated with .Net. However, the more I read about it, the more it seems to be a tool that is great for IT professionals, and not much use for developers.

Do you use PowerShell in your dev work? If so, how? Is it worth learning?

Note: After seeing the responses so far, I think it is valid to conclude that PowerShell can be very useful to a .Net developer. However, there is no one answer below that I can label as the answer (so please forgive me for not doing so). I am voting up each answer that I have found helpful. Thanks for the responses!



Answers

I use PoSH for any 'repetita' job I've to do for administering networks, domains, computers, AD users, text editing, files searching, file-servers migrations, monitoring and also have fun!

By : CB.


It's definitely worth learning. Do you ever convert text? Do you ever manipulate XML? Do you ever automate anything? Simple example. Someone gives you a comma delimited file and you need to pull some fields out of it to import into some other tool/database or to create some list for your program.

If the csv has the field names in the first line of the file, you can do the following in Powershell:

$Data = import-csv "something.csv"

You can then refer to your data using the field names. If you had a field called SSN then you could say $Data[n].SSN. You could also just pipe the import-csv command to something that processed the data including exporting it as XML/html or anything you want with just a few commands. Powershell is full of stuff like this.

It's a tool that gives you tremendous access to a ton of stuff on your workstation and servers, including the complete .NET library. It's a tool that isn't targeted at a type of person. Maybe it's just that the Admin types have been quick to realize how useful it is. I use it every day.

To actually answer the question asked, I use it to automate things I do everyday. I am trying to make it my single scripting language, replacing the things I did in perl, python, vbscript, .bat/.cmd, and one off little utility/conversion programs that I would create.

By : bruceatk


I use it to automate as much things as I can. One example is Web UI Automation, to ease application development/testing.

i also use it to generate random input files for various programs. For example, one application is expecting an XML file, and I have a script to build that file with random values and a unique id based on the current time.

I don't use it heavily, but I use it every day.

By : Philippe


This video can help you solving your question :)
By: admin