Remote XP -> Win98 WMI Connection
- by Logan Young
I've asked this on Technet, but because Win98 is no longer supported, I can't get any decent information, I was hoping there might be some "old school" developers here who might be able to help me.
There is an application that we use a lot at work. This application should run 8am-5pm with as little interruption as possible. Most of the computers where this application runs are using Win98, and we have no way to upgrade them because we can't buy new hardware at the moment.
My computer is running WinXP, so I thought of a way to make sure that this application runs all the time:
The idea I had was to develop a Windows Service that executes a VBScript file that contains a WMI query to get a list of processes from each computer. Each list is then examined, and, depending on whether or not the target application is running, it will either do nothing, or it will execute another VBScript file that contains a WMI query that will be used to start the target application remotely.
I later found a way to do this all with 1 VBScript file (see code below)
My problem is in the remote connection to the target computers. I've installed WMI Core 1.5 on them, but every time I try the remote connection, I get the following:
The remote server is unavailable or does not exist: 'GetObject'
VBScript runtime error 800A01CE
I've done some research, and all I've found is info about DCOM Config and Windows Firewall, but Win98 doesn't have either of these.
' #### Variables and constants ####
Const HIDDEN_WINDOW = 12
Dim T
' #### End Variables and constants ####
Main()
Sub Main()
' #### Get Process information from WMI
Computer = "."
Set WMI = GetObject("winmgmts:" & _
"{ImpersonationLevel=Impersonate}!\\" & Computer & "\root\cimv2")
Set Settings = WMI.ExecQuery("SELECT * FROM Win32_Process")
For Each Process In Settings
' #### If the application is found to be running, set a value to indicate this
If Process.Name = "NOTEPAD.EXE" Then
T = True
End If
Next
' #### T will only have a value if the application is not running. We therefore
' #### evaluate it to determine if it has a value or not. If not, start the application
If Not T Then
'MsgBox("Application not found.")
Set Startup = WMI.Get("Win32_ProcessStartup")
Set Config = Startup.SpawnInstance_
Config.ShowWindow = HIDDEN_WINDOW
Set Process = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = Process.Create(_
"C:\Windows\notepad.exe", null, Config, intProcessID)
End If
End Sub
This uses WMI to get the list of processes from the local computer and, if the target application is running, it'll do nothing, otherwise it'll forcefully start the target application.
The problem is that this works only if I specify the local comuter, if I target another computer, I get the error mentioned above.
Does anyone have any ideas?
Thanks in advance for the help!