Get Window Titles from remote machine

80 views Asked by At

I'm writing a Windows Service to gather a list of open window titles from a bunch of remote servers using vb.net.

It seems to me that with .Net and PowerShell (I've tried with both!), it's easy to get the data I need locally, but when I try to pull it from a remote server, the data is restricted or missing completely. Also, it seems running it as a service also yields no data.

Concentrating on VB.Net, I've got the following code:

Dim processlist As Process() = Process.GetProcesses("192.168.1.1")

For Each proc As Process In processlist
     If Not String.IsNullOrEmpty(proc.MainWindowTitle) Then
           MsgBox("192.168.1.1," & proc.ProcessName.ToString() & "," & proc.MainWindowTitle.ToString() & "," & proc.StartInfo.UserName.ToString)
     End If
Next

This should give me something along the lines of:

192.168.1.1,notepad,Notepad - Test Document,DOMAIN\username

But what I get is an exception:

`Feature is not supported for remote machines.

at System.Diagnostics.Process.EnsureState(State state) at System.Diagnostics.Process.get_MainWindowHandle() at System.Diagnostics.Process.get_MainWindowTitle()`

What I'm hoping for is to see data relating to all processes running on the remote server which includes (where applicable) any associated main window titles for those processes.

So my question is, is what I'm trying to do, possible? I would rather not have to look at building a agent service that will need to be deployed onto all of the remote servers to overcome this, but my current feeling is this might be necessary.

Appreciate any help anyone can give on this!

Thanks, Darren.

0

There are 0 answers