09-10-12, 08:24 PM
اشكركم على مجهوداتكم
كده تمام
كده تمام
PHP كود :
Dim args(4) As String
Dim args2(2) As String
Dim comp As ManagementObject
Dim comps As ManagementObjectCollection
Dim clsComps As New ManagementClass("Win32_ComputerSystem")
comps = clsComps.GetInstances()
For Each comp In comps
'this is used to join the domain
args(0) = "domain name"
args(1) = "password" 'from box 1
args(2) = "user" ' from box 2
'args(3) = strOFCELOC.ToString 'from dropdwn
args(4) = 1 Or 2 'join or create account
Dim retVal As UInt32
retVal = comp.InvokeMethod("JoinDomainOrWorkgroup", args)
retVal = Convert.ToString(retVal)
Select Case (Convert.ToString(retVal))
Case 0
MsgBox("Success joining computer to the domain")
Case 5
MsgBox("Access is denied")
Case 87
MsgBox("The parameter is incorrect")
Case 2691
MsgBox("alredeee")
Case 110
MsgBox("The system cannot open the specified object")
Case 1323
MsgBox("Unable to update the password")
Case 1326
MsgBox("Logon failure: unknown username or bad password")
Case 1355
MsgBox("The specified domain either does not exist or could not be contacted")
Case 1909
MsgBox("User Locked")
Case 2224
MsgBox("The account already exists")
Case 2691
MsgBox("The machine is already joined to the domain")
Case 2692
MsgBox("The machine is not currently joined to a domain")
Case Else
MsgBox(Convert.ToString(retVal))
End Select
Next
