by Karthikeyan (187 Submissions)
Category: Miscellaneous
Compatability: VB Script
Difficulty: Unknown Difficulty
Originally Published: Thu 29th July 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Get the running process details using Win32_Process WMI Class
'Generated using 'WMI Win32 Class Autoscript Generator' - Developed by Karthikeyan
'Homepage: http://www.geocities.com/marskarthik
On Error Resume Next
Computer = "."
Set OutFile = CreateObject("WScript.Shell")
Const ForAppending = 2
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set TextFile = FileSystem.OpenTextFile ("c:\Win32_Process.txt", ForAppending, True)
TextFile.WriteLine "Script for Win32_Process Class by Karthikeyan"
TextFile.WriteLine
Set WMIService = GetObject("winmgmts:\\" & Computer & "\root\cimv2")
Set Items = WMIService.ExecQuery("Select * from Win32_Process",,48)
For Each SubItems in Items
TextFile.WriteLine "********************************************************************"
TextFile.WriteLine "Caption: " & SubItems.Caption
TextFile.WriteLine "CommandLine: " & SubItems.CommandLine
TextFile.WriteLine "CreationClassName: " & SubItems.CreationClassName
TextFile.WriteLine "CreationDate: " & SubItems.CreationDate
TextFile.WriteLine "CSCreationClassName: " & SubItems.CSCreationClassName
TextFile.WriteLine "CSName: " & SubItems.CSName
TextFile.WriteLine "Description: " & SubItems.Description
TextFile.WriteLine "ExecutablePath: " & SubItems.ExecutablePath
TextFile.WriteLine "ExecutionState: " & SubItems.ExecutionState
TextFile.WriteLine "Handle: " & SubItems.Handle
TextFile.WriteLine "HandleCount: " & SubItems.HandleCount
TextFile.WriteLine "InstallDate: " & SubItems.InstallDate
TextFile.WriteLine "KernelModeTime: " & SubItems.KernelModeTime
TextFile.WriteLine "MaximumWorkingSetSize: " & SubItems.MaximumWorkingSetSize
TextFile.WriteLine "MinimumWorkingSetSize: " & SubItems.MinimumWorkingSetSize
TextFile.WriteLine "Name: " & SubItems.Name
TextFile.WriteLine "OSCreationClassName: " & SubItems.OSCreationClassName
TextFile.WriteLine "OSName: " & SubItems.OSName
TextFile.WriteLine "OtherOperationCount: " & SubItems.OtherOperationCount
TextFile.WriteLine "OtherTransferCount: " & SubItems.OtherTransferCount
TextFile.WriteLine "PageFaults: " & SubItems.PageFaults
TextFile.WriteLine "PageFileUsage: " & SubItems.PageFileUsage
TextFile.WriteLine "ParentProcessId: " & SubItems.ParentProcessId
TextFile.WriteLine "PeakPageFileUsage: " & SubItems.PeakPageFileUsage
TextFile.WriteLine "PeakVirtualSize: " & SubItems.PeakVirtualSize
TextFile.WriteLine "PeakWorkingSetSize: " & SubItems.PeakWorkingSetSize
TextFile.WriteLine "Priority: " & SubItems.Priority
TextFile.WriteLine "PrivatePageCount: " & SubItems.PrivatePageCount
TextFile.WriteLine "ProcessId: " & SubItems.ProcessId
TextFile.WriteLine "QuotaNonPagedPoolUsage: " & SubItems.QuotaNonPagedPoolUsage
TextFile.WriteLine "QuotaPagedPoolUsage: " & SubItems.QuotaPagedPoolUsage
TextFile.WriteLine "QuotaPeakNonPagedPoolUsage: " & SubItems.QuotaPeakNonPagedPoolUsage
TextFile.WriteLine "QuotaPeakPagedPoolUsage: " & SubItems.QuotaPeakPagedPoolUsage
TextFile.WriteLine "ReadOperationCount: " & SubItems.ReadOperationCount
TextFile.WriteLine "ReadTransferCount: " & SubItems.ReadTransferCount
TextFile.WriteLine "SessionId: " & SubItems.SessionId
TextFile.WriteLine "Status: " & SubItems.Status
TextFile.WriteLine "TerminationDate: " & SubItems.TerminationDate
TextFile.WriteLine "ThreadCount: " & SubItems.ThreadCount
TextFile.WriteLine "UserModeTime: " & SubItems.UserModeTime
TextFile.WriteLine "VirtualSize: " & SubItems.VirtualSize
TextFile.WriteLine "WindowsVersion: " & SubItems.WindowsVersion
TextFile.WriteLine "WorkingSetSize: " & SubItems.WorkingSetSize
TextFile.WriteLine "WriteOperationCount: " & SubItems.WriteOperationCount
TextFile.WriteLine "WriteTransferCount: " & SubItems.WriteTransferCount
TextFile.WriteLine "********************************************************************"
Next
TextFile.Close
OutFile.Run "notepad.exe c:\Win32_Process.txt",1,True