I want to write a program that joins a pc to my domain and then move the PC to a specific OU.
I have read the MSDN article about using the following
Public 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 Long) As Long
then :
RetVal = NetJoinDomain(vbNullChar, _
strDOMAIN, _
strOFCELOC, _
strACCOUNT, _
strPASSWORD, _
NETSETUP_JOIN_DOMAIN Or NETSETUP_DOMAIN_JOIN_IF_JOINED Or NETSETUP_ACCT_CREATE)
I keep getting weird "retval" like 9885984895498.... and so on.
Is there another way I can do this? I know netdom can create a PC account in the OU, but not actually make the pc join the domain.
I have done this before successfully in vb 6.0, so I can't understand why this doesn't work.
Help...
Mootser13
I have read the MSDN article about using the following
Public 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 Long) As Long
then :
RetVal = NetJoinDomain(vbNullChar, _
strDOMAIN, _
strOFCELOC, _
strACCOUNT, _
strPASSWORD, _
NETSETUP_JOIN_DOMAIN Or NETSETUP_DOMAIN_JOIN_IF_JOINED Or NETSETUP_ACCT_CREATE)
I keep getting weird "retval" like 9885984895498.... and so on.
Is there another way I can do this? I know netdom can create a PC account in the OU, but not actually make the pc join the domain.
I have done this before successfully in vb 6.0, so I can't understand why this doesn't work.
Help...
Mootser13