Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Microsoft Linux IT

Microsoft PowerShell Core For Linux Now Available as a Snap (betanews.com) 154

Canonical announced on Friday that Microsoft's PowerShell Core is now available on Linux platform as a Snap. From a report: If you aren't familiar, a Snap is essentially a packaged version of a program that can be easily installed on many Linux distributions. Many see it as the future of Linux, as it has the potential to reduce fragmentation. "Built on the .NET Framework, PowerShell is an open source task-based command-line shell and scripting language with the goal of being the ubiquitous language for managing hybrid cloud assets. It is designed specifically for system administrators and power-users to rapidly automate the administration of multiple operating systems and the processes related to the applications that run on those operating systems," says Canonical.
This discussion has been archived. No new comments can be posted.

Microsoft PowerShell Core For Linux Now Available as a Snap

Comments Filter:
  • by OneHundredAndTen ( 1523865 ) on Friday July 20, 2018 @02:28PM (#56981854)
    A piece of software that fills out a much-needed gap in the Linux world. Thanks, MIcrosoft; we could not expect any less from you.
    • Re:Excellent news (Score:5, Insightful)

      by cayenne8 ( 626475 ) on Friday July 20, 2018 @02:33PM (#56981890) Homepage Journal
      I'm trying to figure out in what universe would a use case be made for replacing native, tried and true shells for Linux with some POS from MS?
      • Re: (Score:1, Flamebait)

        by Hadlock ( 143607 )

        Object-oriented shell languages are pretty rad, very intuitive, has auto-complete/intellisense built in so that third party editors can take advantage of it, you don't need to know the syntax of sed/awk, and jq-type functionality works for free, supports package management etc. It's somewhere in-between perl and ruby as a shell.

        Probably will be largely ignored by the linux community, but by having powershell support in linux, you can take your windows-land scripts and execute them on linux without h

        • by GoRK ( 10018 )

          I mean this stuff only works if you have programs and cmdlets that actually return and operate on such objects. Now, in addition to writing your powershell script, you also have to write wrapper libraries that control the native linux tools to present something that is API compatible with whatever windows api you are trying to use. Anyone who has tried to get a WinForms application running under Mono/Linux can tell you how well this shit is going to work.

        • Object-oriented shell languages are pretty rad

          Sure, it's like an awkward substitute for a Python script if that floats your boat.

        • Re:Excellent news (Score:4, Interesting)

          by bulled ( 956533 ) on Friday July 20, 2018 @03:06PM (#56982068)
          So what you want is xonsh [github.com] then?
        • Re:Excellent news (Score:5, Insightful)

          by MightyMartian ( 840721 ) on Friday July 20, 2018 @03:30PM (#56982154) Journal

          Most of the advantage of Powershell comes from access to WMI and other core API functions. As an actual shell goes, it's a horrible bloated monstrosity that is the exact opposite of the Unix philosophy. And without a lot of the hooks, or basically some compatibility layer to turn convert Windows API calls into /proc and /etc hooks, one can imagine it will be even slower than it is on Windows, and with limited functionality. And really, the whole philosophy of Powershell, with its OOP nature, comes out of its origins as basically a CLI for .NET. There really isn't anything comparable in the *nix world save perhaps for some of the GUIs out there.

          I get it. This is some way to try to attract a wider base to its toolset, and maybe a bit the other way, but I cannot imagine anyone going through the bloat of bringing up a Powershell script when something like bash will be that much faster and far more intuitive for someone steeped in the *nix world.

          Powershell and the whole way the Windows ecosystem is evolving makes truer every day that those who do not understand Unix are doomed to reimpliment it badly.

          • As an actual shell goes, it's a horrible bloated monstrosity that is the exact opposite of the Unix philosophy.

            Ah, good ol' "Do many things, while aspiring to mediocrity, except when I don't feel like it, or on Tuesdays."

          • by jrumney ( 197329 )
            Most of the advantage of Powershell is that it manages to improve on some of the deficiencies in CMD.exe. Plonked into Linux, the complete lack of support for pipes is going to be a show-stopper off the bat. I guess it might have advantages when dealing with systemd, but for traditional Unix commands it will fall flat.
            • What do you mean about PowerShell's lack of pipes? The pipeline is PowerShell's biggest claim to fame. It is more powerful than the simplistic pipes of the other *nix shells, but still supports interacting with Linux programs. For example "man ls | grep the" does exactly the same thing in PowerShell as it does in bash.

              • by jrumney ( 197329 )
                I thought last time I tried to pipe in PowerShell it failed with a cryptic .NET error message. But when I tried now, it seems I was wrong about pipes, it is redirection to NUL that they have screwed up.

                out-file : FileStream was asked to open a device that was not a file. For support for devices like 'com1:' or 'lpt1:', call CreateFile, then use the FileStream constructors that take an OS handle as an IntPtr.

        • Thanks for letting us know that it was not only music, films and babes that where better in the 1980s but also terminal syntax!
      • by nnet ( 20306 )
        The universe where you don't need a Windows machine to run vmware powershell cmdlets because the vmware perl sdk isn't as functionally complete as the powershell sdk.
      • Powershell is bad enough, but having to run Windows, everytime you need to use it is even worse. And if your job requires you to deploy to the Azure cloud, then I can see a use for this. Although I believe they now have Linux CLI utils for that as well.

      • would a use case be made for replacing native, tried and true {tools} for Linux with some POS

        Oh, did someone mention SystemD?

        Mod me down, that's fine; I'm moving to FreeBSD. Hopefully S*D will stay working long enough while I plan and execute the move. Not on BTRFS ("But it works fine for me") volumes, either.

        • by jmccue ( 834797 )

          I'm moving to FreeBSD.

          I have been slowly evaluating the various BSDs also with the the same idea in mind. But there are a few distros that are "fighting the good fight" :), but I fear that is a loosing battle. Beyond all evidence I still hope this windowization of Linux reverses or can be held off. So I want to be prepared if/when I have to move.

          I will stick with my distro of choice and hope for the best :) The good news is at least my favorite distro has been successful keeping sane!

      • by mikael ( 484 )

        Because IT managers might only know Microsoft PowerShell, and so they will push to use it for the Linux systems under their control.

        • Good managers manage and let the technical details get worked out buy the techies. they might ask for details but the bigger goal is to get to a destination, don't micro-manage your techies, they will hate the job/supervisor and find another job...

      • Easy object based systems like Azure and Windows servers where everything is an object, not a string or text file.

        PS is not a POS. It's just different as something like cygwin is not useful to do much on Windows in comparison as a result. This is welcome for DevOps and System Admins who manages multiple systems.

      • by sad_ ( 7868 )

        i think (and hope) the purpose is for admins that have a linux desktop but manage windows servers or use azure cloud.

    • by Anonymous Coward

      I really NEED a Microsoft Linux distro.

      Of course, with all the special Microsoft proprietary extensions.

      Microsoft GNome or Microsoft KDE. And obviously a Microsoft Linux Kernel.

  • Why? (Score:4, Insightful)

    by devslash0 ( 4203435 ) on Friday July 20, 2018 @02:34PM (#56981892)
    Why, oh why, would I install something that is:
    - slow
    - bloated
    - in all likelihood harvesting data behind your back
    - trying to replace something which isn't broken (a Linux terminal)
    - dependent on .NET
    on my machine? {deity_of_choice}, why would I even permit .NET to exist in my system in the first place?
    • Re:Why? (Score:4, Insightful)

      by Tough Love ( 215404 ) on Friday July 20, 2018 @02:59PM (#56982028)

      I know right? It's weird, but It's what happens when Microsoft hires the Gnome mafia.

    • by Anonymous Coward

      Why, oh why, would I install something that is:

      - slow

      - bloated

      - in all likelihood harvesting data behind your back

      - trying to replace something which isn't broken (a Linux terminal)

      Yeah, we have systemd for all that already...

    • by dyfet ( 154716 )

      Indeed, as a "ubiquitous language for managing hybrid cloud assets", there is, for just one example, ansible, which already does all that, is also cross platform, and has no special dependencies or runtime overhead requirements either on the host or any on the target.

    • by jbn-o ( 555068 ) <mail@digitalcitizen.info> on Friday July 20, 2018 @06:30PM (#56983034) Homepage

      To elaborate on that last point: being dependent on works under the "Microsoft Patent Promise for .NET Libraries and Runtime Components" is considerably dangerous because of the profound limits for software reuse and modification, and because of how limited this "patent promise" is [endsoftpatents.org]. You cannot deal in the "Microsoft Patent Promise for .NET Libraries and Runtime Components" covered software as you can with free software (which is so named because it respects a user's freedoms to run, inspect, share, and modify the software) under, say, the GNU General Public License version 3 (GPLv3). Here are a few highlights from that article:

      "[Under the Microsoft Patent Promise for .NET Libraries and Runtime Components] youâ(TM)re only protected if youâ(TM)re distributing the code "as part of either a .NET Runtime or as part of any application designed to run on a .NET Runtime". So if you add any of the code to another project, then you lose protection and MS reserves the right to use their patents against you.

      [...] the protection only applies to a "compliant implementation" of .NET. So if you want to remove some parts and make a streamlined framework for embedded devices, then your implementation wonâ(TM)t be compliant and the protection doesnâ(TM)t apply to you.

      That's a huge danger, particularly to anyone used to working in free software where merging code between compatibly-licensed programs is the norm. Your interests as a user (regardless of your technical skill or willingness to learn technical skills) is far better served by the GPLv3 (also covered at the aforementioned article). The GPLv3 is simply far more straightforward and clear about your permissions, and the GPLv3 grants you what you need to deal fully in the software respecting your software freedom the whole time.

    • Hi Devslash0 this is your boss posting.

      Are you finished migrating to Azure yet that the CIO wanted? Oh yeah we need a convenient way to DevOps your Linux app for the Windows Systems Admins that they are familiar with that integrated well with Azure and is object based for our needs, not text based which won't work.

      Thanks and could you also Dev ops some on premise Windows Servers as well? We know you like Linux and that is fine but make it happen in your Linux scripting environment?

      Thanks

  • by Anonymous Coward

    To experience the stability and security you've come to expect from Microsoft Windows!

  • "...designed specifically for system administrators and power-users to rapidly automate the administration of multiple operating systems..."

    Oh you mean like how Windows has always treated dual-booting multiple operating systems? And support for filesystems of different operating systems? And pretty much any honest-to-goodness, not-embrace-and-extinguish support for *anything* other than M$ products on M$ operating systems, *especially* open-source products of any kind?

    As I do see this as a positive move for

  • by nnet ( 20306 ) on Friday July 20, 2018 @03:34PM (#56982184) Journal
    Can you install the VMWare cmdlets on it, or otherwise import them for use?
  • A *shell* as a snap seems to be an odd choice. It should be embedded in whatever environment.

    Powershell doesn't make sense as an end in and of itself, and 'Snap' and similar strategies only really possibly make sense for software that is an end in and of itself...

  • Comment removed based on user account deletion
  • by RhettLivingston ( 544140 ) on Friday July 20, 2018 @05:40PM (#56982834) Journal

    I installed this Wednesday to check out a challenge someone posted in a forum.

    The challenge was to implement the following powershell script using bash:

    param(
    [Parameter(Mandatory=$True)]
    [datetime]$FromDate,
    [Parameter(Mandatory=$True)]
    [datetime]$ToDate,
    [Parameter(Mandatory=$False)]
    [ValidateScript({Test-Path -PathType Container $_ })]
    [string]$Directory = '.'
    )
    Get-ChildItem -Include '*.JPG','*.PNG' -Recurse -Path $Directory | Where-Object { $_.CreationTimeUtc -ge $FromDate -and $_.CreationTimeUtc -le $ToDate } | ForEach-Object { $_.FullName }

    The challenge author also specified that the bash script should match the functionality of the above including:

    1. Output the full filename one per line that fulfills the requirements
    2. I'll totally run the script on a directory that contains some of the more exotic possible file names. (Good luck with that one)
    3. Define the parameters the script can take. Meaning two required parameters - FromDate and ToDate - and one optional parameter the directory. If no directory is specified just use the current one.
    4. Do validation of the passed in parameters. The directory should exist, the datetimes should be valid datetimes and not something else.
    5. And we certainly want tab completion for the parameters and a help that lists what parameters it takes. So the usual bash equivalent of this:
      Code:
      Get-Help .\test.ps1
      test.ps1 [-FromDate] [-ToDate] [[-Directory] ] []

    My first thought was, "I can get a bash script to run on any version of Windows and have been happily using bash and tcsh on Windows since Windows 95 in the 90s. Can that Powershell script run on Linux?" Surprisingly, I installed the powershell core snap, copied the script to test.ps1, and ran it with no issues. It doesn't convert me to powershell, but I was surprised the argument didn't hold.

    • The validation might take a few lines, but other than that, I see nothing that cannot easily be done with "find".

      • I'd agree. find handles the actual performance of the operation pretty nicely. It was the named parameters, validation, and automatic provision of help that gives powershell a boost. Another nice thing, while using powershell interactively, there was autocompletion on parameter names for commands in the shell. And, I've had issues with find and other linux commands differing from system to system. This wouldn't be as vulnerable to that.

        I have to install cygwin on windows to use bash and all of the common G

  • by fahrbot-bot ( 874524 ) on Friday July 20, 2018 @06:10PM (#56982954)

    Snap ... Many see it as the future of Linux, ...

    And many don't. (but they did, back in the 1980s when static-linking was all the rage)

    PowerShell ... is designed specifically for system administrators and power-users to rapidly automate the administration of multiple operating systems ...

    Meaning: Windows, Windows Server ...

  • Powers hell.

    IME it's a powerful but clunky piece of garbage.

  • ... is about the dumbest fucking thing I have ever read.

A committee takes root and grows, it flowers, wilts and dies, scattering the seed from which other committees will bloom. -- Parkinson

Working...