Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Strange Issue!


Message #1 by "Rekha" <reksit@h...> on Fri, 21 Feb 2003 00:14:30
Shell "NET SEND ComputerNameOrIPAddress TextMessage"


> Hi All,

> I have a textbox and a command button on a vb form. I want to enter the 
IP 
a> ddress and the IP address I enter is the IP addr of a server machine. 
W> hen I hit the button I want to check all the services that are on the 
m> achine [both stopped as well as running]

> Now, I have come to a point where I can get all the services running on 
my 
l> ocal machine. I have also checked the same creating a .exe file and 
e> xecuting it on my collegue's machine. It will give me all the services 
on 
t> hat machine too. 

> I want an interface which lets me enter the domain name and be able to 
r> etrieve all the services on that particular machine. Is this possible 
in 
v> b? I am using vb6.0

> ---------------------------------------

> Here is the code snippet:

> strComputer = "."

> Set objWMIService = GetObject("winmgmts:" _
 >    & "{impersonationLevel=impersonate}!\\" & strComputer 
& "\root\cimv2")

> Set colListOfServices = objWMIService.ExecQuery _
 >        ("Select * from Win32_Service")

> This code is good enough to get me the services running on my machine. 
If 
I>  change the string strComputer = "knewsom1" instead of ".", then, I get 
a> n error. knewsom1 is the machine name of my co-worker and I want to 
s> upply this and get the services on her machine displayed on my screen 
or 
w> here ever I run the .exe. 

> This is the error I get:

> Run-time error '-2147217405 (80041003)
A> utomation Error

> and points to this line: Set objWMIService = GetObject("winmgmts:" _

> 
-> -------------------------

> Thanks in advance,
R> ekha.


  Return to Index