Com+ applications automate username and password

i am trying to create a vb6 application that will update com+ applications username and password. i am using a multiselect listbox to select the application name to update. i have no problem updating one application but problem occur when trying to update more than one. i think my main problem is referencing the application NAME with the application ID    
enterpriseirelandAsked:
Who is Participating?
 
EDDYKTConnect With a Mentor Commented:
For i = 1 To lstApplications.ListCount
    If lstApplications.Selected(i - 1) = True Then
        MsgBox lstApplications.List(i - 1)

If UCase(package.Value("Name")) = UCase(lstApplications.List(i - 1)) Then  'add this
    package.Value("Identity") = "-------"
    package.Value("Password") = "------"


  package.Value("SecurityEnabled") = "Y"  'add this

    packages.SaveChanges  'add this
  end if        'add this
    End If
Next
0
 
EDDYKTCommented:

Public Sub ChangeSecurity(ByVal MTSName As String, ByVal username As String, ByVal Password As String)
    Dim catalog As New MTSAdmin.catalog
    Dim packages As MTSAdmin.CatalogCollection
    Dim package As MTSAdmin.CatalogObject
    
    On Error Resume Next
    Set packages = catalog.GetCollection("Packages")
    packages.Populate
 
    For Each package In packages
        If UCase(package.Value("Name")) = UCase(MTSName) Then
            Exit For
        End If
    Next
    
    If package Is Nothing Then Exit Sub
    package.Value("Identity") = username
    package.Value("Password") = Password
    package.Value("SecurityEnabled") = "Y"
    packages.SaveChanges
    Set package = Nothing
    Set packages = Nothing
    Set catalog = Nothing
End Sub

Open in new window

0
 
enterpriseirelandAuthor Commented:
how would i be able to implement this to work with a listbox with multiple applications selected. i want to be able to update more than one application at a time, as i said i have no problem updating one application for a listbox, the problem occur only with multiple applications
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
EDDYKTCommented:
just pass your applicaton name into the function as MTSName

i assume you list all application on the list box


Dim i As Integer
 
For i = 1 To List1.ListCount
    If List1.Selected(i - 1) Then
        ChangeSecurity List1.List(i - 1), "", ""
    End If
Next

Open in new window

0
 
enterpriseirelandAuthor Commented:
this seem to create new applications with the same names as which is selected in the listbox
0
 
EDDYKTCommented:
i don't see any line on my code to create a new application.

Post your code otherwise it is hard to know what's wrong
0
 
enterpriseirelandAuthor Commented:
Dim catalog As New MTSAdmin.catalog
    Dim packages As MTSAdmin.CatalogCollection
    Dim package As MTSAdmin.CatalogObject
    Dim i As Integer
 
    Set packages = catalog.GetCollection("Packages")
    packages.Populate

For Each package In packages
 
For i = 1 To lstApplications.ListCount
    If lstApplications.Selected(i - 1) = True Then
        MsgBox lstApplications.List(i - 1)
    package.Value("Identity") = "-------"
    package.Value("Password") = "------"
 
       
    End If
Next

    Next
0
 
EDDYKTCommented:
you never compare the package's name with your application name before setting the password and user name
0
 
enterpriseirelandAuthor Commented:
thank very much, it worked perfect
0
All Courses

From novice to tech pro — start learning today.