تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
اضافة الى دومين
#1
السلام عليكم ورحمة الله وبركاته
استخدم الكود التالى لعمل 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
الرد }}}
تم الشكر بواسطة:
#2
هذه ارقام الاخطاء


إقتباس :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"
الرد }}}
تم الشكر بواسطة:
#3
بارك الله فيك
ولكن كيف اضيفها فى الكود
الرد }}}
تم الشكر بواسطة:
#4
PHP كود :
try
'code
catch ex as exception
if err.number =233 then
msgbox("not mapped error")

تقوم بوضع رقم الخطأ وتظهر الرساله  الخاصه به 
الرد }}}
تم الشكر بواسطة:
#5
اشكركم على مجهوداتكم
كده تمام

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 
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  اريد اضافة حفظ PDF فى مسار على الهارد- مثال الاستاذ عبدالله الدوسري new_programer 0 43 13-04-24, 12:59 PM
آخر رد: new_programer
  اضافة ادوات لفيجوال بيسك خالد20 10 1,983 18-12-23, 07:51 PM
آخر رد: ابراهيم عبدالباقى
  اريد اضافة متغيراخر داخل Listbox1 احتاج تعديل بسيط moh61 0 353 05-08-23, 02:29 PM
آخر رد: moh61
  [سؤال] كيفية اضافة في اكثر من جدول ahmed_king2023 0 366 29-07-23, 12:03 PM
آخر رد: ahmed_king2023
  اقتناص حدث تحديث او حذف او اضافة ملف ابو محمد محمد محمد 6 564 21-04-23, 05:49 PM
آخر رد: ابو محمد محمد محمد
  [سؤال] كيفية اضافة اكثر من ثلاث معاملات الى عامل التشغيل بواسطة If asmarsou 7 1,178 26-02-23, 11:34 PM
آخر رد: asmarsou
  مشكلة فى اضافة عناصر فى الداتا جريد فيو خالد كامل1 14 1,629 16-02-23, 03:10 AM
آخر رد: خالد كامل1
  [VB.NET] اضافة كرستال ريبورت MOHAMMED ALZWI 2 377 20-12-22, 11:19 AM
آخر رد: MOHAMMED ALZWI
  [VB.NET] خطأ عند اضافة فاتورة مشتريات MOHAMMED ALZWI 2 441 10-12-22, 12:25 PM
آخر رد: MOHAMMED ALZWI
  [VB.NET] خطأ عند اضافة فاتورة مشتريات 0 152 10-12-22, 02:30 AM
آخر رد: MOHAMMED ALZWI

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم