Remote Installation Program

P

Peter Avalos

My goal is to create a remote installation program to rollout program
installs and updates. We're a small company with about 60 workstations, so
it's not worth the investment in SMS. I have the first part working which
used the directory services namespace to enumerate the workstations in a
specific OU. I then populate a listbox with those values. The system admin
(SA) then selects the workstation(s) to install the software package or
select all. The SA then selects the software package through an open
dialog box. After this the SA would just click an "install software" button
and then a loop would run passing in selected workstations from the listbox
to the following sub:

'--------------------------------------------------------------------------------
Private Sub InstallSoftware(ByVal strComputer As String)
Try
Dim options As New ConnectionOptions
Dim objMgtBase As ManagementBaseObject
'Admin user credentials
options.Username = "username"
options.Password = "password"
Dim scope As New ManagementScope("\\" & strComputer & "\root\cimv2",
options)
scope.Connect()
Dim objSoftware As New ManagementObject(scope, New
ManagementPath("Win32_Product"), Nothing)
objMgtBase = objSoftware.GetMethodParameters("Install")
Me.lstProperties.Items.Add("Installed on " & strComputer & " successfully")
Catch Ex As Exception
Me.lstProperties.Items.Add(Ex.Message)
End Try
End Sub
'--------------------------------------------------------------------------------

And exception comes up with regard to the parameter list ("Specified
argument was out of the range of valid values. Parameter name: path") in the
Dim objSoftware As New ManagementObject(scope, New
ManagementPath("Win32_Product"), Nothing) declaration.
In other words how do I "translate" the following VB Script code that works
into VB.NET code that works?
'--------------------------------------------------------------------------------
Const wbemImpersonationLevelDelegate = 4

Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objConnection = objwbemLocator.ConnectServer _
("WebServer", "root\cimv2", "domain\administrator", _
"password", , "kerberos:WebServer")
objConnection.Security_.ImpersonationLevel = wbemImpersonationLevelDelegate

Set objSoftware = objConnection.Get("Win32_Product")
errReturn = objSoftware.Install("\\fileserver01\scripts\1561_lab.msi",,True)
'--------------------------------------------------------------------------------

Secondly, what's the most efficient way to check if a workstation has the
WMI service running? I have an Exception block that will handle the "RPC
Server is unavailable" exception, but it drastically slows down the
application.

Lastly, is there another way to rollout software using the .NET framework
that doesn't use the WMI API? Is there an "easier" way?

Thanks in advance,
~Peter
 
M

Mattias Sjögren

Peter,
We're a small company with about 60 workstations, so
it's not worth the investment in SMS.

Well there are other deployment products available, for example
Specops Deploy from http://www.specopssoft.com. (Full disclosure: yes
I'm affiliated with them).

And exception comes up with regard to the parameter list ("Specified
argument was out of the range of valid values. Parameter name: path") in the
Dim objSoftware As New ManagementObject(scope, New
ManagementPath("Win32_Product"), Nothing) declaration.
In other words how do I "translate" the following VB Script code that works
into VB.NET code that works?

Try creating a ManagementClass instead of a ManagementObject. Then use
the ManagementClass to iterate through the existing instances or
create a new one.

Secondly, what's the most efficient way to check if a workstation has the
WMI service running?

Not sure, but have you tried using the
System.ServiceProcess.ServiceController class?


Mattias
 
Joined
Jul 16, 2007
Messages
1
Reaction score
0
Hi Peter,

I was wondering, have you managed to complete your application? If so, I would be interested to see how you have done it, would it be possible for you to post your app as a zip file? It would be greatly appreciated.

Kind regards,

Dirk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top