Ambientguitar
Programmer
I need help with this its driving me nuts when I run this as a vbscript on the same Pc it pulls out the required data but when I try to connect using Foxpro (version 8)It just keeps throwing errors up, the latest being OLE error code 0 with SWBEMlocator:Access is denied, I have tried several ways to get this to work with no joy.
Code:
ObjWbemlocator=CREATEOBJECT("WbemScripting.SWbemlocator")objWMIService=objWbemlocator.Connectserver(lcip,lcnamespace,lcUserName,lcPassword)
objService.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate
objWMIService.Security_.authenticationLevel=WbemAuthenticationLevelPktPrivacy
colServices = objWMIService.ExecQuery("Select * from Win32_Service")
If colServices.Count > 0 Then
For Each objService in colServices
lorow= ThisForm.Pf1.Pg4.listservices.listitems.add(,allt(objService.Name +"."),allt(objService.State + "."),,)
loRow.subitems(1)= objService.Name
loRow.subitems(2)=objService.State + "."
Next
Else
? objService.Name+"is not installed on PC."
EndIf