Einzelnen Beitrag anzeigen

fLaSh11
(Gast)

n/a Beiträge
 
#15

Re: Prozesse auf LAN-PC auflisten & beenden

  Alt 18. Feb 2006, 09:30
Als VBS wäre auch dieser Quellcode denkbar:
Code:
remote = InputBox("Name des Remote-PCs:","Remote-Prozesse")
If remote = "" Then WScript.Quit

wmitxt = "winmgmts:{impersonationLevel=impersonate}"
Set wmi = GetObject(wmitxt & "!\\" & remote)
Set prozess1 = wmi.ExecQuery("SELECT * FROM " &_
 "Win32_Process")
Set prozess2 = wmi.ExecQuery("SELECT * FROM " &_
 "Win32_PerfFormattedData_PerfProc_Process")

Set ie = CreateObject("InternetExplorer.Application")
ie.Navigate "about:blank"
While ie.Busy
Wend
Set dok = ie.Document
dok.Open

dok.Writeln "<Title>Prozesse auf " & remote & "</Title><u>" &_
 "[B]Prozesse auf " & remote & "[/b]</u>

" &_
 "<table border='1' cellpadding='0' cellspacing='0' " &_
 "width='99%'><tr><td></td><td>[B]Name</td><td>[B]PID</td>" &_
 "<td>[B]CPU</td><td>[B]Speicher</td></tr>"

zaehler = 1
For Each proz1 In prozess1
  dok.Writeln "<tr><td>" & zaehler & "</td><td>" &_
   proz1.Name & "</td><td>" & proz1.ProcessID & "</td><td>" &_
   cpulast(proz1.ProcessID) & "</td><td align='right'>" &_
   Fix(proz1.WorkingSetSize/1000) & " K</td></tr>"
  zaehler = zaehler + 1
Next

dok.Close
ie.Visible = True
Set shell = WScript.CreateObject("WScript.Shell")
shell.AppActivate("Prozesse auf " & remote)
shell.SendKeys "% x"


Function cpulast(strprozid)
  cpulast = "???"
  For Each proz2 In prozess2
    If proz2.IDProcess = strprozid Then
      cpulast = proz2.PercentProcessorTime
    End If
  Next
End Function
Funktioniert einwandfrei. Kein Virus o.ä.

Als erste Zeile wäre auch dies denkbar:
Code:
remote = InputBox("Name des Remote-PCs:","Remote-Prozesse","Name des meist genutzten PCs")
  Mit Zitat antworten Zitat