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.
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.
I got into PowerShell end of last year when the guy that did the regular system checks was retired and the other moved to another department. So I took on the challenge to do a deep dive into it and automated the necessary system checks and more with PS. It proved to be the right tool for the job. Of course there are tool that you can buy or you can use a programming language to crank something out but the necessary resources were not available and I wanted to learn how to do it with PS. I had some light exposure to PS before.
One success factor (probably the most important) for me was to use VS Code with all the power of the available extensions, the writing, testing and debugging of my scripts was pretty efficient and fun to do with this editor. As usual, I spent some time on Stackoverflow too!
The following was implemented over a period of maybe 2 Month (only occasionally found time to work on it):
Parsing Windows Log for specific events
Parsing a 3rd party tool log for specific information
Checking network folder availability
Checking status of Web Sites
Checking status of SQL Server databases
File conversion tasks for a productive system
All of the above is using emails to alert if something fails (including attached logs and HTML reports)
Configuration is done using a JSON files
Some of the scripts are used as part of an SQL Server job, others are started using the Windows Task Scheduler on a server.
I started to tinker around with SQLLite to store some data and create a timeline with Google Chart services using that data. However, this is already more than I actually need but it worked.
One thing I like the most is the ease of deployment. Just copy the script and you are done.
Working with parameters can be a bit nifty but when you get the hang of it, it is Ok. The possibility to us, in addition to the native cmdlets, .NET Framework Classes makes PowerShell extremely versatile and powerful.
I would say it's definitely worth learning. If you work with Continuous Delivery using Microsoft's tools then Powershell becomes very useful. We us it in this scenario often to execute scripts remotely on our servers for backups and various other functions.
I have been a linux user since the late 90s. Whenever my arm was twisted to work on on a windows setting (all to often ) the first thing I always did was install cygwin on it before anything else. bash saved me from early insanity. I never looked at PowerShell, maybe I have missed something. Next time I'm young I'll try it, promise.
PowerShell works great once you learn its syntax and quirks. I've only had a few commands that don't transfer over exactly from the command prompt to powershell and all you need to do is type "cmd" in PowerShell go get the normal command line so it's not that big a deal that it's now the default in Windows.
I used to find that I could do anything I wanted to do in Python, and more easily - but recently I've been working in a locked down environment without python, but with Powershell, so I've forced myself to learn. I initially found it odd to work with - but it is making more sense over time. Syntactically there are still some things I find quirky compared to for example Unix shell scripting.
I'm a whiz at batch files . . . but now I'm finding that I use batch less than Powershell. . . so it must be growing on me.
. . . and it does seem to be the future for Microsoft.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
Because a lawyer is entering the plea, and (if you believe them) lawyers aren't insane.
".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
The term 'reason', as used in this phrase, does not refer to the ability to reason of either the lawyer or the defendant, but the cause for the defendant of not being guilty (because of not being able to intend to perform a crime due to insanity).
Having said that, it would have been clearer to just say 'because' rather than 'by reason of'. The hilarity simply emerges from the convoluted ways of expressing stuff in legalese.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
Last Visit: 3-Dec-20 17:24 Last Update: 3-Dec-20 17:24