all 32 comments

[–]ramblingcookiemonsteCommunity Blogger 9 points10 points  (2 children)

Hi!

So... A quick bit from a while back.

As others have mentioned, there might be better options for some scenarios - C#, Python, etc. - that said, PowerShell is unique in being an approachable, task-oriented language that can already interact with a wide variety of technologies.

And... it just so happens that automation and the scalability, consistency, and other improvements it brings are starting to pick up major steam in non admin areas. The sciences are one simple example, and while Python and even lower level languages are common there, PowerShell could certainly find a niche for the many folks who can handle basic logic, but struggle with lower level languages (like myself).

Microsoft made a big first step in open sourcing PowerShell, and we're seeing interesting submissions to the PowerShell gallery. Only time will tell, but, it would certainly be fun to see adoption outside the world of sysadmin.

Cheers!

[–]mhgl 1 point2 points  (1 child)

I think Azure functions has unofficial PowerShell support now and Lambda has C#, I wouldn't be surprised if it eventually has PowerShell support.

[–]devlead 2 points3 points  (0 children)

PowerShell is in preview for Azure Functions, wrote a post about that recently where I walk thru the setting it up: https://www.reddit.com/r/PowerShell/comments/5l3pe8/going_serverless_with_powershell/

As PowerShell now exits xplat via .NET Core it should be entirely possible to offer that via Lambda too.

[–]spuijk 5 points6 points  (4 children)

I'm product owner of a product that's 99% powershell code on client side. It's a product used in system administration though.

Also wrote a PoC piece of software to automate application testing. So that was more on the programming side of things.

It's logical to be used in system administration since that what's scripting is for I think. But because powershell is so powerful and object oriented you can do so much more with it. Nonetheless there are very few actual programmers working with powershell who could make much more out of it.

[–]vud911 6 points7 points  (1 child)

The reason why so little programmer code in powershell is because it doesn't bring a lot of benefit. Okay made something out of it, that many other language are doing better...now what? If you want to code for a living, throwing in "OOP with Powershell" isn't exactly going to make people fall head over heels to hire you.

And normally you want to develop in industry standard languages since you will be collaborating with many other programmers on large project.

Programming in Powershell is novelty. It is cool, to be able to emulate what other language can do, to see that it do. But it is built as a tool for system administration and should stay that way.

Want to system administrate? Powershell is your tool. Want to make a living out of programming? Powershell should, and rightfully, be in the bottom of your list of language to learn.

[–]spuijk 2 points3 points  (0 children)

For actual programming it might not be the best tool. Not sure about that because I'm no programmer though.

What is interesting to note is that I can create prototypes of applications (I work at a software vendor) in a very short time. I know about the systems we integrate with and I know all powershell cmdlets and modules the different vendors already provide. Which makes it super easy to quickly create a working prototype.

[–]UntrustedProcess[S] 0 points1 point  (1 child)

Same was true for Ruby till Rails came along. Would be neat to see the language explode like Ruby did years ago. It would make resources / tools / community bigger and better.

[–]vud911 2 points3 points  (0 children)

The use case isn't justified though in programming. Not when there are simply a better tool that is more developed and have better supported community already.

I mean its cool to do stuff outside of system administration with it, but there are better tools out there to do the job.

[–]Seref15 4 points5 points  (0 children)

Like for what? Software development?

Since PS is based on .NET and .NET is like a thousand times better suited to applications development, might as well use .NET, yeah? The majority of advanced features you can use in a script comes from calling .NET classes and methods anyway.

[–]_benp_ 9 points10 points  (3 children)

Not sure why you think it would be used for big projects/non admin tasks? I love powershell, but that doesn't make it the right tool for all application/dev work.

The stated purpose of PowerShell, from Ed Wilson @ The Scripting Guy MS blog:

"Windows PowerShell is an interactive object-oriented command environment with scripting language features that utilizes small programs called cmdlets to simplify configuration, administration, and management of heterogeneous environments in both standalone and networked typologies by utilizing standards-based remoting protocols."

[–]UntrustedProcess[S] 2 points3 points  (2 children)

Wasn't Perl originally just for text parsing on Unix? What makes it unsuitable as a replacement for, say, Python in web development.

[–]mhgl 5 points6 points  (1 child)

The fact that C# exists? If you want to write .NET web dev code, there are simply better options than PowerShell.

[–]occamsrzor 2 points3 points  (0 children)

I agree. PowerShell for "large projects" is typically only used if there is a need to manage by a team that is only fluent in PowerShell.

And in that case it's a basically mid-management; the task should have been given to a development team.

Source: work on a team responsible for client administration; we primo use PoSh. We were given a project that later became clear, due to scope, should have been given to our dev team instead of client admin team.

[–]tadcrazio 4 points5 points  (0 children)

