Sponsored Links

Login Form






Lost Password?

Syndicate

Home
Finding Running Processes On A Remote Computer PDF Print E-mail
User Rating: / 0
PoorBest 
Written by Cheyenne Harden   

Do you ever need to find out what processes are running on a remote machine?

I do, so here is a script that will query a remote computer and write all processes to a text file.

----------COPY EVERYTHING BELOW THIS LINE----------


Dim objWMIService, objProcess, colProcess, fso, objFSO1, objFile, objFolder
Dim strComputer, strList, strWritePath, textFile, strFile, strDirectory, i
Const OPEN_FILE_FOR_WRITING = 2
strComputer = inputbox("Enter Computer Name Here.")
strFile = strComputer &".txt"
strWritePath = "\\SERVER\files\Scripts\" & strFile
strDirectory = "\\SERVER\files\Scripts\"
i = 0

'#########

Set objFSO1 = CreateObject("Scripting.FileSystemObject")

If objFSO1.FileExists("\\SERVER\files\Scripts\" & strFile) Then
    Set objFolder = objFSO1.GetFile("\\SERVER\files\Scripts\" & strFile)

Else
    Set objFile = objFSO1.CreateTextFile(strDirectory & strFile)
    'Wscript.Echo "Just created " & objFolder & "\" & strFile
    objFile = ""

End If

'#########

If strComputer > "" Then
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set fso = CreateObject("Scripting.FileSystemObject")
Set textFile = fso.OpenTextFile(strWritePath, OPEN_FILE_FOR_WRITING)

Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process")

For Each objProcess in colProcess
strList = strList & i & " " & objProcess.Name & vbCrLf
i = i + 1
Next

textFile.WriteLine(strList)
Wscript.Echo strList

Wscript.Echo "Done..."
Else
End If
WScript.Quit




----------COPY EVERYTHING ABOVE THIS LINE----------



PLEASE MAKE SURE NO WORD WRAPPING IS HAPPENING IN YOUR NOTEPAD!!!


Make sure you replace \\SERVER\files\Scripts\ with your UNC server path which you want to log to.


*Make sure that you have write ability to the file path.


This information is provided "AS IS" with no warranties expressed or implied.

Comments
Add NewSearch
chilifrei64 - This is a test comment   | Super Administrator | 09-08-2006 08:42:08
WOW.. what a great script
ceharden - Need user input   | Author | 09-08-2006 08:45:09
My scripts are not perfect, so I am looking for users to request changes to help make them more functional!
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
 
Security Image
Please input the anti-spam code that you can read in the image.

Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved.

 
Tag it:
Delicious
Furl it!
Spurl
digg
YahooMyWeb
< Prev   Next >
 

Google Search

Google