Hi All,
Hope you are all doing well, i have been battlign with an issue for a while now, when i update all other attributes in ad using this code it works , however for the terminal services profile (which is built into AD ) with an array, i get a an erro as such
Unspecified error
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Unspecified error
my code is like the following:
Dim LDAPUser = "domain\Administrator"
Dim LDAPPass = "MyPassword"
Dim CurrentComputerADLocation = "CN=User\, Test,OU=Users,DC=domain,DC=net"
Dim User As New System.DirectoryServices.DirectoryEntry("" + CurrentComputerADLocation + "", LDAPUser, LDAPPass)
Dim ProDir = "\\\\FILESERVERTEST\\UserData$\\TestUser1"
Dim RDProfile = "\\\\FILESERVERTEST2\\RD_tsprofiles$\\"
Try
User.InvokeSet("TerminalServicesProfilePath", "" + RDProfile + "")
User.InvokeSet("TerminalServicesHomeDirectory", "" + ProDir + "")
User.InvokeSet("TerminalServicesHomeDrive", "H:")
User.CommitChanges()
User.Close()
LabelStatus.ForeColor = System.Drawing.ColorTranslator.FromHtml("#256fe8")
LabelStatus.Text = "User Account has been successfully labelled"
Catch InvOpEx As InvalidOperationException
Console.WriteLine(InvOpEx.Message)
LabelStatus.Text = InvOpEx.Message
End Try
i have even tried an invokeSet statement like this but still get same error
<br />
User.InvokeSet("TerminalServicesProfilePath", new object[] {RDProfile})<br />
User.InvokeSet("TerminalServicesHomeDirectory", new object[] {ProDir})<br />
User.InvokeSet("TerminalServicesHomeDrive", new object[] {"H:"})<br />
can anyone show me where i am going wrong please
any and all help is always appreciated
Thanks
Robert
What I have tried:
i have even tried an invokeSet statement like this but still get same error
User.InvokeSet("TerminalServicesProfilePath", new object[] {RDProfile})
User.InvokeSet("TerminalServicesHomeDirectory", new object[] {ProDir})
User.InvokeSet("TerminalServicesHomeDrive", new object[] {"H:"})
<pre>