Can Python be used as an effective script language for Windows Server environment?
Asked Answered
K

5

9

I'm currently working on a strategy for managing multiple Windows Server 2003 to 2008 running SQL Server 2000 - 2008 and I want/need a unified scripting platform for automating tasks. I'm becoming a big fan of Python and as such I'd like to know if Python has been used effectively as a scripting language for administering a various set of Windows Server installations with various SQL Server installations running various jobs. I'm familiar with IronPython which executes against the .Net framework but I'm unsure what syntax version of Python IronPython uses.

EDIT: FYI: I am familiar with Powershell but the more I know about it and it's syntax the more I don't like it.

EDIT: Please, if you can, I'd like to know of your success story of implementing Python as a script solution on Windows.

Kobi answered 15/1, 2011 at 21:6 Comment(2)
I agree about PowerShell (v2) -- it was designed to work with windows, offers very easy access to WMI, .NET, COM, while still being a shell, and comes with a bunch of standard modules. There is also good support for special windows admin tasks such for SharePoint administration. The biggest issue with PowerShell is 1) need admin rights to grant execute permission (not a deal for admins) 2) it still doesn't come with a good shell. Pick up RXVT or similar. Syntax is just that, Syntax. Since it has closures/anonymous functions it's rather easy to wrap "the ugly stuff" if desired.Arnst
I assert the @Chris point of view, although I'm long waited for a scripting language in Windows, PowerShell never attracted me to learn it, just because of it's ugly syntaxArdine
A
9

Notwithstanding my love of Python, I think PowerShell fits more.

From Wikipedia:

Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems.

Ardine answered 15/1, 2011 at 21:20 Comment(2)
I hate to upvote this answer but the more and more I think about it, the less and less I see hope for Python.Kobi
PyWin32 + WMI for COM/WMI from CPython. Or IronPython for native .NET. Python is a legitimate contender for most all admin tasks.Tightlipped
T
4

2 essentials for working on Windows with Python are:

Tim Golden's WMI module:
* http://timgolden.me.uk/python/wmi/cookbook.html

Mark Hammond's PyWin32 package:
* http://docs.activestate.com/activepython/2.4/pywin32/PyWin32.HTML

Tightlipped answered 16/1, 2011 at 0:9 Comment(0)
N
1

I'm not sure about Windows, but Python is used a lot in Linux for administrative scripts and it is way better that a native Windows shell. And I think that Python is quite good for your tasks.

As another option you can take a look at cygwin and bash.

Nightstick answered 15/1, 2011 at 21:11 Comment(0)
E
1

I'm unsure what syntax version of Python IronPython uses.

IronPython's syntax is currently at the same level as Python 2.6.

IronPython integrates very well with .NET and COM and IMO, fits the programmer mindset better than Powershell (I'm not really a fan of the Powershell syntax). However, Powershell is certainly the safer option because it's actively supported by Microsoft.

Exhaustive answered 16/1, 2011 at 11:29 Comment(0)
B
0

I've never done complex Windows system administration in Python myself (not involving SQL server anyway), but i think you could take a look at the winsys project.

Boschbok answered 15/1, 2011 at 21:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.