
VBScript works on 1 server but failed on others
Hi,
I'm writing a ASP page using VBScript to do a remote-reboot of win2k Server.
However , this script works on one of my win2k server but doesn't works on
others.
I'm getting the following error :
Error Type:
SWbemServices (0x80041001)
Generic failure
/service/RemoteReboot.asp, line 14 (the GetObject line)
Anybody know why ?
Thanks in advanced !
The code is as follow :
<html>
<head>
<title>Reboot Server</title>
<meta name="description" content="Using XML within ASP pages">
<meta name="keywords" content="XML, XML-RPC, ASP, Active Server Pages,
Internet Explorer, NT, Windows">
</head>
<body bgcolor="#FFFFFF" alink="#008000" vlink="#800080" link="#0000FF">
<%
Dim OpSysSet
Dim OpSys
Set OpSysSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}//./root/cimv
2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
for each OpSys in OpSysSet
OpSys.Reboot()
next
%>
</body>
</html>
Regards,
Leonard.