I have a vb.net app that searches for specific computers on the network based on criteria from a database and applies modifications if needed. In certain cases it needs to install an msi. I experimented with WMIC using:
/node:RemoteComputerName product call install true,"" , "C:\Test_Install.msi"
This worked great and allowed me to install the msi using my domain admin credentials regardless if a user is logged into the remote computer or not. However, when trying to apply the attached vb.net solution, it will only install if the computer is logged in and only if I pass the credentials of the user that is currently logged in. The error log on the remote computer will show the failure as an MSIINSTALLER issue related to user rights.
I am not opposed to using something other than WMI but absolutely want to automatically initiate the remote install from my vb.net application. I do not want to visit any solution that requires Group Policy deployment or SCCM.
This solution is applied to workstations running XP and WIN 7, both 32 and 64 bit.
Public Class Form1
Private Sub subWMInstall()
Dim strComputer As String = "RemoteComputerName"
Dim ConnectionOptions As New System.Management.ConnectionOptions
ConnectionOptions.Username = Trim("DomainAdminUserName") '(strComputer & "\LocalAdminUserName") for local user account
ConnectionOptions.Password = Trim("DomainAdminUserPassword")
Dim ManagementScope As New System.Management.ManagementScope("\\" & strComputer & "\root\cimv2", ConnectionOptions)
Dim ManagementPath As New System.Management.ManagementPath("Win32_Process")
Dim ManagementOptions As New System.Management.ObjectGetOptions
Dim ManagementClass As New System.Management.ManagementClass(ManagementScope, ManagementPath, ManagementOptions)
Dim OutputParameters As System.Management.ManagementBaseObject
Dim InputParameters As System.Management.ManagementBaseObject
InputParameters = ManagementClass.GetMethodParameters("Create")
InputParameters("CommandLine") = "msiexec /package C:\Test_Install.msi"
OutputParameters = ManagementClass.InvokeMethod("Create", InputParameters, Nothing)
Catch ex As Exception
MsgBox("There was an error connecting to the remote computer." & vbNewLine & ex.Message)