Create Domain With VB


Private Sub Check1_Click()
If Check1.Value = 1 Then
lblDomainName.Visible = True
txtDomainName.Visible = True
End If
If Check1.Value = 0 Then
lblDomainName.Visible = False
txtDomainName.Visible = False
End If
End Sub

Private Sub cmdGenerate_Click()
Dim responce
        Dim i As Integer
If Check1.Value = 1 Then
responce = MsgBox(“Do you want to create ” & txtDomainName.Text & ” DOMAIN user”, vbYesNo)
    If responce = vbYes Then

        For i = Val(txtUserStart.Text) To Val(txtUserEnd.Text)
            Shell “net user ” & txtUserPrefix & Format(i, “0000”) & txtUserPostfix & ” ” & txtPassPrefix & Format(i, “0000”) & txtPassPostfix & ” /ADD ” & txtDomainName.Text & ” /DOMAIN”, vbHide
        Next i
    End If
Else
responce = MsgBox(“Do you want to create LOCAL user”, vbYesNo)
    If responce = vbYes Then

        For i = Val(txtUserStart.Text) To Val(txtUserEnd.Text)
            Shell “net user ” & txtUserPrefix & Format(i, “0000”) & txtUserPostfix & ” ” & txtPassPrefix & Format(i, “0000”) & txtPassPostfix & ” /ADD”, vbHide
        Next i
    End If
End If
End Sub

Private Sub Label11_Click()

End Sub

Private Sub txtUserEnd_Change()
txtPassEnd.Text = txtUserEnd.Text
End Sub

Private Sub txtUserStart_Change()
txtPassStart.Text = txtUserStart.Text
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s