Last active
August 28, 2018 16:45
-
-
Save joenorton8014/e11798f528350197d1133ccda2c6d96e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim fso, objShell, objShellEnv, strComputerName, objFso, dt | |
dt = now | |
timestamp = ((year(dt)*100 + month(dt))*100 + day(dt))*10000 + hour(dt)*100 + minute(dt) | |
Set objShell = WScript.CreateObject("WScript.Shell") | |
Set objShellEnv = objShell.Environment("Process") | |
strComputerName = objShellEnv("ComputerName") | |
Set objFso = WScript.CreateObject("Scripting.FileSystemObject") | |
Set outputFile = objFso.CreateTextFile("C:\tools\allproc-" & timestamp & ".csv", True) | |
strComputer = "." | |
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") | |
Set colItems = objWMIService.ExecQuery( _ | |
"SELECT * FROM Win32_Process",,48) | |
outputFile.WriteLine "Name,CommandLine,CreationDate,Description,ExecutablePath" | |
For Each objItem in colItems | |
outputFile.WriteLine objItem.Name & "," & objItem.CommandLine & "," & objItem.CreationDate & "," & objItem.Description & "," & objItem.ExecutablePath | |
Next | |
outputFile.Close | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment