IronPython Release 1 P.0 Production
so here is an Hint example how to start the IronPython CLI (ipy.exe) from powershell and to connect to the Active Directory RootDSE and to list its children.
PS C:\PowerShell> C:\IronPython-1.0\ipy.exe
IronPython 1.0.60816 on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import sys
>>> import clr
>>> import System
>>>
>>> clr.AddReferenceByPartialName("System.DirectoryServices")
>>> root = System.DirectoryServices.DirectoryEntry()
>>> for c in root.Children: print c.Name
...
CN=Builtin
CN=Computers
OU=Domain Controllers
CN=foo
CN=ForeignSecurityPrincipals
CN=Infrastructure
CN=Ken Myer
CN=LostAndFound
OU=MowOtherOU
OU=MowOu
CN=NewUs:::er0003
CN=NewUser0010
CN=NewUser0011
CN=NewUser0012
CN=NTDS Quotas
CN=Program Data
CN=System
CN=Users
>>> exit
'Use Ctrl-Z plus Return to exit'
>>> ^Z
*Edit* Importing NameSpaces, Cool !, but do not throw $$ around ;-)
import System.DirectoryServices
from System.DirectoryServices import *root = DirectoryEntry()
>>> u = root.Children.Add("CN=fooBar","User")
>>> $u.name
Traceback (most recent call last):
SyntaxError: unexpected token bad character '$' (<stdin>, line 1)
>>> u.Name
'CN=fooBar'
Enjoy,
Greetings, /\/\o\/\/
Tags : Monad IronPython PowerShell
October 2005 November 2005 December 2005 January 2006 February 2006 March 2006 April 2006 May 2006 June 2006 July 2006 August 2006 September 2006 October 2006 November 2006 December 2006