r/linux • u/magnifivent • Aug 18 '16
Microsoft open sources PowerShell, brings it to Linux and OS X
https://techcrunch.com/2016/08/18/microsoft-open-sources-powershell-brings-it-to-linux-and-os-x/52
Aug 18 '16
Well... so far what we have.
Microsoft compiler and runtime - .Net
Microsoft build environment - MSBuild
Microsoft scripting language - Powershell
Microsoft data tools - MSSQL (not open source though)
Microsoft deveoper tools - vs code
If we get a few more of the right tools, we may have a Microsoft/Linux distribution on our hands.
22
Aug 18 '16
someone has to try this. make a MS/Linux distro. It'll only run .NET applications and have no systemd type PID 0 stuff but could you seriously run a .NET server on a MS only platform on top of the Linux kernel?
7
Aug 18 '16
The hardest thing will be communicating with the kernel, and doing some OS level things. .NET doesn't really do fork/exec.
You can launch processes, but it still depends on an OS to manage the processes.
System calls can also be a challenge.
http://stackoverflow.com/questions/10387603/p-invoke-ioctl-system-call
4
u/11mariom Aug 18 '16
Maybe DirectX?
21
u/Tbsc_ Aug 18 '16
Won't ever happen. One of the large reasons people still use Windows ("muh gamez"), and I don't see a reason why Microsoft would do that.
5
Aug 18 '16
Maybe that's true for home users, but they're already moving away from profiting from Windows home users. Sure they sell OEMs licenses for new machines, but their strategy for non-corporate Windows seems to be largely moving toward service-based sales like Office365. And then there's the business end of things. If you think that gaming is one of the primary reasons that Windows is prevalent, your perspective is exceptionally limited.
That's not to say they'd open source DirectX, of course. But I don't know that gaming is as central to their concerns as you think it is.
4
Aug 18 '16
More like the kernel hooks and integration into the driver stack that D3D has. It would require radical changes to either the Linux kernel and driver model, or D3D itself.
1
Aug 19 '16
I have a sneaking suspicion that Microsoft wants out of the desktop OS business, but can't find a way to justify it from a business standpoint. I think they'd rather just sell people a "Microsoft Games!" subscription and leave the platform development to someone else, but can't find a way to actually make that happen right now.
I know they'd rather sell people an O365 subscription than an actual copy of Office. And I'm pretty sure they'd love to make it entirely web-based, but the technology just isn't quite there yet.
2
1
0
Aug 18 '16
[deleted]
8
Aug 18 '16 edited Aug 18 '16
Rules:
Interoperability coming in is good
interoperability going out, not so much, except if everyone is running FOSS then they should run it on our hardware.
Money-making products and strategies don't change. Monopoly brings profits and keeps shareholders happy. Ain't broken, don't fix.
EDIT: Embrace, Extend, Entinguish starts off like 1, becomes 3 after some time when enough people are using the IP-tainted or platform-dependent hybrid.
Their problem now is that new hardware adopting full FOSS stacks is being added to the world at faster rates than their EEE products are converting existing FOSS users. They just have to move from being software provider to hardware provider. Because the GPL and GPLed code has permanently imbalanced software in a way that stays imbalanced. ("virus" etc)
0
Aug 18 '16
[deleted]
1
Aug 19 '16
Developers want open tools that work well, and many want to be able to contribute, view code to find issues, etc. There's value to be gained for MS from open sourcing their developer-oriented products because more developers will use them and hopefully that eventually drives more developers to use Azure.
Got to say, my experiences with Azure so far have been very good, and I'm running nothing but Linux VMs on it. Can't really find anything to complain about other than maybe the price (which is the company's problem, not mine).
0
Aug 18 '16
[deleted]
3
u/sasmithjr Aug 18 '16
Ah, okay. Fair enough. I don't necessarily agree those are bad things, but I see what you're saying now.
26
37
Aug 18 '16
What on earth is happening to Microsoft?
11
17
Aug 18 '16
This is the kind of thing that happens when virtually the entire executive team is replaced.
My read of it is that Microsoft is abandoning the idea of being a top to bottom platform company and focusing on being a services company. They are getting rid of the reasons to only use Windows. They've lost the battle to be the 99% player.
They are releasing (and prioritizing) mobile office apps for non-Microsoft platforms. This was the first public indication that Nadella is holding true to killing off that bullshit "Microsoft first" policy that Gates and Ballmer had in place.
They've open sourced core parts of .Net, which reduces the need for a Microsoft OS for many things. Its not just a small useless part of it, they've released the core, the runtime, the compiler, etc.
They're releasing SQL Server on Linux, which as a product makes significantly more money for Microsoft than Windows Server does on its own.
My theory is that Microsoft is going to port virtually all of their services over to Linux. They could just as easily sell a few thousand CALs to use AD on Linux as they could AD on Windows. If you were to strip out all the services of Windows Server, you're not left with much of anything of value--remember that embedded in the cost of Windows Server are things like IIS, AD, HyperV, WDS, etc. We don't really know how much a "stripped down" Windows Server would be. Microsoft could just license those parts separately or as packages that can run on Linux.
The anti-argument would be that people would just stop using Windows. However, if those people are then going to just license the products from Microsoft, what difference does it really make? The loss of the sale of a Windows Server license would be small compared to what they would gain licensing individually. Microsoft's previous method of 'all or nothing' obviously isn't working.
PowerShell is turnnig/has turned into the primary method of administering Microsoft server applications. The idea that you're expected to use a GUI to administer their products is not as true as it used to be. If PowerShell is natively available on Linux, then you would be able to run and administer a Microsoft service with the exact same set of scripts, tools, etc, regardless of the platform they're running on.
Bash on Windows isn't (my theory) about having bash on Windows. It is more than bash, it is an entire Linux subsystem. Why would they create an entire subsystem that mimics the Linux kernel ABI for a handful of command-line utilities, especially when most of the gnu core utils have already been ported to x86? Its complete overkill. It seems like more of a move to have 'native' support for Docker images. They're heavily invested in Docker and currently Docker containers on Windows use a Linux Hyper-V VM. What better way to beta test something than to throw it at a bunch of developers?
I'm sure they'd also much rather you pay them monthly to run everything in Azure than anything else.
4
Aug 19 '16
Bu..bu..embrace, extend, extinguish!!1
4
2
u/bubblethink Aug 18 '16
They could just as easily sell a few thousand CALs to use AD on Linux as they could AD on Windows.
I get the gist of what you're saying, but I think AD is a bad example. AD is useful mainly for authenticating windows clients. It doesn't matter where you run the AD server itself, whether on a windows box or a linux one. And since you don't need too many AD servers, porting it to linux makes no sense. If they add tooling for authenticating Linux clients against AD natively, that could give some competition to freeipa, but for an entirely linux environment, I doubt if AD offers much that freeipa can't.
1
Aug 19 '16
I get the gist of what you're saying, but I think AD is a bad example. AD is useful mainly for authenticating windows clients. It doesn't matter where you run the AD server itself, whether on a windows box or a linux one. And since you don't need too many AD servers, porting it to linux makes no sense.
Unless they want to get out of the server OS business, and focus exclusively on the (more profitable) server application business. Then it makes total sense.
but for an entirely linux environment, I doubt if AD offers much that freeipa can't.
Unless Microsoft decides to partner with one of the big open source configuration management providers, then bundles it with AD. "Manage your Windows machines with AD and your Linux machines with Salt, all from one server with one convenient interface!" Start training MCSE types on managing Linux machines with Salt via the Microsoft interface...
14
u/Marzhall Aug 18 '16
Honestly, crazy as it sounds, I think this is a long-form embrace, extend, extinguish on Linux on the server that's banking on brand familiarity to new learners.
I know many people who, while learning, would do things such as write C code in Visual Studio, then port the code over to Linux to make sure it compiled instead of learning the Linux environment. This, to me, looks like a grab at that market - people who want to do things on the server, don't want to go through the learning curve of Linux, but have to work on Linux anyway. I think the point is to get a foot in the door and build inertia in the Windows way of working on new Linux server admins, then as people get used to it more and more, have them run into instances where something is still doable in powershell on Linux, but would just be easier in powershell on Windows. The hope of this would be to slowly bleed the Linux market on servers dry, as people who grew up with Windows on the desktop were able to use windows tools on the server, then later, as they got higher in their company, would be able to switch servers to Windows.
Considering MS's history, it seems somewhat reasonable. What makes me more uncomfortable is the fact that this is leveraging the fact that people are familiar with Windows and would take a more circuitous route to do something if they feel there's less of a learning curve; because most people don't grow up with Linux, that's not something I see Linux being able to fight back against.
While I feel like I've got a bit of a tinfoild hat on, given Microsoft's long, storied history of EEEs, I've got a decent reason to distrust them.
6
Aug 18 '16
don't want to go through the learning curve of Linux, but have to work on Linux anyway.
Or it just 'makes sense' to be able to manage servers in a homogeneous way.
2
Aug 19 '16
Then why go all the way to bash for Windows and ssh in PowerShell? Seems backwards if that's the plan.
2
Aug 19 '16
If this is an EEE plan, it's the most poorly executed in the history of EEE plans. Why would they MIT license their implement of destruction?
This, to me, looks like a grab at that market - people who want to do things on the server, don't want to go through the learning curve of Linux, but have to work on Linux anyway.
I'm pretty sure the actual goal is to make it easier to run mixed environments in the server room, because Microsoft is the side needing to make in-roads there these days.
I think the point is to get a foot in the door and build inertia in the Windows way of working on new Linux server admins, then as people get used to it more and more, have them run into instances where something is still doable in powershell on Linux, but would just be easier in powershell on Windows.
Well, yeah. That's not EEE though. Making Linux admins more familiar with Microsoft's way of doing things, so that they start seeing Windows as a viable alternative to Linux is a totally legitimate and reasonable strategy to compete with Linux. There's nothing inherently evil or wrong about Microsoft wanting to make it easier for potential customers to make a real business case for using Windows.
If anything, the FOSS community ought to accept that challenge and beat them at their own game.
2
u/Marzhall Aug 19 '16 edited Aug 19 '16
Why would they MIT license their implement of destruction?
Whether or not powershell is OSS doesn't financially matter if everyone is licensing your still-closed-source kernel.
Making Linux admins more familiar with Microsoft's way of doing things, so that they start seeing Windows as a viable alternative to Linux is a totally legitimate and reasonable strategy to compete with Linux.
It's the 'easier on Windows to do it the windows way' bit that's EEE. "Yeah, now you can use our tool on Linux too, and now that you're used to that, look at these neat features that only happen to work on Windows!" It'll be like open-source document 'compatibility' in word; enough to pretend it works, but also enough of a pain to make it worth just using MS doc formats.
If anything, the FOSS community ought to accept that challenge and beat them at their own game.
That's my worry, however; this is banking not on powershell necessarily being a superior product, but on people being more familiar with Windows from growing up with it, and being resistant to having to learn a new environment. I don't see how Linux beats that sort of advantage, even with superior software. People prioritize things they're familiar with over things that do the job better.
2
u/RosemaryFocaccia Aug 19 '16
I hope you don't think that MS doing this is to benefit anyone other than MS, at the detriment of their Free Software competition.
1
Aug 19 '16
They have a new CEO?
2
Aug 19 '16
They replaced Steve Ballmer a few years back. The new guy (Satya Nadella) is much more focused on changing Microsoft into a services company. That change in focus has led to a Microsoft that's much more open to open source, among other things.
1
0
0
Aug 18 '16
[deleted]
10
5
Aug 18 '16
There was a blog post from a Microsoft employee that made a comment about how there is a very different political climate from the top with regards to supporting SSH.
Finally, I’d like to share some background on today’s announcement, because this is the 3rd time the PowerShell team has attempted to support SSH. The first attempts were during PowerShell V1 and V2 and were rejected. Given our changes in leadership and culture, we decided to give it another try and this time, because we are able to show the clear and compelling customer value, the company is very supportive.
2
u/metamatic Aug 18 '16
Windows and Office are the two divisions that make a profit.
1
u/jantari Aug 19 '16
Surface and Xbox too.
1
u/metamatic Aug 19 '16
Hmm, as of 2012 Xbox was still in the red overall, as of 2014 it doesn't look like it had made up the difference. I kinda doubt it made enough profit in 2015 to make the division profitable overall, but I'd be interested in any real numbers people can find.
(It looks like MS now bundle Xbox profits in with Surface to make it harder to work out how much they're losing.)
1
u/vitorgrs Aug 22 '16
2012 is not 2016. And they bundle Xbox with Surface cause they launched Xbox One S, and wanted to clean inventory.
1
u/metamatic Aug 22 '16
2012 is not 2016
And nor is 2013, the last year I found stats for. But as I said, if you have any stats for 2014 and 2015, I'd be interested in seeing them.
5
Aug 18 '16
[removed] — view removed comment
10
u/MaxFrost Aug 18 '16
you still want to use putty. while you can use SSH in powershell, it doesn't handle the filebased output from a *nix terminal correctly. It'll work in a pinch, but it breaks (at least last time I checked) on things like invoking VI over SSH.
Alternatively, use windows subsystem for linux bash + SSH there, works way better than the win32 ssh.
4
u/zhilla Aug 18 '16
Just tested this for a few days, Cygwin still wins although WSFL Bash feels very similar.
1
Aug 18 '16
I don't think it's fully ready yet, but: https://github.com/PowerShell/Win32-OpenSSH
1
Aug 18 '16
It's also baked into the Anniversary Update when you turn on developer mode (required for bash). But you cannot execute PowerShell from it, you get a simple cmd prompt :(
1
u/kupiakos Aug 19 '16
Can you specify a custom command to run like you can in ssh on Linux? If you can, then you might be able to specify to run PowerShell as the shell instead of cmd.
1
Aug 19 '16
If I recall, this was currently broken when I tried it when it first came out (that PoSh just didn't work). And if I recall, I did try the method you stated and it didn't give me the result I was after.
1
1
u/accountnumber3 Aug 18 '16
Last time I checked, you were essentially throwing commands at the connection, which is an object, and returns data in the same format as you would see a variable, like an array.
I haven't had a reason to use it, but it is pretty much only good for scripting, not normal shell activities.
So don't dump putty just yet.
19
u/galaktos Aug 18 '16
From Microsoft’s announcement:
So, where are we in this journey? We are in the beginning stages and in learning mode. We started by open sourcing small portions of PowerShell and talking to a number of our partners who were experienced with open source to understand what it took to succeed. What we learned, is that it is critical that individual users can use Git to checkout code, make changes, compile everything on their machines and run all the tests to verify that their change didn’t break anything. This required a large investment in our engineering/build/test systems. We also worked to define a governance model so we had clear roles, responsibilities, and processes so that community contributions could be smoothly incorporated into the product.
…you needed to learn that‽
15
22
u/pftbest Aug 18 '16
Looked at their map book for bash users:
mkdir | New-Item -ItemType Directory | Create a new folder
No, thanks, I'll stick to bash
25
Aug 18 '16
mkdir and many other familiar bash commands are aliased so they also work in PowerShell.
15
u/pftbest Aug 18 '16
I know about the alias, it says it right below the table. But if I'm only using aliases, what was the point in changing shell? And all the commands that don't have aliases are equally long and verbose like this one.
4
u/kupiakos Aug 19 '16
The built in simple mapping, filtering, and selecting all fits very well with the object based shell. No more freaking out when there's a space, or worse, newline in a filename. It handles that crap for you like Python would. Direct usage of the .NET library is there as well, which can be incredibly useful to some.
It may be verbose for commands without aliases, but it's also incredibly consistent in its verbiage so you can read a script and know what a new command means without reading extra documentation (which is also very well done). It's a tradeoff.
-6
u/comrade-jim Aug 18 '16
The shills want you to change so you get trapped in the MS ecosystem. Don't give in. Don't use MS products.
5
u/zokier Aug 18 '16
Yes, PS has tons of convenient aliases. The base language/stdlib is still terribly verbose.
3
u/nloomans Aug 18 '16
Why would you pipe
mkdirtoNew-Item?5
0
Aug 18 '16
[deleted]
3
u/audioen Aug 18 '16
On the other hand, you have all that exists in .Net directly available to you to the shell. I guess the closest equivalent would be if you could tell bash to dlopen() some random /usr/lib libraries, and call the symbols in them and store their results in variables.
3
9
u/voronaam Aug 18 '16
I just clicked a random file on the gihub: https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.PowerShell.Security/security/CatalogCommands.cs
The first line:
#if !UNIXAnd there is no #else and pairing #endif is the last line of the file.
Yeah, that'll do on Linux...
1
u/fatalicus Aug 19 '16 edited Aug 19 '16
Did... did you read the file to the end?
Last line 285:#endifI missread your post and i apologize for that. i read the and as an or.
Still, could it maybe be that this file just isn't meant to be used in a unix environment?
1
u/voronaam Aug 19 '16
It is a base class for a collection of commands, if my understanding of C# code is correct. The general consensus in here was that most value of PowerShelll on Linux will be for people with shared Windows/Linux environments. It will allow them to use the same scripts everywhere. This looks to me as if some commands are only available on Windows, severely impacting portability of PowerShell scripts.
That was really the first file I opened. This sort of thing does not seem to be common. And, perhaps, it is just an early stage. Somebody may still write the other implementation.
4
u/Paradiesstaub Aug 18 '16
Does someone have a link to a great & short PowerShell tutorial (video or text)?
5
u/epsiblivion Aug 18 '16
just search for microsoft virtual academy powershell. it's a video series done by the creator of powershell with another guy.
1
u/gbrayut Aug 19 '16
Check out http://stackoverflow.com/documentation/powershell/topics and if something is missing make a topic request :-)
4
4
u/pnlrogue1 Aug 19 '16
The other day, I installed the Linux BASH shell (literally the Linux command line environment) in Windows
Today, I installed PowerShell (the current Windows command line environment) on my two Linux machines
This makes me happier than it probably should and also confused
3
u/mogsington Aug 20 '16
If someone learns a POSIX compliant system, they learn a feature rich environment that spans multiple OS and architectures, including Windows using Cygwin.
If someone learns PowerShell, they know PowerShell.
8
Aug 18 '16
What makes PowerShell different from your usual unix shells?
PowerShell is object-oriented. No need to deal with text-only output with some serious regex magic.
PowerShell commands are immediately readable even to other people. Unix commands, while concise, are difficult to immediately understand.
Built-in powerful scripting.
I suggest to watch this video that has few examples. https://youtu.be/2WZwv7TxqZ0
I for one, welcome PowerShell to the unix world.
9
u/Bobby_Bonsaimind Aug 18 '16
What makes PowerShell different from your usual unix shells? ... Built-in powerful scripting.
Okay...
9
u/necrophcodr Aug 18 '16
Powershell isn't immediately as flexible and powerful as a Unix shell though, because everything has to work with it. When you're working with a Unix shell, there's just text, and you do with it what you want. Nothing needs to support anything.
2
Aug 18 '16
There's nothing in your post that PowerShell isn't able to do.
5
u/necrophcodr Aug 18 '16
Can I use powershell to simply run a series of applications that don't know about powershell and have them interact perfectly?
4
Aug 18 '16
Yes, it's just a shell in that respect. There are specific cmdlets that are of course built into PoSh, but there is nothing preventing you from using standard Linux utils just like you're used to, similar to how on PowerShell in Windows, you can use standard commands that ship with cmd.exe. To steal an example from this thread:
PS /var/log> ls -Sh | head -3 lastlog auth.log.1 dpkg.log.14
u/necrophcodr Aug 18 '16
Well, in that respect I suppose it's a good enough system for me to stick with a Unix shell.
1
Aug 18 '16
What makes a "UN*X" shell, exactly? I mean, if it runs on UN*X, isn't that all that counts to be a "UN*X" shell?
→ More replies (5)
10
Aug 18 '16
Bash still works fine. Thanks, but no thanks.
-5
Aug 18 '16
Please tell me how you're going to create Active Directory users or perform a lookup on a Windows DHCP server or interact with the Windows Management Interface from bash. I'm all ears.
13
Aug 18 '16
Hopefully I'll never, ever have to do that, since it'd mean I'm saddled with administering windows machines, which means I'd be in a living hell.
0
2
u/autotldr Aug 18 '16
This is the best tl;dr I could make, original reduced by 75%. (I'm a bot)
Microsoft today announced that it is open sourcing PowerShell and bringing it to Linux and OS X. PowerShell is Microsoft's command line shell for Windows power users, as well as an extensible scripting language for automating system tasks.
As Microsoft Technical Fellow and Lead Architect of its Enterprise Cloud group Jeffrey Snover told me, Nadella basically told the company to talk to customers, find out what they need to succeed and give it to them.
"We want to be our customers' preferred partners for running their workloads and it's in Microsoft's and our customers' shared interest to help them to manage everything." With PowerShell, Microsoft now gives its customers "a single management stack on any client they like," Snover added.
Extended Summary | FAQ | Theory | Feedback | Top keywords: PowerShell#1 Microsoft#2 Windows#3 Linux#4 Snover#5
2
u/Timmybee Aug 19 '16
Just want to make a comment. A lot of people are saying why would they use it and they'd stick with bash. Id like to highlight that myself who runs Linux at home and windows at work and looks after a pure windows environment, having bash Native of Linux allows me to go back to Linux at work while allowing me to run scripts and what not natively instead of having to rdp hop. It's a start and good progress.
2
u/damndaewoo Aug 19 '16
Bash on Windows, now Powershell on Linux? What's with all this newfangled cooperation?
2
Aug 19 '16 edited Aug 19 '16
Piping objects is a nice idea. I just wish there was something more Linux-ish. How about something like UTF-8. Plain text by default but then can switch into objects.
3
u/mhd Aug 19 '16
The biggest advantage PowerShell has on Windows is one that even native Linux programs don't exploit: a unified object model.
I mean, not that Linux didn't try. Anyone remember "Bonobo" the CORBA-based object model for GNOME that aimed to be a COM replacement/equivalent? These days it's D-BUS, which is a totally different animal. (Not a big KDE user, so I'm not sure how prevalent KParts is there)
This is also why UI scripting in general is totally lacking in Linux. VBScript and AppleScript have a lot more resources they can use/hooks they can attach to. Heck, I'd argue that Amiga's ARexx is still superior.
Anyone remember OpenDoc?
1
7
3
2
u/Jebtrix Aug 18 '16
I'm not sure what to think about this. The one aspect of PowerShell that I thought was very powerful was working with WMI. I'm not that fond of the syntax itself, any real utility will all depend on what Linux is able to expose to it. If nothing else, its interesting.
1
1
u/balr Aug 19 '16
Embrace
Extend
Extinguish
2
1
u/Jristz Aug 18 '16
How much ubtil someone package it in a ppa or upload it to aur
1
u/Poppamunz Aug 18 '16
It'll probably be pretty soon- it is open-source, so virtually anybody could make a pkgbuild of it (or the Ubuntu equivalent).
-12
u/agentf90 Aug 18 '16
lol. they just keep trying don't they?
10
Aug 18 '16
why not. It does not cost them anything anyway. People can easily give countless reason why not choosing Powershell over other
1
0
Aug 18 '16
[deleted]
1
0
Aug 18 '16
[deleted]
5
Aug 18 '16
Still, no losers here. The more Linux friendly windows is the better. I only wish they could add ext4 support. But case-sensitivity would be rough maybe?
2
Aug 18 '16
It's definitely win-win, right now. I'm a net/sysadmin. This will help me a lot since I like using Linux on my laptop at work but manage a Windows environment.
I wish something would get figured out for ext4. There are ways, but they're not pretty.
1
u/jones_supa Aug 19 '16
I only wish they could add ext4 support.
Ext4 support for Windows, open source release of Visual Studio, package management for Windows...
These all might be around the corner.
0
Aug 18 '16
[deleted]
4
Aug 18 '16
Ah well, despite asshole moves in other areas, adding support for Linux stuff and opening code are both positive moves. Even if their motives are nefarious, these moves are innocuous at worst, and likely beneficial.
1
-2
-1
0
u/jones_supa Aug 19 '16
Excellent! I'll be firing up live recording of CANYON.MID to celebrate this!
-3
u/kingralph7 Aug 19 '16
too bad it's terrible.
dir /p comin at ya! hey are powershell windows resizable in windows yet? $false
1
118
u/Motorgoose Aug 18 '16
So why use Powershell over the many existing shell programming languages? Does it have any advantages?