Posted on 01/12/2018 6:11:41 AM PST by dayglored
Microsoft has given the world new versions of PowerShell that bring the popular automation and scripting tool to MacOS and Linux.
PowerShell Core 6.0s both an upgrade and a replacement for its predecessors.
Its a replacement because Microsoft is no longer actively developing its predecessor, Windows PowerShell. That tool will be kept secure in future updates to Windows Server and Windows.
Those of you looking for future fun, by way of enhancements, need to adopt PowerShell Core. That moniker reflects the fact it runs with the .Net Core, rather than the Windows-only .NET framework.
The change has been made because Microsoft wants sysadmins to have one toolset to work with in whatever operating environment takes their fancy. That ideas fuelled by Redmonds belief that in a hybrid cloud world theres every chance youll wrangle Windows or Linux servers from a Mac or penguin-powered machines. Or even a Windows PC.
Microsoft has listed the new features of PowerShell Core 6.0 here. Among the interesting additions are Docker support, sensitivity to the fact that MacOS and Linux filesystems can handle file names that Windows chokes on, SSH remoting and dozens of new cmdlets.
Among some curiosities Microsof has noted is an unsupported version of the tool for Windows on ARM and another for Rasbpian. Theres also a warning that Linux users may need to do a fresh install of version 6.0 rather than upgrade.
And just to confuse matters, while version 6.0 is the latest and greatest, Microsoft also offers PowerShell Core 5.0 and 5.1 with its Nano Server.
PowerShell Core 6.0 for Windows can be found here, and for MacOS and Linux here. ®
There are a lot of Unix/Lunix scripting tools out in the wild. Microsoft is trying to bring some sanity to the world.
Am I missing something?
To me, “scripting” is the enemy of security of PC’s.
I’ve long been a heavy Linux user. Since 1994.
I’m no fan of MS’s swiss cheese of operating systems. (not because they can’t secure them, but they won’t. For their own reasons)
Apple has had a very good yet little used power shell built into its OS for years its call Apple Script.
Apple has always been a stable operating system. It’s roots are in FreeBSD.
I’m about due an upgrade on this system and a new install. It will be some form of Linux or possibly OpenBSD.
Currently running Debian and XFCE.
Uhhh--No.
Scripting is just a way to automate tasks. No more. No less.
I love XFCE. My OS is Fedora, though. I never even install Gnome or KDE.
Sanity? I'd call it hegemony. If they'd simply port the commands to Linux, bash would be all we'd need. You can pretty much do anything with Bash.
Here's a bash script that will play a round of Bunco...
#!/bin/bash rolldie() { local result=$1 rolled=$(( ( $RANDOM % 6 ) + 1 )) eval $result=$rolled } BuncoRound() { # roll, display, and score a round of bunco! # round is specified when invoked, score added to totalscore local score=0 ; local round=$1 ; local hidescore=0 rolldie die1 ; rolldie die2 ; rolldie die3 echo Round $round. You rolled: $die1 $die2 $die3 if [ $die1 -eq $die2 ] && [ $die2 -eq $die3 ] ; then if [ $die1 -eq $round ] ; then echo " BUNCO! You score 21!" score=21 hidescore=1 else echo " Mini Bunco! You score 5!" score=5 hidescore=1 fi else if [ $die1 -eq $round ] ; then score=1 fi if [ $die2 -eq $round ] ; then score=$(( $score + 1 )) fi if [ $die3 -eq $round ] ; then score=$(( $score + 1 )) fi fi if [ $hidescore -eq 0 ] ; then echo " score this round: $score" fi totalscore=$(( $totalscore + $score )) } for round in {1..6} ; do BuncoRound $round done echo "Total Score: $totalscore"
For example:
$ bunco Round 1. You rolled: 2 4 1 score this round: 1 Round 2. You rolled: 6 1 6 score this round: 0 Round 3. You rolled: 2 3 2 score this round: 1 Round 4. You rolled: 4 1 5 score this round: 1 Round 5. You rolled: 3 3 3 Mini Bunco! You score 5! Round 6. You rolled: 1 5 3 score this round: 0 Total Score: 8
I started using XFCE when Redhat 5 came out. It was not part of the package, but I was so disappointed with the bloat at the time that I looked for something lighter. Downloaded XFCE and installed it. Never looked back.
There are other very light GUI’s but XFCE is Gnome compliant and works for me.
“scripting”
OK, Thanks.
I have increased the productivity of my entire team using just bash and expect. In the range of several hundred percent. I've written scripts that have reduced our time on task from several days down to 15 minutes. As a result, we get a lot more done with a LOT less worries/frustration/stress in our jobs.
No problem. I understand that the term can be misunderstood due to the media hype surrounding people who can use the concept.
I use No Script on my browser, it has made life better for me.
It did educate me about how many scripts are running on prominent websites. Headshake.
No wonder it seem like the browser stops when you go to one of them.
That is why I use it as well--it works for me, and I don't have to adjust my work methods/styles to work within it.
Not to bash Bash but PowerShell let’s you access just about the all of the .Net functionality directly without having a bunch of little quirky little utilities.
Yeah--NoScript and an ad blocker make the Net usable.
Apple Script is the most godawful thing second only to iTunes.
True and valid point. how dotNet libraries are invoked is often absurdly baroque but usually PowerShell can handle invoking with the correct types. In fact if the library is complete the types can be imported into PS with just a reference. However when you get down to that level you might as well be programming in C#.
One has to be careful not to abuse this too much. For example I once wrote some amusing PS code for generating C# code based on parameters and creating a signed assembly to then stuff into SQL Server directly for use as a function called by scripts invoked in a distributed environment. This was a performance optimization for scrubbing multi-billion row tables in a live system, IIRC. My excuse? it was a death march. Amusingly I also invoked the SAS motto to help characterize the rationale for the risk acceptance meeting..."who dares, wins".
Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.