r/sysadmin • Systems Engineer • Aug 18 '16

PowerShell is open source, available for Linux and OS X

https://github.com/PowerShell/PowerShell
1.3k Upvotes

369 comments sorted by

163

u/rapidslowness Aug 18 '16

What can you do with it on a linux machine? Everything I do with powershell is windows specific (AD users and groups, stuff like that).

43

u/[deleted] Aug 18 '16

My only guess is if you'd want to remotely manage windows boxes from your linux/mac system?

22

u/rapidslowness Aug 18 '16

will the necessary modules run on macs or linux machines? without the AD module you can't manage your windows boxes.

1

u/vmeverything Aug 18 '16

From what I understood, Microsoft's modules will be supported.

5

u/rapidslowness Aug 18 '16

how do you obtain and install them?

→ More replies (1)

2

u/GhostDan Architect Aug 18 '16

Can you create remote powershell sessions? That's generally what I do rather than have a hundred modules on my machine.

→ More replies (5)

0

u/[deleted] Aug 18 '16

[deleted]

18

u/ThePegasi Windows/Mac/Networking Charlatan Aug 18 '16

Just tried Enter-PSSession and Stop-Computer $hostname from a Mac. No workey as of yet.

54

u/SteveL_Msft Aug 18 '16

We have early support of PSSession over SSH right now. Stop-Computer $hostname does it's own remoting and will need to be reworked. Please open an issue on GitHub.

9

u/ThePegasi Windows/Mac/Networking Charlatan Aug 18 '16

Will do, thanks for the reply.

7

u/tetroxid export EDITOR=$(which rm) Aug 19 '16

PSSession over SSH

Please please please pretty please include an OpenSSH daemon on windows server by default. I hate RDP so much, it's so slow and clumsy. If I could SSH to a windows machine and get a powershell prompt I would be so happy.

→ More replies (1)
→ More replies (32)

1

u/myworkaccount999 Aug 18 '16

You probably know by now but that's not the case. They've wrapped some native Linux binaries with cmdlets. As well, services that return JSON data are parsed by PowerShell to take advantage of PS's object paradigm.

1

u/Arlieth Sr. Sysadmin Aug 19 '16

If you do vmware stuff, it's a LOT easier to script with PS.

1

u/Zaphod_B chown -R us ~/.base Aug 18 '16

You don't need PowerShell to do that though. You can just remote desktop in unless you wanted to what, use some sort of telnet/ssh to remote in?

19

u/Vance84 Aug 18 '16

PowerShell lets you connect via...well..PowerShell using different commands (Enter-PSSession for instance) like you would with SSH. Microsoft doesn't want you doing everything through the GUI any more - they want you using PowerShell to manage everything.

6

u/da_chicken Systems Analyst Aug 18 '16

PowerShell lets you connect via...well..

It's a WinRM session, which is an implementation of WS-Management.

8

u/SteveL_Msft Aug 18 '16

That is correct, although the current alpha.9 release includes early code that enables PowerShell remoting over SSH. On Windows, you would need to install OpenSSH as well as the Open Source PowerShell. In in-box Windows PowerShell only understands WinRM.

8

u/GhostDan Architect Aug 18 '16

As a enterprise admin/engineer who uses powershell every day.. hell every hour. You are doing gods work sir. Keep it up!

→ More replies (1)

4

u/minimim Aug 18 '16

They are also promising a complete SSH implementation. Third time is the charm, I guess?

21

u/SteveL_Msft Aug 18 '16

My team is working on that as well http://github.com/powershell/openssh. Note that we aren't doing a "complete SSH implementation" as in writing something from scratch, but implementing a portable layer so that OpenSSH works great on Windows. We're still actively working on this and it'll take time before we can call it production ready, but one of the goals is to get our code accepted back into OpenSSH so we won't maintain a fork in the long run.

→ More replies (6)
→ More replies (5)

1

u/[deleted] Aug 18 '16

Can remote desktop even be used for an automated script to issue commands over? And wouldn't it pop up a GUI wasting resources and adding latency?

It seems to me a bash script calling powershell to run commands on a remote Windows machine is a lot more streamlined than getting remote desktop involved.

71

u/vmeverything Aug 18 '16

For starters administration just got a whole lot easier in a mixed environment.

33

u/phoenix616 Aug 18 '16

But can't you just use bash?

31

u/[deleted] Aug 18 '16

Theoretically, maybe, if you had Cygwin installed on Windows (or Ubuntu in the new Windows 10 thingy). But as it is, no, you can't just run bash scripts on Windows or Azure.

10

u/funknut Aug 18 '16

Git for Windows installs a pretty fully feature bash port for windows.

17

u/kihashi Aug 18 '16

Even if all of your windows machines are on Win 10, you have to enable "Developer Mode", which works great is you are a dev or sysadmin, but I don't think it will work for most end user set ups.

20

u/[deleted] Aug 18 '16

True. As an administrator, I don't think I really want to enable "Developer Mode" on everyone's machine.

