منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
اضافة الى دومين - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : اضافة الى دومين (/showthread.php?tid=5422)



اضافة الى دومين - barakascap - 08-10-12

السلام عليكم ورحمة الله وبركاته
استخدم الكود التالى لعمل join لجهاز ويعمل جيد
ولكن اريد ان اضيف رساله تعود بخطا اذا حدث او انه تم التنفيذ
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
                Dim pss 
As String TextBox12.Text

                
If pss "" Then
                    MsgBox
("Enter Passowrd")
                Else
                
End If
                
args(0) = "domain name heare"
                
args(1) = pss
                args
(2) = "user"
                ''
args(3) = "Specify OU Here (ou=test,dc=domain,dc=com)"
                
args(4) = "3"

                
comp.InvokeMethod("JoinDomainOrWorkgroup"args



اضافة الى دومين - amgadtamer - 08-10-12

هذه ارقام الاخطاء


إقتباس :0 = "Success joining computer to the domain!"

5 = "Access is denied"

87 = "The parameter is incorrect"

110 = "The system cannot open the specified object"

1323 = "Unable to update the password"

1326 = "Logon failure: unknown username or bad password"

1355 = "The specified domain either does not exist or could not be contacted"

2224 = "The account already exists"

2691 = "The machine is already joined to the domain"

2692 = "The machine is not currently joined to a domain"



اضافة الى دومين - barakascap - 09-10-12

بارك الله فيك
ولكن كيف اضيفها فى الكود


اضافة الى دومين - amgadtamer - 09-10-12

PHP كود :
try
'code
catch ex as exception
if err.number =233 then
msgbox("not mapped error")

تقوم بوضع رقم الخطأ وتظهر الرساله  الخاصه به 



اضافة الى دومين - barakascap - 09-10-12

اشكركم على مجهوداتكم
كده تمام

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