By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,576 Members | 1,840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,576 IT Pros & Developers. It's quick & easy.

WMI - cannot create ActiveX object

P: n/a
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("winmgmts:{impersonationLevel=impersonat e,(RemoteShutdown)}//" &
strComp & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem
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.Exception' occurred in microsoft.visualbasic.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
Share this Question
Share on Google+
3 Replies


P: n/a
In article <OO**************@TK2MSFTNGP11.phx.gbl>, Amadej@NEWS_minet.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

P: n/a
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.org> wrote in message
news:MP************************@msnews.microsoft.c om...
In article <OO**************@TK2MSFTNGP11.phx.gbl>, Amadej@NEWS_minet.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

P: n/a
In article <#J*************@TK2MSFTNGP12.phx.gbl>,
Amadej@_spamsucks_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 discussion thread is closed

Replies have been disabled for this discussion.