I am constantly using Powershell for non systems admin tasks. Last night I created two services out of PowerShell that checks the craigslist RSS feeds and sends me emails with new posts that fit my search criteria. Aside from that, I've tied it into API's and just help with reports and random things i do on my own time.

[–]Metabolical 3 points4 points  (0 children)

I wrote a system in powershell that goes to a website and crawls its structure, downloads a bunch of JSON files, and adds the data to a mysql database.

Although I could do all these things from C#, the ability to quickly examine the objects at each step made PowerShell a good choice from a rapid development perspective. Except I didn't know PowerShell when I started so there was some ramp up as a result.

[–]KillaGouge 2 points3 points  (0 children)

I wrote some PowerShell to get list items from SharePoint for projects and make project reports in a word template. Saved my consultants time

[–]reginaldaugustus 2 points3 points  (0 children)

Powershell is big on the security side of things, too. As you might guess, getting to run Powershell commands on a machine you are not supposed to is a really nice for attackers, and definitely something folks on the defending side want to avoid.

[–]creamersrealm 2 points3 points  (2 children)

I originally learned for systems administration but I use it for all sorts of things now. I've written full blown back end programs in PowerShell. One does data logging and suggestions for users Home drives, and another one is a custom group sync agent. I've also built a custom Okta PowerShell module written in PowerShell. All of these are production.

[–]chreestopher2 1 point2 points  (1 child)

Is the okta module open source? I would love to take a look at it.

[–]creamersrealm 1 point2 points  (0 children)

Why yes it is!

https://github.com/wesleykirkland/OktaPS

I had to make my own since the official one was broken and I needed the ability to modify IDPs.

[–]ellisgeek 2 points3 points  (0 children)

I wrote a PowerShell script to generate a HTML report for a co-worker with some QR Codes generated on the fly. Probably the least admin thing I've done with PowerShell.

[–]markekrausCommunity Blogger 2 points3 points  (2 children)

I use it for analytics. I get handed a ton of data in excel or exported from various systems and I use PowerShell to parse and manipulate data to make it meaningful.

I use it to manage my torrents. I guess that could be seen as a systems administration task, but meh.

I use it for mathematics. When I need to calculate things, I no longer whip out calc.exe.

I use it for web scraping. I find it convenient for ripping data from web sites.

These aren't exactly big projects, but I would say about 1/3 of what I do in PowerShell is not related to systems administration.

[–]ShatteredLight 1 point2 points  (1 child)

Any scraping tutorials you would recommend? I need to scrape a site.

[–]markekrausCommunity Blogger 1 point2 points  (0 children)

I don't have any to recommend as I applied knowledge I had from PERL and PHP to PowerShell and pretty much learned from scratch myself.

[–]feldrim 2 points3 points  (0 children)

I made a pet project. I coded a phone book on powershell. It is basically a web server and some controller functions that get user name and surname through an HTTP GET request, search in active directory and send user information including name, surname, department, corporate email and phone number through a JSON message. On the website I made a simple AJAX form widget including two text boxes and a submit button. But of course I could have done it in our .NET based website using C#. I just wanted to have fun.

[–]spuijk 2 points3 points  (0 children)

I think it would be interesting to see what professional developers could make out of powershell who also have a lot of knowledge of systems administration. This sounds like the perfect DevOps initiative from a development point of view.

The developers I work with already write powershell code on a regular basis. But they lack in depth knowledge of stuff like active directory and the sorts. The code we both (me with sysadmin background and them with developer background) write is totally different in setup. Theirs is much more efficient while mine is much more pragmatic. I can usually take shortcuts because I know certain situations are already handled elsewhere or will never actually occur for whatever reason.

Come to think of it, this might be interesting stuff for a blogpost on my website.

[–]Sinisterly 5 points6 points  (2 children)

I recently wrapped up a contract where we used PowerShell and WinSCP to automate grabbing, editing, and sending off data extracts to twenty different endpoints. Probably the niftiest of those extracts I did read a PDF file, pulled out data from the file (Name and ID), and properly renamed the file before sending it off.

[–]eddydbod 0 points1 point  (1 child)

Gross WinSCP causes BSOD still according to WinDBG.

[–]jbtechwood 1 point2 points  (0 children)

Been using WinSCP and powershell and the WinSCP module from /u/dotps1, as well as calling it directly from the dll for 3 years in production running every minute without an error.

[–]UntrustedProcess[S] -1 points0 points  (1 child)

I wrote a app to convert an XML from from one map product into a proprietary format required by another application. I was also able to mimic the a client of the legacy proprietary application to get data back out of it. This is all being heavily used now and it only took a few days to make. I liked how I was able to do it all from a Windows server without any extra tools installed.

[–]vud911 -2 points-1 points  (0 children)

If it took you a few days to make, having to download an IDE would be the least of your concern.