Powershell AdvantagesWriting a C# tool you typically need to set up a Visual Studio project (or a project in another IDE, or if you doing this "manually", you need at least a build script to call to C# compiler). If for a specific task this seems to be too much overhead, and you need just a simple one-file-source-and-program-is-all-in-one solution, a powershell script may be the better alternative. Why you may prefer a powershell script agains a C# solution:
- You don't have Microsoft Visual Studio or any other C# IDE installed on your machine, or you are not used to it at all. (like a lot of system admins) the program is so small you don't need a debugger, some simple console outputs will do it
- You don't want to separate configuration parameters for your tool into a separate config file when you can define individual tasks, but can't determine an exact workflow, a mixture of script and C# is ideal. Creating cmdlets or providers in C# gives your scripts access to anything in a general way, and PowerShell becomes the glue, making the workflow flexible to new situations.
- You have several competing overarching design ideas and you want to rapidly test the possibilities for feasibility. Powershell's soft typing and pipeline architecture makes it easy to ignore a lot of the vagaries of control structure and type details and get to the heart of an algorithm.
- You do not want to maintain more than one file