Python可以用作Windows服务器环境的有效脚本语言吗?

2024-04-27 19:32:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在研究一种管理多个运行SQL Server 2000-2008的Windows Server 2003到2008的策略,我需要一个用于自动化任务的统一脚本平台。我正在成为Python的忠实粉丝,因此我想知道Python是否已经被有效地用作脚本语言,用于管理运行各种作业的各种SQL Server安装的各种Windows服务器安装。 我熟悉针对.Net框架执行的IronPython,但我不确定IronPython使用什么语法版本。

编辑:仅供参考:我对Powershell很熟悉,但我对它了解得越多,它的语法就越不喜欢它。

编辑:如果可以的话,我想知道你在Windows上实现Python脚本解决方案的成功案例。


Tags: 服务器脚本框架编辑sqlnetserverwindows
3条回答

使用Python处理Windows的两个基本要素是:

Tim Golden的WMI模块:
*http://timgolden.me.uk/python/wmi/cookbook.html

Mark Hammond的PyWin32软件包:
*http://docs.activestate.com/activepython/2.4/pywin32/PyWin32.HTML

尽管我喜欢Python,但我认为PowerShell更合适。

来自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.

我对Windows不太确定,但是Python在Linux中经常用于管理脚本,而且它比原生Windows shell要好得多。我认为Python非常适合您的任务。

作为另一个选择,你可以看看cygwin和bash。

相关问题 更多 >