捐血一袋救人一命

2011年6月13日 星期一

在遠端電腦上執行命令 2

原理與 在遠端電腦上執行命令 一樣,差別只是改成手動輸入命令

image

<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=big5" />
<title>Execute Command on Remote Computer</title>

<HTA:APPLICATION
     ID="objHTAHelpomatic"
     APPLICATIONNAME="HTAManagementAccount"
     SCROLL="No"
     SINGLEINSTANCE="yes"
     BORDER="thick"
     BORDERSTYLE="raised"
     MAXIMIZEBUTTON="no"
     SHOWINTASKBAR="yes"
     WINDOWSTATE="normal"
>

</head>

<SCRIPT Language="VBScript">
' Setup Window Size
Sub Window_onLoad
    Const Width = 500
    Const Height = 250
    self.ResizeTo width,height
    Self.moveTo (screen.AvailWidth-width)/2,(screen.AvailHeight-height)/2
End Sub

' Defrag Server by Shell
Sub ExecuteCmd
    strComputer = HostName.Value
    strCmd = Typing.Value
    strArg = "cmd.exe /c " + strCmd
    Set objWMIService = GetObject ("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
    errReturn = objWMIService.Create (strArg , Null, Null, intProcessID)
    msgbox("Finish ! " & strComputer )
    set objWMIService = Nothing
End Sub
</SCRIPT>

<body>
請輸入您的指令<br>
<input type="text" name="Typing">
<br>
<br>
您要在哪台電腦上執行指令?<br>
Host Name:<input type="text" name="HostName" size="30"><br>
<input id=runbutton  class="button" type="button" value="Execute" name="run_button"  onClick="ExecuteCmd"><br>
<br>
<ul>
<li>如果您輸入的電腦無法接受管理(例如:防火牆阻擋),將會發生錯誤訊息</li>
</ul>
</body>
</html>

反應:

0 意見: