Query and Set Terminal Services profile path in VB.Net

C

Chris H

I'm trying to query the terminal servies profile path using VB.Net 2005
for a user in our domain. I've successfully retrieved the user's
details, however, this particular attribute eludes me.

In Visual Basic I used the following method:

Set objUser = GetObject("LDAP://max.com/OU=username,...")
debug.print objUser.terminalservicesprofilepath

However, I'm trying to avoid the use of GetObject since I don't believe
it will be thread safe if I do so. The code I'm using so far in VB.NET
is:

Dim entry As DirectoryServices.DirectoryEntry
Dim searcher As System.DirectoryServices.DirectorySearcher
Dim result As System.DirectoryServices.SearchResult

entry = New
DirectoryServices.DirectoryEntry("LDAP://max.com/OU=username,..")

searcher = New
System.DirectoryServices.DirectorySearcher(entry)

searcher.PropertiesToLoad.Add("samAccountName")

This works to retrieve values however, trying to retrieve the terminal
services path seems to be impossible. Anyone have anyone suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top