How to implement ProcessMagnifier.vbs process View
This article mainly introduces how to achieve ProcessMagnifier.vbs process view, the article is very detailed, has a certain reference value, interested friends must read it!
'FileName: ProcessMagnifier.vbs
'Function: Capture information about the running processes in detail
'code by somebody
'QQ: 240460440
'LastModified:2007-11-16 18:25
For learning only
Const HKEY_CURRENT_USER = & H80000001
OReg = GetObject ("winmgmts: {impersonationLevel=impersonate}!\\.\ root\ default:StdRegProv")
StrKeyPath = "Console\% SystemRoot%_system32_cmd.exe"
OReg.CreateKey (HKEY_CURRENT_USER, strKeyPath)
StrValueName1 = "CodePage"
DwValue1 = 936
StrValueName2 = "ScreenBufferSize"
DwValue2 = 98304200
StrValueName3 = "WindowSize"
DwValue3 = 2818173
StrValueName4 = "HistoryNoDup"
DwValue4 = 0
StrValueName5 = "WindowPosition"
DwValue5 = 131068
StrValueName6 = "QuickEdit"
DwValue6 = 2048
OReg.SetDWORDValue (HKEY_CURRENT_USER, strKeyPath, strValueName1, dwValue1)
OReg.SetDWORDValue (HKEY_CURRENT_USER, strKeyPath, strValueName2, dwValue2)
OReg.SetDWORDValue (HKEY_CURRENT_USER, strKeyPath, strValueName3, dwValue3)
OReg.SetDWORDValue (HKEY_CURRENT_USER, strKeyPath, strValueName4, dwValue4)
OReg.SetDWORDValue (HKEY_CURRENT_USER, strKeyPath, strValueName5, dwValue5)
OReg.SetDWORDValue (HKEY_CURRENT_USER, strKeyPath, strValueName6, dwValue6)
Dim objWSH, FinalPath
ObjWSH = WScript.CreateObject ("WScript.Shell")
If (LCase (Right (WScript.Fullname, 11)) = "wscript.exe") Then
FinalPath = "'" & WScript.ScriptFullName & ""
ObjWSH.Run ("cmd.exe / k cscript / / nologo" & Replace (FinalPath, "',"))
WScript.Quit ()
End If
OReg.DeleteKey (HKEY_CURRENT_USER, strKeyPath)
OReg = Nothing
WScript.Echo ()
WScript.Sleep (1000)
WScript.Echo ("A list of brief information about currently running processes is as follows:")
WScript.Echo (vbCrLf)
WScript.Sleep (2000)
Dim MyOBJProcessName
OBJWMIProcess = GetObject ("winmgmts:\\.\ root\ cimv2") .ExecQuery ("Select * From Win32_Process")
WScript.Echo "Name: Priority: PID: Owner:" & vbTab&vbTab& "ExecutablePath:"
WScript.Echo ("-")
For Each OBJProcess In OBJWMIProcess
MyOBJProcessName=OBJProcess.Name& ""
ColProperties = OBJProcess.GetOwner (strNameOfUser, strUserDomain)
WScript.Echo Mid (MyOBJProcessName,1,20) & vbTab& OBJProcess.Priority & vbTab& OBJProcess.ProcessID & vbTab& strNameOfUser & vbTab&vbTab& OBJProcess.ExecutablePath
Next
WScript.Sleep (5000)
WScript.Echo (vbCrLf)
WScript.Echo ("the details of the currently running processes and their loaded modules are as follows:")
WScript.Echo (vbCrLf)
WScript.Sleep (3000)
WScript.Echo vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab& vbTab& "create time file manufacturer"
OBJWMIService = GetObject ("winmgmts: {impersonationLevel=impersonate}!\\.\ root\ cimv2")
OBJRefresher = CreateObject ("WbemScripting.SWbemRefresher")
ColItems = OBJRefresher.AddEnum (OBJWMIService, "Win32_PerfFormattedData_PerfProc_FullImage_Costly") .ObjectSet
OBJRefresher.Refresh ()
For Each OBJItem In colItems
Dim originalPath, ModulePath, WMIPathMode, FileManufacturer, LCaseModulePath
Dim FileExtension, mark, MyLCaseModulePath, FinalModulePath
OriginalPath = OBJItem.Name
ModulePath = Split (originalPath, "/")
WMIPathMode = Replace (ModulePath (1), "\", "\")
OBJWMI = GetObject ("winmgmts:\\.\ root\ CIMV2")
ColManufacturer = OBJWMI.ExecQuery ("SELECT * FROM CIM_DataFile Where Name='" & WMIPathMode & "'")
For Each OBJManufacturer In colManufacturer
FileManufacturer = Trim (OBJManufacturer.Manufacturer)
LCaseModulePath = LCase (Trim (OBJManufacturer.Name))
FileExtension = Right (LCaseModulePath, 3)
MyLCaseModulePath = LCaseModulePath & ""
FSO = CreateObject ("Scripting.FileSystemObject") .GetFile (LCaseModulePath)
If FileExtension = "exe" Then
Mark = "├ -"
FinalModulePath = Mid (MyLCaseModulePath, 1,118)
WScript.Echo ("│")
Else
Mark = "│├─"
FinalModulePath = Mid (MyLCaseModulePath, 1,116)
End If
WScript.Echo mark & FinalModulePath & FSO.DateCreated & vbTab& FileManufacturer
Next
Next
The above is all the contents of the article "how to implement ProcessMagnifier.vbs process View". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!