[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-domain/home/netlogon/domscripts/ -> joindomain.vbs (source)

   1  ' jonction au domaine compatible seven
   2  ' $Id:$
   3  ' 
   4  ' joindomain.vbs /d:domaine  /p:password
   5  ' 
   6  'Option Explicit
   7  Dim oWsh 'Windows Script Host Shell object
   8  Set oWsh = CreateObject("WScript.Shell")
   9  Set oWshEnvironment = oWsh.Environment("Process")
  10  Set oWshnet= Wscript.CreateObject("WScript.Network")
  11  Const JOIN_DOMAIN             = 1
  12  Const ACCT_CREATE             = 2
  13  Const ACCT_DELETE             = 4
  14  Const WIN9X_UPGRADE           = 16
  15  Const DOMAIN_JOIN_IF_JOINED   = 32
  16  Const JOIN_UNSECURE           = 64
  17  Const MACHINE_PASSWORD_PASSED = 128
  18  Const DEFERRED_SPN_SET        = 256
  19  Const INSTALL_INVOCATION      = 262144
  20  
  21  Dim strDomain
  22  Dim strUser
  23  Dim strPassword
  24  
  25  strDomain = WScript.Arguments.Named("d")
  26  strPassword = WScript.Arguments.Named("p")
  27  strUser = strDomain & "\adminse3"
  28  WScript.Echo "Domaine: " & strDomain
  29  WScript.Echo "Utilisateur: " & strUser
  30  'WScript.Echo "Password: " & strPassword
  31  
  32  Set objNetwork = CreateObject("WScript.Network")
  33  strComputer = objNetwork.ComputerName
  34  WScript.Echo "ordinateur: " & strComputer
  35  
  36  Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'")
  37  ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, strPassword, strUser, NULL, JOIN_DOMAIN + ACCT_CREATE)
  38  
  39  Select Case ReturnValue
  40  Case 0 strErrorDescription = "Success"
  41  Case 5 strErrorDescription = "Access is denied"
  42  Case 87 strErrorDescription = "The parameter is incorrect"
  43  Case 110 strErrorDescription = "The system cannot open the specified object"
  44  Case 1219 strErrorDescription = "ERROR_SESSION_CREDENTIAL_CONFLICT"
  45  Case 1323 strErrorDescription = "Unable to update the password"
  46  Case 1326 strErrorDescription = "Logon failure: unknown username or bad password"
  47  Case 1355 strErrorDescription = "The specified domain either does not exist or could not be contacted"
  48  Case 2224 strErrorDescription = "The account already exists"
  49  Case 2691 strErrorDescription = "The machine is already joined to the domain"
  50  Case 2692 strErrorDescription = "The machine is not currently joined to a domain"
  51  End Select
  52  
  53  WScript.Echo "resultat: " & strErrorDescription  & "code : " & ReturnValue
  54  wscript.Quit(ReturnValue mod 255)
  55  
  56  
  57  


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1