I'm trying to set the values for TerminalServicesHomeDrive and TerminalServicesHomeDirectory through Python.<br><br>I have this code that works in Powershell but need to get the same functionality in python. It looks like <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa380823%28v=vs.85%29.aspx">IADsTSUserEx </a>object owns those permissions but how would I access that object.<br>
<br>#Powershell code that works<br><code><br>$TSHomeDrive = 'I:'<br>$TSHomeDirectory = '\\myserver\homehomedrive$\'<br>$aduser = [adsi] $ldapstr<br>$aduser.TerminalServicesHomeDirectory = $TSHomeDirectory+$aduser.samaccountname<br>
$aduser.TerminalServicesHomeDrive = $TSHomeDrive<br>$aduser.setinfo()<br></code><br><br>I've tried these below but get property not found errors:<br><br>#Python code that doesn't work<br><code><br>import active_directory as ad<br>
<br>aduser = ad.find_user()<br>aduser.TerminalServicesHomeDirectory #fails with attribute error<br>aduser.com_object.TerminalServicesHomeDirectory #fails with attribute error<br><br>#as you would expect, these fail too, with attribute not found errors<br>
aduser.com_object.Put('TerminalServicesHomeDirectory', tdhdir)<br>aduser.com_object.SetInfo()<br></code><br>
<br>Any thoughts how I could modify those attributes via Python?<br><br>Thanks in advance,<br><br>Daniel Scoggins<br>