Link to home
Start Free TrialLog in
Avatar of Glen A.
Glen A.Flag for United States of America

asked on

Starting an application on a remote computer using VB. . .

Is there a way to launch an application on a remote computer on your network using VB?

I've got an application that scans my network for machines that haven't had their virus definition files updated.  I had it stopping the Mcshield service, copying the .dat files and starting the service, but that left VShield disabled and I couldn't find anyway to enable it remotely.

So instead I thought I could copy the upgrade setup file to the remote computer and have it launch (on the remote computer) somehow -  But I can't determine if there's a way to do this.  I've searched all over and am pulling my hair out on this.

Thanks for any help . . .
Avatar of andygbc
andygbc

There is a way i could think of.  You can try using winsock to communicate to the network computer. Then from then you can run the program using shell command.
If you copy it to the computer and link it to the startup, when the computer boots it can execute the program.

This may not be appropriate in your case...
I think you have installed McAffe Antivirus on your network computers. I don't know about it but does't matter. I know one program that can launch an executable/ process on a remote computer. Just search for Remote Commander at vbcode.com It's a small VB program and I have successfully tested it on my network containing Win2k and WinNT servers and Win2k workstations. I think it might be of help to you. There are also some Remote management tools like WinVNC/PCAnywhere but you have to install the client and server on machines concerned
Avatar of Glen A.

ASKER

Thanks for the comments so far:

I don't want to copy it into the startup because I want it to run immediately.  The reason I'm running it is because these people aren't logging off their machines, only locking them at night.  That's why nothing in their startup will run.

And yes, all the machines are running McAfee (4.5.1).  They're set to launch the autoupgrade application everytime they log on, but they tend not to log off, just lock their workstations.  Thus the application.  

What I've had the app doing is search the path for the .dat files on the remote computers and provide a report of the date/timestamp of the files so we know what needs updating and what doesn't.  But I decided to implement functionality to update the .dat files from a remote administrative workstation and ran into problems.  It was easy enough to determine that it wouldn't work while the McShield service was running, but when you stop McShield it also stops vshield.  I can't find a way to restart vshield.  It's not a service, and you can't seem to start it from the command line.  You can get it working again from the console or from the VirusScan applet in control panel, but that seems to be it.

McAfee has an executable that stops the services, copies the files and restarts everything fine.  That's what I'd really like to be able to do, just remotely.

Increasing the points to see if that helps . . .  Thanks all.
Avatar of Glen A.

ASKER

Thanks for the comments so far:

I don't want to copy it into the startup because I want it to run immediately.  The reason I'm running it is because these people aren't logging off their machines, only locking them at night.  That's why nothing in their startup will run.

And yes, all the machines are running McAfee (4.5.1).  They're set to launch the autoupgrade application everytime they log on, but they tend not to log off, just lock their workstations.  Thus the application.  

What I've had the app doing is search the path for the .dat files on the remote computers and provide a report of the date/timestamp of the files so we know what needs updating and what doesn't.  But I decided to implement functionality to update the .dat files from a remote administrative workstation and ran into problems.  It was easy enough to determine that it wouldn't work while the McShield service was running, but when you stop McShield it also stops vshield.  I can't find a way to restart vshield.  It's not a service, and you can't seem to start it from the command line.  You can get it working again from the console or from the VirusScan applet in control panel, but that seems to be it.

McAfee has an executable that stops the services, copies the files and restarts everything fine.  That's what I'd really like to be able to do, just remotely.

Increasing the points to see if that helps . . .  Thanks all.
ASKER CERTIFIED SOLUTION
Avatar of abhijitno1
abhijitno1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Glen A.

ASKER

thanks abhijitno1, seems to work on my network at home, I'll try it at work later this morning, let you know how it works there.
Avatar of Glen A.

ASKER

Thanks abhijitno1!

A lot less code than I thought it might be. . .

I modified some of the error handling to suit my purposes, and it seems to be working the way I want.

Good job.
u r most welcome! and thanx for the credit
Avatar of Glen A.

ASKER

uh oh, still having problems.  Works fine from Win2k to Win2k, but it's erroring out on my WinNT workstations:

This line:
set process=getobject("WinMgmts:{impersonationLevel=Impersonate, authenticationLevel=pktPrivacy}\\" & servername & "\root\cimv2:Win32_Process")

gives me an active x can't create object error when connected to a WinNt machine, whether local or remote.

Ideas??

BTW, I'm administrator on ALL our workstations.
What I have provided above is an example of WMI (windows management interface). WMI comes with Windows 2000. If you have a different version of Windows, you must download the appropriate version of WMI at http://msdn.microsoft.com/downloads/sdks/wmi/download.asp.

For more info on WMI click on any of following links
http://www.freevbcode.com/ShowCode.Asp?ID=1731
http://www.microsoft.com/hwdev/driver/WMI/default.asp
Sorry, the download link provided above won't work. the correct link as follows:
Windows Management Instrumentation

If you are installing to a Windows 2000 machine, WMI is already installed and you do not need to download it.
If you are installing to a Windows NT4 machine, you must download and install the latest version of WMI.
Click the link below to direct your browser to the page on the Microsoft Website containing the most up-to-date version of WMI for downloading. Follow the instructions on that page to download and install WMI.

Note: When asked to select the components to install, do not choose the WMI SNMP Provider, as it may conflict with third-party SNMP-based products. Install only the default WMI Core Components.

A reboot is required after installation is complete.

http://www.microsoft.com/downloads/release.asp?ReleaseID=18491
Avatar of Glen A.

ASKER

uh oh, still having problems.  Works fine from Win2k to Win2k, but it's erroring out on my WinNT workstations:

This line:
set process=getobject("WinMgmts:{impersonationLevel=Impersonate, authenticationLevel=pktPrivacy}\\" & servername & "\root\cimv2:Win32_Process")

gives me an active x can't create object error when connected to a WinNt machine, whether local or remote.

Ideas??

BTW, I'm administrator on ALL our workstations.
Avatar of Glen A.

ASKER

Abhijitno1:

Thanks for the WMI information - I didn't even think of it for the NT machines.

I installed WMI on one of the test machines here in our lab, and don't get the active x error, but instead of starting the app, we had a result code other than '0':

result = process.Create(ProgramName, Null, Null, processid)

returns a value of '8' on the test machine.  Is there a place I can obtain a listing of these result codes to further troubleshoot??

Thanks again,

Glen
search for help on winmgmts in MSDN Jan2000 version or later. Sorry I can't help you further on error messages 'cause I don't have latest version of MSDN. But I'll consult with senior collegues and communicate with you as soon as I get any advice.
Avatar of Glen A.

ASKER

Thanks much!
also check out whether NT workstations are on different domain than Win2k pro machines
Avatar of Glen A.

ASKER

yes they're all on the same domain.  the way the app is written the user chooses the domain, which is essential as our Network Admins administer several different domains in our Zone.

We run a two-tier system - users/groups are administered regionally.  Each site has a Tier1 BDC for user authentication and Tier2 servers/Exchange Servers.  In the 2nd Tier domains we have all the workstations administered and each site (we administer 20) has a different domain name.

It works on all our win2k machines, whether locally or remotely (ie:  from a workstation on my site I ran the program on win2k workstations at another site).  Just can't get it to work on any of the NT machines.  After installing the WMI for NT, I get that error value #8.

Thanks again for all the assistance.
Good, now I need to do the same exactly with DELPHI 5.0, any clue - Micosoft people?

thanks
alex