hta sélection du nom de domaine
J'utilise un petit script qui permet de changer le nom d'un PC et l'ajoute à un domaine X
Selon le script strDomain = "domain.local"
Il y a probablement possibilité de faire en sorte qu'il y ait un choix pour strDomain (en l’occurrence 2 domaines)de sorte que dans l'interface du hta, avec un "checkBox" on puisse choisir un ou l'autre domaine...
Un petit indice pour m'aider a compléter
Merci
La partie de mon script
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| Sub btn_FixIt_OnClick()
If txt_username.Value = "" Then
MsgBox "Entrer un nom d'utilisateur."
txt_username.Focus
Exit Sub
End If
If txt_password.value = "" Then
MsgBox "Entrer le mot de passe."
txt_password.Focus
Exit Sub
End If
strDomain = "DOMAIN.local"
strUser = Trim(txt_username.value)
strPassword = Trim(txt_password.value)
If StrUser = "" Then
Wscript.Quit
End If
If drp_Rename.Value <> "0" Then
For Each objComputer in colComputers
On Error Resume Next
intErrorCode = objComputer.Rename(drp_Rename.Value)
If intErrorCode <> 0 Then
MsgBox "Erreur lors du renommage du PC. Erreur # " & intErrorCode
MsgBox "Le domaine ne peut être contacté."
Else
On Error Resume Next
ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, "ta\" & strUser, NULL, _
JOIN_DOMAIN + ACCT_CREATE)
Select Case ReturnValue
Case 5
MsgBox "Accès refusé"
MsgBox "RetureValue: " & ReturnValue
Case 2224
MsgBox "Compte d'ordi déjà présent"
MsgBox "RetureValue: " & ReturnValue
Case 0
MsgBox "Opération réusie"
MsgBox "RetureValue: " & ReturnValue
Case 2691
MsgBox "Opération réussie"
MsgBox "RetureValue: " & ReturnValue
Case Else
MsgBox "Opération ajout échouée: "& strDomain
MsgBox "RetureValue: " & ReturnValue
End Select
On Error GoTo 0
End If
On Error GoTo 0
td_NEWPCRename.InnerText = "Le nouveau nom du PC est : " & drp_Rename.Value
Next
End If
End Sub |