Processmagnifier.vbs Process View _vbs

Source: Internet
Author: User
' 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 (wscript.fullname) = "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 ("Current Running Process summary Information list 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 currently running process and its loaded module details tree structure is 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.