PowerShell Core - What is it and Why
Published: Apr 26, 2024
I’ve been asked this a lot by people recently and I can understand the confusion because it seems that Core is everywhere and yet casual programmers and developers (who, as a SQL guy, are those I tend to deal with) seem unsure what it is and why it exists, yet are being told that they should be using it. Hence I thought I’d just put a quick note in the PowerShell blog about Core even though it’s not a PowerShell exclusive thing, it’s everywhere now, but this is the blog in which it fits best.

So what is Core? Do we need it? Should we all be using it?

I don’t know about the community as a whole, but my answer at time of writing isn’t as clear cut as some people may have hoped. That answer being “You should TRY and use it, but it’s not essential”.

.Net Core is basically a stripped back version of the .Net framework which was written by Microsoft to work on Windows machines. This is obvious, Windows is a Microsoft product, so they wrote the .Net Framework to run on it.

This was all well and good except that a lot of people use a combination of Windows and Unix servers and this limited the use of the .Net Framework as some of the modules are very Windows specific and therefore cannot run on Unix based systems.

Microsoft realised this and therefore created .Net Core. The idea is simply that Core is cross-platform. If you write something in Core then you can run it anywhere you like. Therefore you can now write a single piece of code in PowerShell Core which will, for example, get you all ps1 files in all drives whether that be Unix or Windows.

This not only answers what Core means (cross-platform) but also whether we need it. If you’re currently writing anything that you wish to run on multiple operating systems, then use Core. If you’re not, then the choice is yours.

So… let’s discuss whether we should be using it. This one’s harder in the short term, easier in the long term.

In the short term Core is still growing and therefore there MAY be modules or keywords that don’t yet exist in Core and which you rely on in your code. In this case you may as well stick with what you have. BUT they key part is that this will not be the case going forwards.

PowerShell 5.1, for example, gets only security updates now and will never see new features. PowerShell Core, on the other hand, is now on version 7, has almost all capabilities (except just a few) that 5.1 has, and is being added to and updated regularly.

If I’m honest, PowerShell 6 was NOT the time to move into Core as it lacked too many of the features in 5.1 but these have been nearly completely rectified in PowerShell 7 and therefore if there was a time to dip your toe into the “Core water”, so to speak, then this is it.

In summary, I wouldn’t go as far as to say everyone should be using Core, code how you feel comfortable and to the platform and OS as per your needs, but it’s definitely something you should be keeping an eye on, dipping your toe in, and looking to use with new projects if you can.

Hope that helps.

Leave a Comment
Your email address will not be published. All fields are mandatory.
NB: Comments will only appear once they have been moderated.

Kutech  CEO
Kevin  Urquhart

CEO

I am a SQL Server DBA, Architect, Developer, Trainer, and the owner and CEO of Kutech. This blog has been going for nearly 10 years now over several guises and this is its new home. I hope you find it useful whatever your endeavour.

Categories


© Copyright 2021 Kutech Solutions Ltd.

Our site uses cookies only to personalise content and analyse traffic. We do not use cookies for advertising. Policy