BETA: WinSys - Python tools for the Windows Administrator

We read MSDN so you don’t have to

Introduction

WinSys is a Python package which wraps aspects of the Windows API to make them more Pythonic and usable by Windows administrators directly from the interpreter or as part of a wider set of applications. It targets recent versions of Python and reasonably recent versions of Windows although it’s not yet up to speed on Vista/W7 & x64.

It is unashamedly platform-specific: no hint of a concession towards more Unix-like operating systems. You can read about the design philosophy and decisions in About WinSys. If you want to see some examples, have a look in the Cookbook.

WinSys is developed as an Open Source project and the project home, together with issues list and browseable source code is at:

If you’re interested in helping with the project let me know and I’ll add you to the project members list.

Example

Copy a registry key from HKLM to HKCU and set its permissions so that only the current user has change access while everyone else gets read. Then dump the details of the new top-level key, including its security.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
from __future__ import with_statement
from winsys import registry, accounts

new_key = registry.copy (r"HKLM\Software\Python", r"HKLM\Software\WinsysPython")

try:
  with new_key.security () as sec:
    sec.break_inheritance (copy_first=False)
    sec.dacl += [
      ("Users", "R", "ALLOW"),
      (accounts.me (), "F", "ALLOW"),
    ]
    sec.dump ()

finally:
  print "***"
  new_key.security ().dump ()

This example makes use of the registry, accounts and security modules. You can see discussion of this example and more in the Cookbook.

Download

  • easy_install:

    FIXME: NOT YET -- easy_install winsys
  • MSI installers & Zipped archives

    Visit http://timgolden.me.uk/python/downloads/winsys/ and then:

    winsys-x.y.z.msi
    

    or:

    unzip winsys-x.y.z.zip
    python setup.py install
  • Subversion trunk:

    svn co http://winsys.googlecode.com/svn/trunk winsys

    and then either add that directory into sys.path (I use a .pth file but whatever works for you) or run setup.py install from there. I don’t do setuptools, so you can’t do setup.py develop unless you tweak the setup.py code.

Table Of Contents

Previous topic

Contents

Next topic

About WinSys

This Page