Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


NetJoinDomain


NetJoinDomain

Author
Message
mpdeglau
mpdeglau
Forum God
Forum God (373 reputation)Forum God (373 reputation)Forum God (373 reputation)Forum God (373 reputation)Forum God (373 reputation)Forum God (373 reputation)Forum God (373 reputation)Forum God (373 reputation)Forum God (373 reputation)

Group: Forum Members
Posts: 1, Visits: 2
I am trying to connect to a domain using the NetJoinDomain API. I can successfull use it to change the workgroup. But when trying to change the domain I get one of two errors, using the same input. I either get "No such domain" or "No mapping for the Unicode character exists in the target multi-byte code page." This is using the same exact inputs, I have hard coded the inputs in for debuging purposes.

What am I doing wrong?

Also for some reason I have to convert the strings into char arrays and insert a null value between each character. Anybody know why?

visual basic code:

Private Declare Function NetJoinDomain _    
Lib "NETAPI32.dll" (ByVal lpServer As String, _
ByVal lpDomain As String, ByVal lpAccountOU As String, _
ByVal lpAccount As String, ByVal lpPassword As String, _
ByVal fJoinOptions As Int32) As Int32Public Sub ChangeDomain()
 
Private Sub ChangeDomain()
Dim d() As Char        
Dim u() As Char
Dim p() As Char
' I replaced what the actual values are, since they were my username and password to the company domain        
'InsertNulls is a function that I created to convert the strings to char arrays and insert null chars between each value
d = insertNulls("myDomain")
u = insertNulls("myUserName")
p = insertNulls("MyPassword")
err = NetJoinDomain("", d, "", u, p, JoinOptions.NETSETUP_DOMAIN_JOIN_IF_JOINED Or JoinOptions.NETSETUP_JOIN_DOMAIN)
End Sub

Edited
3/1/2006 by mpdeglau
rcarco
rcarco
Forum God
Forum God (335 reputation)Forum God (335 reputation)Forum God (335 reputation)Forum God (335 reputation)Forum God (335 reputation)Forum God (335 reputation)Forum God (335 reputation)Forum God (335 reputation)Forum God (335 reputation)

Group: Forum Members
Posts: 1, Visits: 4
I guess it is due to the UNICODE strings required by the netXXX Functions. See here for details:

http://support.microsoft.com/kb/q159498/

I am working on the same function for a friend who uses NT-domains. Give me some time to finish my tests. Besides that, I have a working version for ADSI scripting on win2003 servers.

Rosario

Edited
4/3/2006 by rcarco
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search