473,805 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WMI - cannot create ActiveX object

I've been trying to write a simple program to remotely reboot a computer but
with little success. It stops with this part
of the code:

Sub RebootComputer( ByVal strComp)
Dim objOSSet, objOS
objOSSet =
GetObject("winm gmts:{impersona tionLevel=imper sonate,(RemoteS hutdown)}//" &
strComp & "/root/cimv2").ExecQue ry("select * from Win32_Operating System
where Primary=true")
For Each objOS In objOSSet
objOS.Reboot()
Next
End Sub

When I run the code, the application crashes and the error is: An unhandled
exception of type 'System.Excepti on' occurred in microsoft.visua lbasic.dll
Additional information: Cannot create ActiveX component.

This happens no matter what I try to do, be it reboot a computer remotely or
start a new process on a remote computer.

Can someone tell me what could be the problem and what I am doing wrong :)
Oh, I'm using Visual Studio .NET v2003 .
Nov 20 '05 #1
3 6744
In article <OO************ **@TK2MSFTNGP11 .phx.gbl>, Amadej@NEWS_min et.si
says...
I've been trying to write a simple program to remotely reboot a computer but
with little success.


Lot's of hits here:

http://groups.google.com/groups?q=do...+reboot+remote

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #2
Thanks. I've already tried that.
My point was that all the code I found fails with the same error ("Cannot
create ActiveX component").

Does the .NET framework have to be installed on the remote system which I
want to access using WMI?
Or am I missing something else (apart from reading that there are problems
in the WMI classes implementation) .
"Patrick Steele [MVP]" <pa*****@mvps.o rg> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
In article <OO************ **@TK2MSFTNGP11 .phx.gbl>, Amadej@NEWS_min et.si
says...
I've been trying to write a simple program to remotely reboot a computer but with little success.


Lot's of hits here:

http://groups.google.com/groups?q=do...+reboot+remote

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele

Nov 20 '05 #3
In article <#J************ *@TK2MSFTNGP12. phx.gbl>,
Amadej@_spamsuc ks_minet.si says...
Thanks. I've already tried that.
My point was that all the code I found fails with the same error ("Cannot
create ActiveX component").

Does the .NET framework have to be installed on the remote system which I
want to access using WMI?
Or am I missing something else (apart from reading that there are problems
in the WMI classes implementation) .


I'm not up on WMI, so it could be a platform issue. What OS are you
running the app on and what are the types of OS's you're trying to
remotely reboot?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2675
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 applied to this machine, so yes, it is possible that new MS code was applied to it. The error is a 429, 'Cannot create ActiveX Component'. I can get the code to work if I turn on the IE option 'Initialize and script ActiveX controls not marked...
3
5221
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: http://www.mtogden.com/~tom/files/SchedulingAgentVB6.zip However, when I test it with a basic example: Dim jb as CJob
1
7689
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 problem calling the COM component from VB.net Module from DOS Command Prompt : Imports System
2
5586
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 create ActiveX component I set in the reference the COM from Outlook... Does someone know how to solve this problem????
6
9356
by: Steve Richter | last post by:
I am getting error in a vbscript: ActiveX component cant create object: Excel.Application. The vbscript code is: Dim objExcel Set objExcel = CreateObject("Excel.Application") I am pretty sure it is a permission issue because the script works when I point the browser directly at the .htm file on the c: drive: c:\inetpub\wwwroot\DemoSite\VbScriptTest.htm
4
3246
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 = moWorkBook.Worksheets(liSheetNum) moSheet.Delete() moSheet = moWorkBook.Worksheets(liSheetNum) moSheet.Delete()
1
15667
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 VB6 was written. I ahve already exposed some of the original classes, and they work fine. Now, I added a new ActiveX component to the windows app (in vb6). I am able to call it by late binding from within the vb6 app. itself, and from a dummy vbs...
1
14773
by: drk.kumar | last post by:
I have an implementation issue with WMI scripts to check the user machine processor. The implementation is working fine in the local machine (Windows XP operating system). It is throwing script error in the DEV environment (Application deployed in the linux box). Following is the javascript code to detect the processor, function detectProcessor() { var locator = new ActiveXObject
0
1342
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 regasm. But when I run a little test program to do a CreateObject() on that object, specifying the System.Runtime.InteropServices.ProgID created by the 2005 upgrade wizard, an unhandled System.Exception is generated ("Cannot create ActiveX...
9
18195
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 various ways on the page. This has been working fine under Windows XP, but now we have a client who is wanting to move the client-side asp web page to the Windows 2003 server. They want for non-administrator users to be able to access their server over...
0
9716
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10607
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10359
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.