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
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to