→ More replies (2)
→ More replies (1)

10

u/vmeverything Aug 18 '16

You cant use bash to administrate a mixed environment, not to mention Exchange, SQL (even though its on Linux now) etc.

9

u/phoenix616 Aug 18 '16

So what's the benefit of bash on windows 10 then if you can't use it?

19

u/masta Aug 18 '16

Give it time. These things don't get started in production, they get started in developer mode.

→ More replies (2)

8

u/frymaster HPC Aug 18 '16

bash on windows is being marketed as a dev tool, not a sysadmin tool. For example, you can't really run daemons whereas powershell has an SSH server now

→ More replies (1)

10

u/vmeverything Aug 18 '16

You can use it. Bash on Windows basically lets you use your Linux scripts on Windows.

Bash isnt made to administrate Windows (and I dont think any effort will be made). It is a shell and you can administrate linux (and its not really for that anyways but thats beyond the point).

Powershell is made to administrate Windows. Its a shell who's entire point is to do that. You put that on Linux and now you are administrating Windows from Linux.

→ More replies (1)
→ More replies (2)

3

u/vmeverything Aug 18 '16

bash isnt made to administrate Windows (and I dont think any effort will be made). It is a shell and you can administrate linux (and its not really for that anyways but thats beyond the point).

Powershell is made to administrate Windows. Its a shell who's entire point is to do that. You put that on Linux and now you are administrating Windows from Linux.

1

u/dogfish182 Aug 19 '16

Which is also now natively available on windows

→ More replies (1)

5

u/GhostDan Architect Aug 18 '16

There's actually a really decent amount of outside vendors that support powershell as well. Cisco, Equalogic, Netapp, EMC, Dell, HP, etc all have powershell modules that can make administration easier. I actually prefer the powershell module to the CLI on many of them.

Also Microsoft has a Powershell for the administrator class, which I really highly recommend. As much as I thought I knew what powershell did before I took that class, it was a eye opener on just how far I could take it.

3

u/halr9000 Aug 19 '16

I read your comment on-air during PowerScripting Podcast interview with /u/jsnover just now.

1

u/GhostDan Architect Aug 19 '16

Thats awesome. I should have put my 2 cents about how out-gridview is so under utilized.

1

u/unkownunkowns Aug 19 '16

Microsoft has a Powershell for the administrator class

Do you have a link?

2

u/GhostDan Architect Aug 19 '16

I couldn't find the html link, other than one in I think dutch, but here's the PDF http://download.microsoft.com/documents/France/services/2015/WindowsPowerShellv4v0fortheITProfessional-Part1-EN.pdf Part 1 was great. Part 2 was great the first day, the 2nd and 3rd day got more into .net coding, but it was still educational.

4

u/el_seano Aug 18 '16

One of things I anticipate will be a lot simpler is making packaging and installer scripts across different platforms.

3

u/deadbunny I am not a message bus Aug 19 '16

Please don't make installer scripts, please just provide a distro native package so we can automate with the wealth of automation tools we already have.

Thanks, Linux admins

2

u/11235813_ DevOps Aug 19 '16

Working with CSVs and other data files is a breeze in PS.

1

u/vppencilsharpening Aug 18 '16

I see this as a first step.

