A
Amadej Bukorovic
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=impersonate,(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 .
with little success. It stops with this part
of the code:
Sub RebootComputer(ByVal strComp)
Dim objOSSet, objOS
objOSSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(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 .