I'm just getting started in PowerShell and one of my sysadmins told me that Powershell can do as much as C# can for systems management, if not more.
Please forgive the ignorance of this question, but when would I use Powershell over C#?
1) PowerShell is good for relatively small well defined tasks, especially ephemeral one-day tasks and interactive tasks when you are coding right in the command line. If a task requires just a few lines of PowerShell code (and you know that because you know PowerShell well enough!) then launching a full C# project is often overkill.
2) C# is much better for large projects or where performance is critical. It is better for any project that will presumably require debugging and troubleshooting.
3) PowerShell and C# can perfectly work together. It is easy to call one from another. PowerShell is good for connecting .NET components. You can implement your complex and performance critical pieces in C# and then combine and glue those pieces together with PowerShell.
When I worked in the Windows build lab a LONG time ago (1997) the rule I was taught that if the code satisfies either of these two conditions write it in interpreted script, otherwise write it in compiled code:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With