473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

cannot create ActiveX object calling WMI in VB.Net

Hello guys,

I have code that works fine in Windows Forms application:

Dim objWMIService As Object
objWMIService = GetObject("winmgmts: " _
& "{impersonationLevel=impersonate}!\\" & lcServerIP & "\root\cimv2")


Same code crashes when I call it from Windows Service application doing the same thing. I run service under both Local System and my user name.

lcServerIP - is remote server name.

Any ideas anybody?
Dec 5 '07 #1
2 4007
Plater
7,872 Expert 4TB
I was just wondering, why are you creating it with GetObject, and not using the .net object ManagementObject ?
Dec 5 '07 #2
ManagementObject was causing me grief when I tried to connect to the server with firewall. Big time.

Thanks to everyone paying attention, I found the solution: services are running under their own security authentication. So, explicitly specify user name and password for remote machines and everything goes fine, except local machine will refuse it.

Dim objSWbemLocator, objSWbemServices As Object
objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")

objSWbemServices = objSWbemLocator.ConnectServer _
("remoteServer", "root\cimv2", "UID", "PWD")
colItems = objSWbemServices.ExecQuery("Select * from Win32_OperatingSystem")

the rest is the same.


Regards,
Alexander
Dec 6 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Cathy Thomas | last post by:
Has anyone run into this problem? An ASP page creates a command object that calls a stored procedure. This was working one day; next, it stopped. I am not in control of the various patches that get...
3
by: Pat | last post by:
A97, WinXP Hello, I am looking for a way to create a task (in the windows task scheduler) from an Access MDB using VBA. I found this great DLL: ...
1
by: Craig | last post by:
I am having problems getting an ActiveX DLL written in VB6 to call a method in a C# class library component. My C# DLL is called CSharpProject.dll and contains a public class called CSharpClass....
1
by: Zhou Jingxiong | last post by:
Hi I am using third party COM component which come with an installation program (.exe file included). The program will be register to registry automatically upon installation. There is no...
2
by: W. Broersen | last post by:
I want to use Outlook.Application, but I donot get further. Dim objOLApp As Outlook.Application objOLApp = CreateObject("Outlook.Application") Everytime I'll get the following error: Cannot...
4
by: qualitynice | last post by:
HELP :-)... I'm creating an embedded activex object in an asp.net page using the HtmlGenericControl class. I'm doing this because when I tried to embed it directly in the aspx page, it stopped...
4
by: Patrick | last post by:
I have a middle tier object that generates Excel spreadsheet here is the code moExcel = CreateObject("Excel.Application") moWorkBook = moExcel.Workbooks.Add moSheet =...
1
by: Rocio | last post by:
I have a windows app. written in VB6, now we need to expose some of its classes through a web service. I am only able to expose the classes using late binding becasue that's the way the original...
0
by: rrotstein | last post by:
I took a simple VB 6.0 .dll project, consisting of a single form, and used Vistual Studio 2005 to upgrade it and create a new solution. I then registered it and created a type library using...
9
by: Anyhoo | last post by:
Hello: We have an ActiveX DLL that we created in C++. We are calling it from vbscript at the top of an .asp page using the "CreateObject" command. The asp page interacts with the ActiveX DLL in...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.