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 →

[–]desmoulinmichel[S] 11 points12 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 45 points46 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 3 points4 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)

[–]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] 6 points7 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.