プロセス名 (Notepad.exe など) を受け入れる必要がある以下の vbs スクリプトがあり、その名前に一致するすべてのプロセスの関連する詳細を報告します。
私のPC(win 7)では問題なく動作しますが、サーバー(Windows 2000)ではエラーが発生します"Object doesn't support this property or method: objProcess.commandLine"
(30行目)
Windows 2008で実行しているので、Windows 2000と関係があると思います。これを機能させるためにインストール/変更する必要があるものはありますか?
Option Explicit
dim strComputer
dim objWMIService
dim colProcessList
dim objProcess
dim PName
dim PCommandLine
dim PCLSplit
dim input
dim counter
input = InputBox("Please Enter the Process Name, as shown in Task Manager", "Enter Process Name", , 100, 200)
If input = "" Then
WScript.Echo "Canceled"
Else
WScript.Echo "You Entered: " & input
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = '" & input & "'")
counter = 1
For Each objProcess in colProcessList
Wscript.echo counter & ")"
PName = objProcess.Name
PCommandLine = objProcess.CommandLine
PCLSplit = SPLIT(PCommandLine,chr(34))
Wscript.Echo "Application Name: " & PName & VbCrLf &_
"Command Line: " & PCLSplit(1) & VbCrLf &_
"Instance Name: " & PCLSplit(2) & VbCrLf
counter = 1+1
Next
wscript.echo "COMPLETE"
End If
wscript.quit