Sasquatch69
Programmer
I need to know what Script are Running on my computer. On Windows XP, i can use this little script:
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fspenTextFile("c:\test.log", 8 , True)
'Get parameters (Process ID)
Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1
ID = objArgs(I)
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Select process with parameter ID.
Set colProcesses = objWMIService.ExecQuery( "select * from win32_process where ProcessId = " & ID )
For Each objProcess in colProcesses
' Wscript.Echo "Process " & objProcess.CommandLine & " Process Id " & objProcess.ProcessId
' Écriture dans fichier de sortie
f.writeLine " Process Id: " & objProcess.ProcessId
f.writeline " jobs : " & objProcess.CommandLine
f.writeLine " Date : " & Now()
f.WriteLine "********************************************"
f.WriteLine " "
Next
'Close file.
f.close
But it's does'nt work with windows 2000, "objProcess.CommandLine" is not supported in windows 2000!! Anyone can help me.
Thanks, and sorry for my bad english.
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fspenTextFile("c:\test.log", 8 , True)
'Get parameters (Process ID)
Set objArgs = WScript.Arguments
For I = 0 to objArgs.Count - 1
ID = objArgs(I)
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Select process with parameter ID.
Set colProcesses = objWMIService.ExecQuery( "select * from win32_process where ProcessId = " & ID )
For Each objProcess in colProcesses
' Wscript.Echo "Process " & objProcess.CommandLine & " Process Id " & objProcess.ProcessId
' Écriture dans fichier de sortie
f.writeLine " Process Id: " & objProcess.ProcessId
f.writeline " jobs : " & objProcess.CommandLine
f.writeLine " Date : " & Now()
f.WriteLine "********************************************"
f.WriteLine " "
Next
'Close file.
f.close
But it's does'nt work with windows 2000, "objProcess.CommandLine" is not supported in windows 2000!! Anyone can help me.
Thanks, and sorry for my bad english.