Platinum Partner

Display Process In Ruby

// description of your code here


require 'win32ole'

writeFile = File.open("./process.txt","w")
wmi = WIN32OLE.connect("winmgmts://")
processes = wmi.ExecQuery("select * from win32_process")

for process in processes do    
	for property in process.Properties_ do        
		writeFile.puts property.Name    
	end    
	break
end
writeFile.puts
writeFile.puts "***********************************************************************************"
writeFile.puts
for process in processes do
	writeFile.puts "Caption: #{process.Caption}"
	writeFile.puts "CommandLine: #{process.CommandLine}"
	writeFile.puts "CreationClassName: #{process.CreationClassName}"
	writeFile.puts "CreationDate: #{process.CreationDate}"
	writeFile.puts "CSCreationClassName: #{process.CSCreationClassName}"
	writeFile.puts "CSName: #{process.CSName}"
	writeFile.puts "Description: #{process.Description}"
	writeFile.puts "ExecutablePath: #{process.ExecutablePath}"
	writeFile.puts "ExecutionState: #{process.ExecutionState}"
	writeFile.puts "Handle: #{process.Handle}"
	writeFile.puts "HandleCount: #{process.HandleCount}"
	writeFile.puts "InstallDate: #{process.InstallDate}"
	writeFile.puts "KernelModeTime: #{process.KernelModeTime}"
	writeFile.puts "MaximumWorkingSetSize: #{process.MaximumWorkingSetSize}"
	writeFile.puts "MinimumWorkingSetSize: #{process.MinimumWorkingSetSize}"
	writeFile.puts "Name: #{process.Name}"
	writeFile.puts "OSCreationClassName: #{process.OSCreationClassName}"
	writeFile.puts "OsName: #{process.OSName}"
	writeFile.puts "OtherOperationCount: #{process.OtherOperationCount}"
	writeFile.puts "OtherTransferCount: #{process.OtherTransferCount}"
	writeFile.puts "PageFaults: #{process.PageFaults}"
	writeFile.puts "PageFileUsage: #{process.PageFileUsage}"
	writeFile.puts "ParentProcessId: #{process.ParentProcessId}"
	writeFile.puts "PeakPageFileUsage: #{process.PeakPageFileUsage}"
	writeFile.puts "PeakVirtualSize: #{process.PeakVirtualSize}"
	writeFile.puts "PeakWorkingSetSize: #{process.PeakWorkingSetSize}"
	writeFile.puts "Priority: #{process.Priority}"
	writeFile.puts "PrivatePageCount: #{process.PrivatePageCount}"
	writeFile.puts "ProcessId: #{process.ProcessId}"
	writeFile.puts "QuotaNonPagedPoolUsage: #{process.QuotaNonPagedPoolUsage}"
	writeFile.puts "QuotaPagedPoolUsage: #{process.QuotaPagedPoolUsage}"
	writeFile.puts "QuotaPeakNonPagedPoolUsage: #{process.QuotaPeakNonPagedPoolUsage}"
	writeFile.puts "QuotaPeakPagedPoolUsage: #{process.QuotaPeakPagedPoolUsage}"
	writeFile.puts "ReadOperationCount: #{process.ReadOperationCount}"
	writeFile.puts "ReadTransferCount: #{process.ReadTransferCount}"
	writeFile.puts "SessionId: #{process.SessionId}"
	writeFile.puts "Status: #{process.Status}"
	writeFile.puts "TerminationDate: #{process.TerminationDate}"
	writeFile.puts "ThreadCount: #{process.ThreadCount}"
	writeFile.puts "UserModeTime: #{process.UserModeTime}"
	writeFile.puts "VirtualSize: #{process.VirtualSize}"
	writeFile.puts "WindowsVersion: #{process.WindowsVersion}"
	writeFile.puts "WorkingSetSize: #{process.WorkingSetSize}"
	writeFile.puts "WriteOperationCount: #{process.WriteOperationCount}"
	writeFile.puts "WriteTransferCount: #{process.WriteTransferCount}"
	writeFile.puts
	writeFile.puts "*******************************************************************************"
	writeFile.puts
end
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}