[python-win32] Active Directory Terminal Services Properties

Daniel Scoggins anywho.scoggins at gmail.com
Wed Feb 8 19:48:42 CET 2012


I'm trying to set the values for TerminalServicesHomeDrive and
TerminalServicesHomeDirectory through Python.

I have this code that works in Powershell but need to get the same
functionality in python. It looks like IADsTSUserEx
<http://msdn.microsoft.com/en-us/library/windows/desktop/aa380823%28v=vs.85%29.aspx>object
owns those permissions but how would I access that object.

#Powershell code that works
<code>
$TSHomeDrive = 'I:'
$TSHomeDirectory = '\\myserver\homehomedrive$\'
$aduser = [adsi] $ldapstr
$aduser.TerminalServicesHomeDirectory =
$TSHomeDirectory+$aduser.samaccountname
$aduser.TerminalServicesHomeDrive = $TSHomeDrive
$aduser.setinfo()
</code>

I've tried these below but get property not found errors:

#Python code that doesn't work
<code>
import active_directory as ad

aduser = ad.find_user()
aduser.TerminalServicesHomeDirectory #fails with attribute error
aduser.com_object.TerminalServicesHomeDirectory #fails with attribute error

#as you would expect, these fail too, with attribute not found errors
aduser.com_object.Put('TerminalServicesHomeDirectory', tdhdir)
aduser.com_object.SetInfo()
</code>

Any thoughts how I could modify those attributes via Python?

Thanks in advance,

Daniel Scoggins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120208/3a1bd1da/attachment.html>


More information about the python-win32 mailing list