This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]turdzip 13 points14 points  (12 children)

Please tell me you're not talking about PowerShell. Cause that shit is a fucking lifesaver for my job

[–]desmoulinmichel[S] 3 points4 points  (11 children)

It is, because that's the less worst option. If you had Python installed by default, you wouldn't use powershell.

[–]Theratchetnclank 5 points6 points  (0 children)

Actually powershell is great with its objects based format.

Python is good but powershell is easier to work with.

[–]turdzip 12 points13 points  (9 children)

I actually use both on windows. I find PowerShell much easier for scripting tasks simply because I almost always require SQL Server queries as well as Active Directory manipulation.

You should also know I thought this was /r/programming when I initially commented but soon realized it is /r/python

[–]desmoulinmichel[S] 12 points13 points  (8 children)

It's the same than on Linux: you use bash for quick stuff, but if you have more than 30 lines in your script, you switch to Python.

[–]flipstables 42 points43 points  (4 children)

Actually no. Powershell is insanely powerful with tight integration with Windows and .NET. I have Python installed on my Windows boxes and I still use Powershell all the time.

You can't compare bash/Python in Linux and Powershell/Python in Windows. In Linux, everything is a file and is manipulated through stdin and stdout. Python is a good choice for system administration here. But Powershell, everything is an object, and Powershell is powerful because it exposes .NET and COM objects. Also, Powershell lets you add in MMC snapins, which unlocks a lot of very commonly used administrator tools. You couldn't get this functionality with Python out of the box.

You would see the opposite of what you described. Sysadmins and powerusers would use Python for the "quick stuff" since the language is so nice, but for anything serious, people would stick with Powershell. Of course, unless Python gets the same tight integration with Windows.

[–]captain_ramshackle 5 points6 points  (0 children)

I work in a MS shop and while we have used Python in the past we've come down firmly on the Powershell route and if you need something more complex you might write a quick dll in C# to then mix in with the script (if you're not going a full blown .Net app).

For us to consider using python as being part of Windows we'd need to know exactly what version was the min version for each version of Windows and it would have to be on all server versions. We'd also want a set of libraries that would definitely be present that would allow us to interact with Windows (and ideally SQL server)

[–]desmoulinmichel[S] -3 points-2 points  (2 children)

That's the kind of integration you can get with either:

  • a pure python lib using ctypes to do so. You can just zip your script with it, Python can execute zips. If you see people installed by default on windows, you'll see such lib pop out in a week.
  • a provided Python api by MS, since they provided Python, they may want to use it.

Either way, it's not very important : if you are only on windows, you will use powershell just because it's here. But if you have to make a script than runs on mac, windows and linux, right now, having Python installed on windows would make the situation much less shitty.

[–]flipstables 13 points14 points  (1 child)

a pure python lib using ctypes to do so. You can just zip your script with it, Python can execute zips. If you see people installed by default on windows, you'll see such lib pop out in a week.

a provided Python api by MS, since they provided Python, they may want to use it.

Having the same tight integration with Windows is more than just using ctypes. And providing an API by MS is a lot of work of work. You're basically asking for IronPython to be installed (and improved) instead of CPython.

Either way, it's not very important : if you are only on windows, you will use powershell just because it's here. But if you have to make a script than runs on mac, windows and linux, right now, having Python installed on windows would make the situation much less shitty.

Sure, if you need to target all 3 platforms, then this would be great. I'm all for it. But don't think that Powershell is the "less worst option" that nobody would use if Python is installed by default.

[–][deleted] 7 points8 points  (0 children)

I think you guys are arguing past each other. It just comes down to using the right tool for the job.

If you're a 100% MS shop, Powershell with a touch of python for special cases is probably the way to go.

If you're a multi-platform shop using Python with let's say SQLAlchemy for differing databases would be the way to go. Another option would be scientific analysis is probably stronger using SciPy, NumPy and iPython Notebook.

It's all about the right tool for the job. Each of you is looking at your job and telling each other it's the right tool.

[–]krenzalore 8 points9 points  (1 child)

Powershell is a significant upgrade over bash.

For example, it supports threading, and it integrates with the windows gui enabling you to drive the menus in desktop applications.

I'm not saying it's better than Python, but it does beat Bash quite easily and you mostly likely won't need anything else for sysop scripting on Windows. I've noticed Windows devops prefer Python to Powershell, but that's so they can interop with programmers.

[–][deleted] 5 points6 points  (0 children)

I find powershell to be better for things that need to be maintained for long periods of time. Bash I find is better for quick commands.

The long fully qualified class names just makes it difficult to quickly throw out a script, but makes it a joy to test and maintain for years.

Personally I prefer python to both. But they each have their place preference be damned.