- 论坛徽章:
- 0
|
本帖最后由 emperor 于 2010-03-26 21:57 编辑
- '============================================================================
- '§ Script: StartIIS.vbs
- '§ Purpose: This script is used to start IIS after failed to ping an IP
- '§ Author: Emperor (wharton)
- '§ Mail:
- '§ Version: v1.00 (2010.03.26)
- '§ History: initialed on 2010.03.26
- '§ Usage:
- '============================================================================
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Option Explicit
- Dim oShell :Set oShell = CreateObject("WScript.Shell")
- '§ ========= Set Vars =============
- '§ ip=10.0.9.2
- '§ n=1, wtime=10000ms.
- '§ the 3 could be customize.
- Dim intPings:intPings = 1
- Dim intTO :intTO = 10000
- Dim sIP :sIP = "10.0.9.2"
- '§ =========
- Dim sCmd :sCmd = "%comspec% /c ping.exe -n " & intPings & " -w " & intTO & " " & sIP
- Dim objPingOut :Set objPingOut =oShell.Exec(sCmd).StdOut
- If InStr(objPingOut.ReadAll,"TTL=")<>0 Then
- oShell.popup "Pinged OK!",5,"Emperor ",0+64
- Else
- oShell.popup "Ping IP: "&sIP &" Failed, and IIS will be started in 5 minutes",5,"Emperor ",0+64
- Dim iCmd :iCmd = "%comspec% /c iisreset /start"
- Dim sResult:sResult=oShell.Exec(iCmd).StdOut.ReadAll
- MsgBox sResult
- End If
- '§ ========= Release =============
- Set oShell = Nothing
- Set objPingOut = Nothing
- Wscript.Quit
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
复制代码 |
|