Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > ADSI General > Question Active...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 5355 of 5422
Post > Topic >>

Question Active Directory Access to "TerminalServicesProfilePath"

by =?Utf-8?B?TWFudWVsIE1vc2Vy?= <Manuel Moser@[EMAIL PROTECTED] Aug 7, 2008 at 01:34 AM

Hello guys!

I am trying to access to User-Properties from my C#-Programm.
It is no problem to set "Sirname", "Mail", "scriptPath", "HomeDirectory"
and 
so on.

But I have problems with the "TerminalServices"-Attributes like 
"TerminalServicesProfilePath".

First time I tried it like that:

DirectoryEntry entry = new 
DirectoryEntry("LDAP://OU=Users,DC=COMPANY,DC=COM");DirectoryEntries
entries 
= entry.Children;
entry = entries.Add("CN=" + textBox_name.Text, "user");

entry.Properties["TerminalServicesProfilePath"].Value = 
textBox_TerminalServiceProfil.Text;

But I read that I can't access to this attribute in that way.

Then I heard about ActiveDs.dll and TSUSEREXLib.dll. I got these 2
dll-Files 
and set a reference to them.
Now my code looks like that:


DirectoryEntry entry1 = new DirectoryEntry("path to user"); 
ActiveDs.IADsUser iADsUser1 = (ActiveDs.IADsUser)entry1.NativeObject; 
TSUSEREXLib.IADsTSUserEx m_TsUser = (TSUSEREXLib.IADsTSUserEx)iADsUser1; 
m_TsUser.TerminalServicesProfilePath = path1; 
entry1.CommitChanges(); 

But now my programm throws an exception:

System.InvalidCastException: Das COM-Objekt des Typs "System.__ComObject" 
kann nicht in den Schnittstellentyp "TSUSEREXLib.IADsTSUserEx" umgewandelt

werden. Dieser Vorgang konnte nicht durchgeführt werden, da der 
QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der
IID 
"{C4930E79-2989-4462-8A60-2FCF2F2955EF}" aufgrund des folgenden Fehlers
nicht 
durchgeführt werden konnte: Schnittstelle nicht unterstützt (Ausnahme
von 
HRESULT: 0x80004002 (E_NOINTERFACE)).

in english:
System.InvalidCastException: The COM-Object of the type
"System.__ComObject" 
cannot be casted to the interface type "TSUSEREXLib.IADsTSUserEx". This 
process could not be performed because the QueryInterface-call to the 
COM-component for the inteface with the IID 
"{C4930E79-2989-4462-8A60-2FCF2F2955EF}" could not be performed because of

the following error: interface not provided (Exception HRESULT: 0x80004002

(E_NOINTERFACE)).

I also tried it only with:
TSUSEREXLib.IADsTSUserEx m_TsUser = 
(TSUSEREXLib.IADsTSUserEx)entry1.NativeObject;

But the Programm got the same error again.
 
I am working with Windows 2k and the Visual Studio 2005.

I hope you can help me.

Greetings
Manuel
 




 5 Posts in Topic:
Question Active Directory Access to "TerminalServicesProfilePath
=?Utf-8?B?TWFudWVsIE1vc2V  2008-08-07 01:34:01 
Re: Question Active Directory Access to "TerminalServicesProfile
"Joe Kaplan" &l  2008-08-07 09:25:05 
Re: Question Active Directory Access to "TerminalServicesProfile
=?Utf-8?B?TWFudWVsIE1vc2V  2008-08-07 22:31:00 
Re: Question Active Directory Access to "TerminalServicesProfile
=?Utf-8?B?TWFudWVsIE1vc2V  2008-08-07 22:59:01 
Re: Question Active Directory Access to "TerminalServicesProfile
"Joe Kaplan" &l  2008-08-08 08:25:36 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 5:07:00 CST 2008.