Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Unable to update Terminal Services in 2008 R2

$
0
0
Hello all,

I have been working with the AD.au3 plugin and have no problems setting any schema attribute using _AD_ModifyAttribute.

But it seems that with the realease of 2008 R2 the schema objects for Terminal Services have changed. While looking through ADSIEdit I found the attributes msTSProfilePath, msTSHomeDirectory, and msTSHomeDrive. I updated these values but when looking in Active Directory users and computers in the Remote Desktop Services Profile tab of the user I am working with nothing has been updated, and it is not working.

With much research I have found that the Terminal Services information is stored in the userParameters schema attribute as a BLOB. (http://daduke.org/linux/userparameters.html)

The site listed above provides a format to convert the values into a usable form to be placed into the userParameters field, but going about it this way seems to be more work than its worth.

I have found code that has been written to pull these values using the IADsTSUserEx Interface so that they can be easily updated but I am unfamiliar with how the below VB translates over to Autoit. Could someone please help me out?

Imports System.DirectoryServices

Imports TSUSEREXLib

        Dim rootLDAPpath As String = "LDAP://OU=...,DC=com"

        Dim root As DirectoryEntry = New DirectoryEntry(rootLDAPpath)

        Dim searcher As New DirectorySearcher(root)

        Dim adUser As SearchResult



        searcher.Filter() = "(&(objectCategory=user)(samAccountName=*******))"

        adUser = searcher.FindOne



        Dim myUser = New DirectoryEntry(adUser.Path)

        

        ' Get the properties

        Dim tsUser = CType(myUser.NativeObject, IADsTSUserEx)

        MsgBox(tsUser.TerminalServicesProfilePath)

        MsgBox(tsUser.TerminalServicesHomeDrive)

        MsgBox(tsUser.TerminalServicesHomeDirectory)

        

        ' Set the properties

        tsUser.TerminalServicesHomeDirectory = ...
        ...        

        myUser.CommitChanges()

Site reference (http://webactivedirectory.wordpress.com/2011/10/05/active-directory-attributes-for-remote-desktop-services/)

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>