As (ASP.NET Core)[https://docs.asp.net/en/latest/intro.html] & (SQL)[https://www.microsoft.com/en-us/cloud-platform/sql-server-on-linux] become stable and accepted on Linux, this will probably be more important.

1

u/fnordfnordfnordfnord Talentless Hack Aug 18 '16

I think they're hoping that OSS folk will build that out for them.

1

u/da_chicken Systems Analyst Aug 18 '16

Currently, the best thing it does is give you an interpreted .Net environment.

1

u/bblades262 Jack of All Trades Aug 18 '16

Query WMI? Maybe?

The big items are coming soon. It's all about adapting commands to work on Linux platforms

1

u/[deleted] Aug 19 '16

I'd be really interested to know if you can import modules, specifically O365/Msol cmdlets - if so, I have just solved a budget issue...

1

u/andrewtchilds Aug 19 '16 edited Aug 19 '16

Implicit remoting!

$s = New-PSSession DC01
Import-Module -PSSession $s -Name ActiveDirectory
Get-ADUser bob

1

u/pier4r Some have production machines besides the ones for testing Aug 19 '16

Well, already working with object based shell is great, the commands may adapt too to export objects (or wrappers can be made) and then, well, great. I already love the idea.

Otherwise waiting for a shell working with object would have been a long wait.

0

u/[deleted] Aug 18 '16

[deleted]

50

u/moviuro Security consultant Aug 18 '16

The paradigm is completely different than sh (and derivates).

sh works with strings of text, whereas PowerShell works with objects, making it (hopefully) more versatile. It could open up lots of new ways to write scripts. (dunno if this will be good or bad next to sh, perl, and whatnot though)

14

u/brontide Certified Linux Miracle Worker (tm) Aug 18 '16

Right, which is why I do most of my heavy lifting in Python rather than straight Bash. Still without the object interface PS will be a pretty craptastic on non MS platforms.

16

u/[deleted] Aug 18 '16

The object interface comes from the underlying .NET Core, which is what is responsible for interacting with the underlying system itself. PoSh itself doesn't have to 'do much' since it is leveraging .NET Core.

9

u/jimicus IT Manager Aug 18 '16

I think that's essentially the point.

.NET integrates very nicely with Windows because Windows itself is object-oriented.

Linux isn't. Linux treats everything as a stream of text. Application configuration, OS configuration - very few of these tasks were designed around OO ideas.

Which realistically means the Linux .NET implementation (and hence the Linux Powershell implementation) will either:

  1. Never give you complete access to all the things that go on under the hood in the same way it does on Windows OR:

  2. It will, but as soon as you do something outside the .NET framework you'll be manipulating plain text files in Powershell (which somewhat eliminates 90% of the goodness Powershell offers) OR:

  3. Implement a shim layer that makes the non-OO land of Linux look OO to anything using .NET. (Which is going to be an unholy mess of incompatibilities and incompleteness because we can't realistically expect the various applications in Linux to start to account for this sort of thing when them implement new features, and I think even Microsoft would be hard-pressed to blag sufficient resources to implement modules that manage Apache, Nginx, Samba, Postgres, MySQL, Postfix and OpenLDAP using the same syntax as the existing modules that manage SQL Server, IIS, Exchange, Active Directory, etc etc)

15

u/theevilsharpie Jack of All Trades Aug 18 '16

.NET integrates very nicely with Windows because Windows itself is object-oriented. Linux isn't. Linux treats everything as a stream of text.

There is nothing inherently object-oriented (or text-oriented) in either Windows or Linux.

→ More replies (2)
→ More replies (1)

3

u/[deleted] Aug 18 '16

[removed] — view removed comment

13

u/ramblingcookiemonste Systems Engineer Aug 18 '16

there's about a half dozen ways to do each and every damn thing

Hi!

That's odd. Is there one true way to do things in Python? I'm not an expert, but AFAIK any programming language worth using is going to offer more than one way to skin a cat. Sort of a common trait across languages, including spoken ones...

Cheers!

6

u/Findal Aug 18 '16

There is but Python makes a big song and dance about the most pythonic way so at least theoretically there is only one right way. I get where he is coming from but I also think people get too attached to their way or their language.

Personally can't see huge uses for PS in Linux but it might fit someones bill nicely.

→ More replies (1)

3

u/GhostDan Architect Aug 18 '16

hmm. I don't really find it super complex. And I find as I learn more and more about it I have to look up things less often, because of some of it's simplicity. Then again, I grew up in programming when Pascal was still the language of choice.

→ More replies (1)

16

u/[deleted] Aug 18 '16

Also if we are honest, the whole PowerShell Noun-Verb makes it a hell of a lot easier to understand than Bash commands, some of which require a brief history of computing to know why commands are called what they are called. Why would I want to Super Do something?

→ More replies (16)

7

u/masta Aug 18 '16

Well to be perfectly blunt, the Linux/Unix world is held back by Posix Bourne/Korn shell compatibility... at least in my opinion. Much the same way Windows was held back by the limitations of CMD.exe.

One of the biggest weaknesses of Posix'ish shell environment is the lack of rich datatypes. Stuff like lists of lists, compound data structures, etc. That is just the tip of the iceberg, really. There is some progress being made in some research type shells, but no big movement behind replacing Posix with something modern.

Pity

8

u/theevilsharpie Jack of All Trades Aug 18 '16

Python is available for anyone that wants rich data types and other, more advanced language facilities that aren't in Shell.

12

u/masta Aug 18 '16 edited Aug 18 '16

This has been mentioned before, and shot down again and again.

Every blue-sky scripting language seems to have some form of interactive interpreter along-side the byte-code compiler & runtime.

One of the problems here is these advanced scripting languages were not designed to be interactive shells, with scripting as secondary. They are scripting first, and interactive last. For example, python has a great set of built-in commands, and datatypes. But running external commands still means you have to system('foo','bar-arg','blah-arg') your way out... But that is an implementation details really... it could be made to work, but it's not the only issue to solve.

I'm not saying python is a bad choice, but it's not the right choice, else it would be the Posix shell already (or Perl would have, etc)

→ More replies (1)
→ More replies (6)

0

u/[deleted] Aug 18 '16

[deleted]

7

u/EternallyMiffed Aug 18 '16

Loading arbitrary functions from arbitrary dlls is also pretty neat. You can literally do anything with it.

6

u/jjonathan313 Aug 18 '16

The video actually shows you can mix other shells into the script.

$var = python -c "print('Hello World')"

Now you can work with that string.

They also made a commandlet for crontab.

2

u/GhostDan Architect Aug 18 '16

remote powershell would resolve some of the module issues. I generally use that on a lot of my interactions.

2

u/up_o Aug 19 '16 edited Aug 19 '16

As someone who doesn't use PowerShell but will gladly "pry" relevant information from a wall of text in bash, can you help me understand what is actually happening when you "pull a value out of a property" instead?

7

u/SSChicken VMware Admin Aug 19 '16

Have you ever used an object oriented language? It's just that, a service, process, virtual machine in VMware, website in iis, file. They're all objects and all the information about them is stored inside the object when we store it in a variable. It allows you to do very powerful things in very easy to follow code. We can get all the information about it, we can Call methods, and we can even register events to execute more script when they are triggered.

→ More replies (6)
→ More replies (1)

2

u/moofishies DevOps Aug 19 '16

As someone who is an aspiring admin but not quite there yet and still working on their powershell and bash, could you explain that in more detail? In these threads and powershell going open source I've seen a lot of people talk about how powershell is object oriented, but I don't fully understand what that means or how it's better than bash.

9

u/[deleted] Aug 18 '16

Some of the modules can probably be ported over without a lot of difficulty. Some are probably tied to Windows, but MS may be about to port over some kind of library or compatibility layer for some of those things.

As some people have pointed out, this is probably at least partially about allowing Mac/Linux users to admin O365 and Azure, which can probably be made to work if Microsoft is motivated to do that.

But I appreciate the idea because, as you said, it's just a shell. I administer a lot of Windows machine, quite a few Macs, and very few Linux servers. Because the majority of my machines are Windows and I want something that will run scripts reliably out of the box, I tend to write my admin scripts in Powershell and then rewrite them in some other language to run on Macs if needed. The possibility writing scripts that can run on either Windows or MacOS is attractive, even if I have to check some environment variables or make some adjustments.

4

u/antb123 Aug 18 '16

Python wrapper pls?

4

u/Zaphod_B chown -R us ~/.base Aug 18 '16

give it 24 hours that will be on Github

1

u/[deleted] Aug 18 '16

But I don't really see Powershell being all that useful on other platforms until those modules become available.

For the neckbeards that need to administer Azure-specific boxes/services, this could keep them on Linux.

0

u/[deleted] Aug 18 '16

[deleted]

4

u/[deleted] Aug 18 '16

Not just Office 365, but various Azure administrative features require Powershell.

2

u/EternallyMiffed Aug 18 '16

You can already execute remote shell commands with pure PS.

1

u/tetroxid export EDITOR=$(which rm) Aug 19 '16

Welcome to the nineties, windows admins. It's about time.

121

u/NeoXant Aug 18 '16

We need to go deeper: Screenshot

14

u/wpgbrownie Aug 19 '16

Yo dawg I heard you like shells..

I will see myself out......

3

u/poshpotdllr Aug 19 '16

that was an awesome drop. if you would have finished it normal i wouldnt have lold irl

4

u/stealer0517 Aug 19 '16

I just did the same thing

does your cursor shoot across the screen when you type, and does it seem to forget where it should be typing?

2

u/NeoXant Aug 19 '16

Yes. Somebody reported that here.

83

u/segagamer IT Manager Aug 18 '16

Next up;

The Windows kernel.

38

u/[deleted] Aug 18 '16

You're joking, but I wouldn't be shocked if they open sourced the Windows kernel. Even if they did something like Apple (open source the kernel but keep closed some of the things needed for the whole OS install), I think it would be a smart move.

Of course, it could compromise some of their copy protection efforts, but I still suspect they have plans to do it at some point.

23

u/[deleted] Aug 18 '16

There's probably no easy way to open source the Windows kernel, given 30 years of contributions from various developers.

7

u/Kalc_DK Aug 19 '16

Well we can probably assume that they all worked for Microsoft and their work in the kernel was owned entirely by Microsoft. Only issue is if they licensed other technologies from other companies in their microkernel.

3

u/spiderbiten Aug 19 '16

NT was forked from OS/2.

OS/2 was jointly developed by IBM and Microsoft.

There were articles years ago when people cried for IBM to open source OS/2 that they couldn't because of the co-ownership with Microsoft.

→ More replies (1)

0

u/[deleted] Aug 19 '16

[deleted]

5

u/deadbunny I am not a message bus Aug 19 '16

"stolen", you mean used under the terms of the licence?

4

u/BigRedS DevOops Aug 19 '16

I think that stuff about the BSD IP stack is now widely-claimed to be just rumour. But the nature of the BSD license means it never needs to become public information.

5

u/[deleted] Aug 18 '16

I don't really know about that. I just wouldn't be surprised if they were working on making it possible, even if they haven't finalized any plans to actually do it, and even if they're not working particularly hard on it.

11

u/[deleted] Aug 18 '16

In order to open source .NET, Microsoft basically had to completely rewrite it.

5

u/tas50 Ex-DevOps. Now Product Aug 19 '16

It's not the developers that kill you. It's the licensed code from 3rd parties. Without a doubt MS has a good chunk of software in the kernel that they didn't write. Look at what Sun went through when they open sourced Java. There was a non-trivial chunk of Java that never went open source since Sun didn't actually write it.

→ More replies (1)

1

u/spiderbiten Aug 19 '16

I don't see it happening anytime soon.

Though you never know, IBM may open up to the idea.

2

u/aaronfranke Godot developer, PC & Linux Enthusiast Aug 18 '16

Well, it would help the development of WINE, which Microsoft may not want.

5

u/showmeyourtitsnow Aug 19 '16

With Bash on Ubuntu on Windows on your Desktop, it sounds like they actually wouldn't care anymore :p

7

u/aaronfranke Godot developer, PC & Linux Enthusiast Aug 19 '16

They may, since it's the inverse of Ubuntu on Windows. Ubuntu on Windows brings users to Windows, and Windows on Ubuntu brings users to Ubuntu.

3

u/[deleted] Aug 20 '16

Though, it would bring more users to Microsoft's applications. They'll make more money off of an Office 365 sale than a Windows desktop sale. If they make $50 from Dell for Windows 10 Home and it gets used for 5 years, they only make $10/year from that license. A basic Office365 account is $70/yr, that is $350 for the same period. If 7 people switch to Linux, they'd only need 1 of them sign up for Office to 'break even'. (Yes, in reality, there will be other losses/gains in the equation of a platform switch.)

With Office Mobile apps being given priority on non-Microsoft platforms, SQL Server coming to Linux, them contributing lots of code to the Linux kernel to get it running better in Azure, etc, they're making more of a move to win on the application, services, and cloud side.

PC sales have flattened or are dropping, so there is very little growth potential for desktop OS sales. The likelyhood of them re-capturing users from OS X or Linux is practically zero. Even if they did re-capture half of them, its not going to be much growth compared to what market shrinkage will be over the next 10 years.

They've completely lost out on mobile. Their only growth potential over the next ~5 years in the mobile space will be with applications and services. Even if a Surface Phone is the worlds most amazing phone, you'll still have several years before they'll even hope to get into the double-digit percentage market share.

→ More replies (4)

1

u/[deleted] Aug 20 '16

One theory of mine is that they're going to do that after Windows 7's extended support ends in 2020. I wouldn't expect anything from Windows 7 or earlier to be explicitly released due to its age.

I can see them releasing a 'clean slate' that is based off of Windows 10 with a bunch of the legacy cruft cut out.

I imagine it will be the NT kernel without the Win32 subsystem parts. It would be a big win for the people that care about kernels and would not be terribly harmful to their core business.

16

u/[deleted] Aug 18 '16

Why would anybody want that mess anyways?

47

u/minimim Aug 18 '16 edited Aug 18 '16

It's actually a good kernel design. Seriously lacking on file-systems, to the point of being useless, but still. Also, the networking is old and slow.

It was designed by Dave Cutler, based on his work on VMS. Linux is starting work on an interface that can finally compete with the Windows kernel.

11

u/KarmaAndLies Aug 18 '16

The only criticism of the Windows Kernel that I have is that it doesn't allow granular throttling of process IO or IO prioritisation, both of which Linux supports out of the box. Other than that the design seems fairly solid.

PS - Talking about IO, not CPU throttling which it does support.

3

u/contextfree Aug 18 '16

I thought support for low-priority IO was added in Vista?

4

u/KarmaAndLies Aug 18 '16

They have support for "background" prioritisation. Problem is that bundles CPU and IO, which is problematic for some workflows.

→ More replies (1)

2

u/minimim Aug 18 '16

Is it based on groups of processes? Or just individually?

→ More replies (6)

11

u/Zaphod_B chown -R us ~/.base Aug 18 '16

I've been told different and since MS allows kernel hooks from apps/drivers/third party it is partly the reason why Windows has been so easy to exploit over the years. However, I honestly admit I have not been keeping up on the Windows Kernel development for a long time now.

→ More replies (11)

13

u/localtoast has a hat collection Aug 18 '16

people really underrate NT. it's unfortunate that the discourse with the recently FOSS-friendly MS is to abandon it in favour of Linux.

→ More replies (1)

1

u/shthed Aug 19 '16

To help fix it

1

u/[deleted] Aug 19 '16

That would give the Wine project a huge boost, and it would also give Microsoft a (hopefully) huge disadvantage. Not gonna happen.

→ More replies (3)

14

u/macgruff Aug 18 '16

My thought is that this has more to do with DevOps and giving more flexibility to manage systems (no matter which type of OS) in the background to support architectures that are being also managed/scripted with Docker/Chef/Puppet, etc, etc, et al. This comes on the heels of supporting Linux on Azure; so the fit shows up there.

3

u/ThePegasi Windows/Mac/Networking Charlatan Aug 18 '16 edited Aug 18 '16

I think that's it, they reason that interoperability is their best bet. Powershell/DSC integrating with existing management tools, even DSC itself as a more sane model for server management than group policy, alongside your point about Azure. Done off the back of Powershell in Windows, with Nano Server arguably showing that they still want to compete with Windows itself in more use cases, but then bringing Powershell to the OS people actually use for a big slice of the pie. And through not monetising on that directly the point is presumably to have enough faith in what they do on other platforms to actually get people using it who otherwise wouldn't, and make both services and their own platform offerings more appealing through integration. Hell, even Apple have open sourced Swift.

31

u/[deleted] Aug 19 '16

From one of my coworkers:

Cool! Now I can install software on Linux with the command:

Set-Sudo Get-apt-get Select-Update

Rather than the formerly clumsy:

sudo apt-get update

7

u/semperverus Aug 18 '16

What license?

6

u/n3rdopolis Aug 18 '16

Looks like an MIT license

9

u/jewdai Señor Full-Stack Aug 18 '16

The best license. (If your a commercial organization) bad if you want copy left stuff

1

u/EenAfleidingErbij Aug 19 '16

bad if you want copy left stuff

?

→ More replies (1)

2

u/[deleted] Aug 19 '16

Even tough some source files contain a header that says the file is licensed under Apache... strange.

4

u/[deleted] Aug 20 '16

There is an open issue pointing out the inconsistent headers. It looks like they hope to have it fixed by the next milestone release.

12

u/halr9000 Aug 18 '16

Submit your questions for Jeffrey Snover here, live stream interview tonight: https://www.reddit.com/r/PowerShell/comments/4ydizf/slug/d6mupjp

→ More replies (1)

44

u/Bardo_Pond Aug 18 '16

Kudos to microsoft for doing this.

45

u/Arkiteck Aug 18 '16

We will be extending the PowerShell Remoting Protocol (MS-PSRP) to use OpenSSH as a native transport. Users will have the option to use SSH or WINRM as a transport.

Is possibly an even bigger announcement

(this means there's actual momentum behind https://github.com/PowerShell/Win32-OpenSSH)

0

u/[deleted] Aug 18 '16

[deleted]

7

u/minimim Aug 18 '16 edited Aug 18 '16

I heard it does: https://blogs.office.com/2012/08/13/new-file-format-options-in-the-new-office/

It's a requirement for them to be able to sell this product in my country.

→ More replies (2)

-1

u/VexingRaven Aug 18 '16 edited Aug 19 '16

But they're only doing this for good PR /s

How dare they try to make a better product to get good PR, totally ridiculous

EDIT: I guess nobody else saw all the posts last time this was mentioned about Microsoft is super evil and is just going open source for the PR.

5

u/[deleted] Aug 18 '16

Didn't you know this is part of their 1995 strategy of embrace, extend and extinguish? /s

11

u/EternallyMiffed Aug 18 '16

Make no mistake, they see the stats on places like AWS, where 3/4ths of VMs run Ubuntu. They know the server OS market is not on their side and they need to play catch-up.

→ More replies (2)

28

u/jjasghar Aug 18 '16

I guess I finally have to learn PowerShell

28

u/Swarfega Aug 18 '16

We're all waiting for you in /r/powershell

5

u/Bunderslaw Aug 18 '16

Is there an easy to follow manual for Powershell for someone who's been using batch scripts and Auto Hotkey all this time?

10

u/Mantly Aug 18 '16

Everyone here really likes the book "Learn Powershell in a month of Lunches". There are some technet documentation like this crash course.

http://social.technet.microsoft.com/wiki/contents/articles/183.windows-powershell-survival-guide.aspx

7

u/Subnet-Fishing Jr. Sysadmin Aug 18 '16

If you have access to Lynda, they have a pretty good set of tutorials on it.

Else, it's pretty easy to get started with. Find a project to work on (I'd highly suggest start by porting an old batch script, that's how I started).

You can consult sites like SS64 and TechNet for information on cmdlet usage (think man pages from a *NIX environment).

3

u/zzdarkwingduck Aug 19 '16

As mentioned, the book of lunches is good. I got use to using by just doing regular user stuff in Active Directory. Start off with just getting a list of users from groups, exporting them to a csv file (Get-ADGroupMember). Then started messing around with object manipulation, changing attributes, moving users, groups. I found the info a lot easier to stick when I was actually using it for some work tasks as opposed to just messing around.

Then making something like a simple user creation script is great as they can require certain input's be used, so if you have help desk admins that keep forgetting to put in phone numbers, rooms, or formatting display name, login name correctly. This will get you working using multiple variables.

2

u/showmeyourtitsnow Aug 19 '16

There's this guy over here. But it's a lot of scripting principles applied to powershell and might be too newbie for someone who's already been scripting for a while

-2

u/Hovathegodmc Aug 18 '16

When I can write a script to wipe my own ass... then I will learn it

9

u/JoshuaIan Jack of All Trades Aug 18 '16

I can't script for shit (yet), but I use PS as far more powerful CLI than the standard command prompt, and it serves me quite well. You don't need to be a script aficionado to get a lot of use out of powershell.

15

u/kcbnac Sr. Sysadmin Aug 18 '16

PowerShell + Windows 10 IOT Edition + RasPi3 + robotics + TP = Ass-Wiping Script.

Get to work. ;-D

→ More replies (17)

5

u/tobiasvl Aug 18 '16

Wow, and people can open issues and pull requests and everything.

4

u/theemehest Aug 18 '16

Tried building from source on Arch... Didn't go so well.

Thought I'd comment so others didn't waste as much time as I did.

I get as far as the powershell bin build process (dotnet build --configuration Linux) and there's an error in one of the .cs files.

/home/<user>/build/PowerShell/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs(112,35): error CS0103: The name 'InitializeTypeCatalog' does not exist in the current context

Which is called by: // NEXT: Initialize the CoreCLR type catalog dictionary [OrdinalIgnoreCase] _coreClrTypeCatalog = InitializeTypeCatalog();

3

u/greyfade Developer Aug 19 '16

There's powershell-bin on the AUR.

You may need coreclr-git to compile it, though. It seems to be a hard dependency.

1

u/64mb Linux Admin Aug 18 '16

I've read this entire thread and the MS annoucment and can't find out: So is this going to allow me (Linux Desktop) to run Powershell-y stuff on Windows boxes?

Context: $job are moving to more MS products like Hyper-V and storage spaces from VMware and NetApp. I'd rather not have to RDP into these machines to create VMs/storage etc.

4

u/ramblingcookiemonste Systems Engineer Aug 18 '16

Yes! At the moment you need to install OpenSSH on those Windows boxes, but WinRM client should be coming IIRC. Some notes here

I'm in a related situation: have a bunch of *nix folks on my team, this will make it easier to write scripts/functions/modules that interface with our MS systems.

Cheers!

1

u/64mb Linux Admin Aug 18 '16

Amazing, just what I want to do! Thanks for the reply.

1

u/[deleted] Aug 19 '16

We will be extending the PowerShell Remoting Protocol (MS-PSRP) to use OpenSSH as a native transport. Users will have the option to use SSH or WINRM as a transport.

So you will be able to use SSH as well.

1

u/showmeyourtitsnow Aug 19 '16

Ehh, that sounds like we'll have to wait for the OS to push out a functional SSH implementation to me.

If it can come bundled with the Powershell package on windows, I'd be one happy guy.

2

u/Vance84 Aug 19 '16

There's no reason this won't be a function of all versions of powershell 6,doesn't matter the os since it is now open sourced

10

u/vmeverything Aug 18 '16

I had to actually check if this was real.

Can anyone check hell's temp?

10

u/n3rdopolis Aug 18 '16

Hell's %Temp% :
TotesLegit.exe
csrss.exe
cutepuppies.jpg.exe
notmalware.bat
NotAnInjectableKeylogger.dll
NotARootkit.sys
AEBC45466533FCD4885949393939303936362728494918283030.exe

8

u/VexingRaven Aug 18 '16

csrss.exe

That's one I've not seen in a long time.

5

u/[deleted] Aug 18 '16

The rest were within the last 24 hours I take it?

2

u/[deleted] Aug 18 '16

Current temp: 80 degrees F/ 27 degrees C

0

u/[deleted] Aug 18 '16

[deleted]

2

u/freythman Aug 18 '16

That's probably the closest to freezing that it's ever been.

6

u/[deleted] Aug 18 '16

Has anyone successfully been able to add the Azure modules (or any other module for that matter) to PS for Linux or Mac? On a Mac it doesn't even find a install-module repository, on Linux the installation just plain fails.

That is a HUGE thing for me. If I had Azure PS I'd be a seriously happy camper.

1

u/showmeyourtitsnow Aug 19 '16

I thought the azure modules had specific downloadable requirements to use on windows. I might be wrong. Or I might be just thinking of offfice 365.

2

u/[deleted] Aug 19 '16

I did too - BUT - they showed it working on the youtube video that Microsoft put out.

Kind of annoying, and ironic, that's probably the last thing keeping me on Windows at this point.

5

u/Zaphod_B chown -R us ~/.base Aug 18 '16

So I am going to have to install .NET on every Linux box and Mac that I want to use PoSh on?

3

u/epanting Aug 18 '16

I do believe that read somewhere that some distros will start including it in, Redhat is one of them.

2

u/Zaphod_B chown -R us ~/.base Aug 18 '16

If it is included that would be a lot more useful, but server side I am not too worried about that because as long as it is in a package manager it can very easily be provisioned.

1

u/deadbunny I am not a message bus Aug 19 '16

Including in their repos or including it in the base install?

→ More replies (1)
→ More replies (15)

5

u/vmeverything Aug 18 '16

Waiting for Get-Sudo cmdlet

8

u/[deleted] Aug 18 '16

Correction: Invoke-Sudo.

2

u/Vance84 Aug 19 '16

Well, you have plenty of examples now... Could always build it yourself

5

u/tekwreck89 Sysadmin Aug 18 '16

Anyone get ActiveDirectory module to work with this?

5

u/SteveL_Msft Aug 18 '16

I don't think the AD module has been ported to CoreCLR yet which needs to happen first

2

u/vmeverything Aug 18 '16

IMO, this actually one of the more important parts of having Powershell on Linux and macOS for administration (which is basically Powershell's point)

I imagine that basically by popular demand the Powershell team will bring this functionality to it. That or sense it is open source, someone could add it.

3

u/SteveL_Msft Aug 19 '16

We're working with many partners to get their modules ported to CoreCLR, but it'll take time

2

u/netadminstudent Sysadmin Aug 18 '16

Nope, I can't get it to work. Tried doing an Enter-PSSession into my domain controller but it's not working either.

1

u/[deleted] Aug 18 '16

Keep in mind that this seems to be an alpha release. Lots of things won't be working yet.

→ More replies (7)

2

u/oneinch Aug 19 '16

I use Powershell all the time at work, it's freakin dope.

1

u/Dank_801 Aug 18 '16

Well this just made managing my servers alot easier (I think)

1

u/[deleted] Aug 18 '16 edited Oct 05 '16

This comment has been overwritten by an open source script to protect this user's privacy. It was created to help protect users from doxing, stalking, and harassment.

If you would also like to protect yourself, add the Chrome extension TamperMonkey, or the Firefox extension GreaseMonkey and add this open source script.

Then simply click on your username on Reddit, go to the comments tab, scroll down as far as possibe (hint:use RES), and hit the new OVERWRITE button at the top.

1

u/[deleted] Aug 18 '16

Open source under the MIT license1 (in case anyone was wondering)

1

u/jackmusick Aug 18 '16

Just ran a script I'd been working on to export data out of our CRM and import it into something else. Surprisingly, I was able to just run it on my Mac without any tweaking. Nice... Can't wait for administrative modules for AD, Exchange, etc along with PS Remoting.

1

u/jmnugent Aug 18 '16

Maybe I'm really dumb.. but how do you even start the Powershell program on OSX ?.. I have it correctly installed I think (but I did not reboot). I sent to the folder and tried to invoke it by double-clicking and through Terminal.. but neither works.

1

u/jackmusick Aug 18 '16

Once it's installed, open terminal and just type "powershell". Most terminal tools in Linux/Mac seem to work that way. Python is the same way.

1

u/aaronfranke Godot developer, PC & Linux Enthusiast Aug 18 '16

AWESOME! I'll be excited to see how this develops. Will this be like .NET, where it's technically ported but it's missing many things?

1

u/Rekhyt K-12 Network Administrator (and everything else, too) Aug 18 '16

What perfect timing, I was just trying to integrate vCLI into my Nagios environment, but now I can just use PowerCLI like everyone else!

1

u/[deleted] Aug 19 '16

thanks scott guthrie for changing the culture about ms and open source

1

u/tomzorz Aug 19 '16

May God have Mercy on our Souls

1

u/_UsUrPeR_ VMware Admin - Windows/Linux Aug 19 '16

Why would you do this?

1

u/vriley Nerf Herder Aug 19 '16

Right now it's fairly limited, there are a lot of parts missing, but they should be coming. I see there's a lot of complaints and mockery but I think PowerShell will eventually become a competitive Linux shell next to bash. I'm not saying it's going to replace it, but just as an alternative way of doing things, text in the pipeline while using tiny tools like sed and awk, or having everything as objects and using the .NET functions. Example:

ls -1 | sed -e 's/\..*$//'

vs

gci | foreach {([io.fileinfo]$_.Name).basename}

-4

u/[deleted] Aug 18 '16

Linux Greybeards: REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE

-13

u/pdp10 Daemons worry when the wizard is near. Aug 18 '16

This is Microsoft's attempt to assert more control over the Linux and macOS development ecosystem, the mechanism they use to control platforms.

9

u/codemonk Rogue Admin Aug 18 '16

You forgot to add /s at the end. People might think you were serious.

3

u/punklinux Aug 18 '16

Username relevant. I worked on pdp/11s back in the day.

2

u/halr9000 Aug 18 '16

Not sure about PDP, but Jeffrey Snover, inventor of PowerShell, had his roots in VAX. Source

4

u/picflute Azure Architect Aug 18 '16

No it isn't.

7

u/SimplicityVirtual Aug 18 '16

Agreed. This is great for those sysadmins who prefer Linux and or have a few windows machines they need to manage

ALSO great for managing azure and office 365 via Linux

5

u/[deleted] Aug 18 '16

Also should work the other way round if Microsoft write some useful modules for it; it'll be great for primarily windows shops with a few peripheral Linux machines that currently don't have anyone on staff who can manage them properly.

2

u/SimplicityVirtual Aug 18 '16

I feel like that would be useful wayyyyy down the line....

Hopefully in the future though

0

u/natrapsmai In the cloud Aug 18 '16

Pigs are still flying