Push deploy msi vb.net


I am struggling to push an MSI to machines on a domain.
I have written a little VB.NET app to list machines in a domain.
I then select a machine from the list, and pass the machine name to the below function.

The code works perfectly when deploying the MSI to the machine I am running exe on, but does not work when I select another machine (another machine on the domain). I suspect this may be a

1) Permissions problem? (I am logged into the machine with admin so not passing anything)
2) The location of the MSI file (I have put it in a SHARE on the network that all machines can see \\Server\...msi)

And yes the firewall is off on the remote machine.

In terms of errors - the code runs all the way through, without any problems, so it looks like it has initiated the MSIExec call successfully on the remote machine?

Any help would be appreciated.



Private Function deployMSI(ByVal MachineName As String) As String


            Dim deployFile As String = txtMSI.Text
            If IO.File.Exists(deployFile) = False Then
                Return "No MSI found"
                Exit Function
            End If

            Dim options As New ConnectionOptions()
            'options.Username = "domain\\username"
            'options.Password = "password"

            Dim path As New ManagementPath("\\" & MachineName & "\root\cimv2:Win32_Process")
            Dim scope As New ManagementScope(path, options)
            scope.Options.Timeout = New TimeSpan(5000) ' 5 secs
                ' Right, connect to the remote machine:
            Catch ex As Exception

                Return "Could not connect to machine..." & ex.Message
                Exit Function

            End Try

            Dim Opt As New ObjectGetOptions()
            Dim ClassInstance As New ManagementClass(scope, path, Opt)
            Dim inParams As ManagementBaseObject = ClassInstance.GetMethodParameters("Create")
            Dim tmpParams As String = ""

            If deployFile.ToString().ToUpper().EndsWith(".MSI") Then
                ' Run MSIExec on the remote computer
                tmpParams = "MSIExec /i " & deployFile & " /qn"
                logIT("Parameters set : " & tmpParams)
                inParams("CommandLine") = (tmpParams)
            End If

                ' Run the Create Process WMI command to invoke either a direct invocation of a exe or a invocation of msiexec...
                Dim outParams As ManagementBaseObject = ClassInstance.InvokeMethod("Create", inParams, Nothing)

            Catch ex As Exception
                Return ex.Message
            End Try

            Return "Successful"

        Catch ex As Exception
            Return ex.Message
        End Try

    End Function

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mohamed OsamaSenior IT ConsultantCommented:
can you please take a look at the below accepted solution which utilizes PSexec tool from sysinternals suite to distribute and deploy an MSI to a list of servers.
this approach is way better than coding your own app from scratch IMHO


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CraigLazarAuthor Commented:
Hi Admin 3K,
Thanks for your feedback.
I am putting a little managament console together that performs some other functions too, ie not just the push deployment.:(.
CraigLazarAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.