The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
I are a dinosaur and I, too, have avoided PowerShell.
Having said that, I do find myself using it.
Over time, I've seen scripting done in various tools: VBScript, PERL, etc... but PowerShell seems to be the emerging tool.
Last week, I had to find a method to get the amount of memory installed on a computer and store that value; I COULD have done it in VBScript with WMI, but PowerShell was available and not that difficult to use.
I Googles the various pieces: get the installed memory, how to store the value in the system I'm using... and put them together into a single entity... and it worked the first time I ran it.
All I know about powershell is that the Package manager console in VS uses it, and in Win7, I managed to completely break it when I had Update 5 installed. Win they upgraded us to Win10, the version of powershell installed with win10 (v5.n?) was evidently too new for vs2013, and we had to install powershell 2.0 to get the package manager console working.
That's all I want to know about powershell.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
You can learn as you go, so you don't really need to study it for weeks before you get to use it. I only use a subset of ps commands and it's been very useful for me. I would not tell someone I am a ps expert by any means, but that's what so good about it. You can use it as minimally or as advanced as your needs dictate.
PowerShell isn't without its syntactic quirks (which will make you pull your hair out until you understand them), but it's still worth learning IMO, especially if you currently do anything at the command prompt.
MS has built support for PS in just about every one of their products/services, and if you currently can't do something through some UI, then it's still probably feasible through PS.
Personally, I just love the idea of working with the same .NET objects in a script as you do with full-blown, compiled languages. This opens up a lot of possibilities. If anyone thinks PowerShell is just an alternative to the string manipulation offered by the various Linux shells (no matter how sophisticated this can get), you need to re-read what PS is really about.
Didn't like it at first because of the way it replaced my beloved Command Prompt in the right-click context menu and wouldn't run dir commands with standard options like /b and /s.
But it seems unavoidable, so recently I used it to write a script to download packages from our TeamCity builder, available as a tip on CodeProject, and have to admit I was pretty pleased with all the .NET power you get when using Powershell
I started using PowerShell reluctantly, have since learned a bit about it and found it to be a very practical and valuable tool.
I use PowerShell scripts for such things as obfuscation[^], registry settings, editing WIX deployment projects, setting project versioning numbers, editing repository settings, call them in pre-build and post-build events in my VS projects, etc.
If you've ever experienced the frustration of having to debug 'complicated' batch command files then you will shed tears of joy when you realize just how easy it is to debug and walk through PS scripts, line by line, in Visual Studio. Also, as RickZeeland pointed out, if you know .NET then all this is readily available to you in PS.
Skip it. It doesn't do anything that a proper program can't.
A few years ago I was handed a PowerShell script for gathering some data from some webservices and storing it in our database.
It worked, but it had no error handling or logging or anything. So I converted it to C#. Now it has multi-threading and the ability to retry on particular errors and a whole lot of other features we need.
* Debugging is excellent.
* Syntax is very nice for some commands.
* You can do proper loops and structured programming.
* Ability to call .NET methods directly is very practical.
* File system interaction is an abomination - lost work due to PS's perception of the file system being out of sync with the real file system (time stamps). Why does it have to have its own file system abstraction that even tries to cache stuff ?
* Had to fall back to DOS CMD to get simple stuff working reliably, e.g. mounting a network drive.
* Syntax is weird for some commands.
* Calling out to other command line tools is ... challenging (e.g. parameter handling).
I will wait for the dust to settle on a couple of versions more before I try it again. Particularly the bad file system interaction and awkward integration with other command line tools has scared me away.
Last Visit: 24-Feb-20 14:37 Last Update: 24-Feb-20 14:37