<script language="JScript" runat="server"> try{ var fullPath = "IIS://localhost/W3svc/1", oServer = GetObject(fullPath); Response.write("Restarting web server in progress.
"); Response.write(" Please connect later!"); oServer.Stop(); oServer.Start(); }catch(e){ Response.write("Can't stop web server"); } </script>
Friday, January 22, 2010
ASP JScript for restarting IIS
ASP JScript for Reboot a computer
<script language="JScript" runat="server"> var objWMIService=GetObject( "winmgmts:{(Shutdown)}\\\\.\\root\\cimv2" ); var colItems=objWMIService.ExecQuery( "Select * from Win32_OperatingSystem" ); var items = new Enumerator(colItems); while (!items.atEnd()){ items.item().Win32Shutdown(6); exit; } </script>
Subscribe to:
Posts (Atom)