Soporte WMI REMOTO
Publicado: 25 Jul 2011, 17:38
AGREGO UPDATE 26/JULIO/2007
LISTVIEW de los procesos (aun no se como extraer el nombre del proceso y agregar columnas)
Agrego Captura de pantalla
Buenos dias compañeros:
La verdad no soy muy bueno con la programacion y recurro a sus sugerencias/ayuda, ya que me bloquie y no se como continuar.
Tengo el siguiente script para Soporte remoto. Ideal para gente IT mientras te conectas al escritorio remoto vas abriendo este archivo y vez la siguiente informacion en una sola ventana:
Programas Instalados (se pueden desinstalar de forma remota y silenciosa) - FUNCIONA
Procesos en Ejecucion (que se puedan matar los procesos en masa con el checkbox) - NOFUNCIONA (AYUDA)
Elementos que se ejecutan al inicio (Lista los archivos que se ejecutan al inicio y que se puedan eliminar) - NO FUNCIONA (AYUDA)
Servicios (Lista los servicios y tipo de inicio permitiendo deterlos, reiniciarlos, desabilitar, habilitar, etc) - NO HACE NADA
Aqui mi codigo esperando me puedan ayudar.
Actualmente asi se ve
Saludos.
LISTVIEW de los procesos (aun no se como extraer el nombre del proceso y agregar columnas)
Agrego Captura de pantalla
Buenos dias compañeros:
La verdad no soy muy bueno con la programacion y recurro a sus sugerencias/ayuda, ya que me bloquie y no se como continuar.
Tengo el siguiente script para Soporte remoto. Ideal para gente IT mientras te conectas al escritorio remoto vas abriendo este archivo y vez la siguiente informacion en una sola ventana:
Programas Instalados (se pueden desinstalar de forma remota y silenciosa) - FUNCIONA
Procesos en Ejecucion (que se puedan matar los procesos en masa con el checkbox) - NOFUNCIONA (AYUDA)
Elementos que se ejecutan al inicio (Lista los archivos que se ejecutan al inicio y que se puedan eliminar) - NO FUNCIONA (AYUDA)
Servicios (Lista los servicios y tipo de inicio permitiendo deterlos, reiniciarlos, desabilitar, habilitar, etc) - NO HACE NADA
Aqui mi codigo esperando me puedan ayudar.
Código: Seleccionar todo
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <Array.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\LUIS.VIDAL\Mis documentos\PROGRAMACION\SOFTWARE IT\Consola.kxf
$Form1 = GUICreate("YOUR IT SOFTWARE", 1040, 503, 195, 134)
$Group1 = GUICtrlCreateGroup("MENU", 8, 0, 233, 497)
$Input1 = GUICtrlCreateInput("", 104, 16, 121, 21)
$Input2 = GUICtrlCreateInput("", 104, 40, 121, 21)
$USUARIO = GUICtrlCreateLabel("USUARIO:", 26, 18, 56, 17)
$CONTRASE = GUICtrlCreateLabel("CONTRASEÑA:", 17, 42, 81, 17)
$Nombre = GUICtrlCreateInput("", 104, 64, 121, 21)
$Label1 = GUICtrlCreateLabel("NOMBRE/IP:", 21, 66, 69, 17)
$Button10 = GUICtrlCreateButton("CONECTAR", 16, 88, 99, 25)
$Button11 = GUICtrlCreateButton("DESCONECTAR", 128, 88, 99, 25)
$Button12 = GUICtrlCreateButton("ACTUALIZAR", 16, 128, 99, 25)
$Button13 = GUICtrlCreateButton("RESET", 128, 128, 99, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("SOFTWARE INSTALADO", 248, 0, 529, 81)
$Software = GUICtrlCreateCombo("", 256, 16, 513, 25)
$Button1 = GUICtrlCreateButton("ELIMINAR", 464, 48, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("PROCESOS", 792, 8, 241, 481)
$ListServicios = GUICtrlCreateListView("", 800, 24, 217, 422, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
_GUICtrlListView_SetExtendedListViewStyle($ListServicios, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
$Button2 = GUICtrlCreateButton("KILL", 800, 456, 75, 25)
$Button3 = GUICtrlCreateButton("REFRESH", 944, 456, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("ARCHIVOS DE INICIO", 248, 88, 529, 161)
$ListStart = GUICtrlCreateList("", 264, 104, 489, 110)
$Button4 = GUICtrlCreateButton("ELIMINAR", 264, 216, 75, 25)
$Button5 = GUICtrlCreateButton("AÑADIR", 680, 216, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group5 = GUICtrlCreateGroup("SERVICIOS", 248, 256, 529, 241)
$List3 = GUICtrlCreateList("", 264, 272, 505, 188)
$Button6 = GUICtrlCreateButton("INICIAR", 264, 464, 75, 25)
$Button7 = GUICtrlCreateButton("DETENER", 568, 464, 75, 25)
$Button8 = GUICtrlCreateButton("DESABILITAR", 696, 464, 75, 25)
$Button9 = GUICtrlCreateButton("REINICIAR", 408, 464, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
_GUICtrlListView_AddColumn($ListServicios, "Process", 100)
_GUICtrlListView_SetColumnWidth($ListServicios, 1, 50)
_GUICtrlListView_AddColumn($ListServicios, "Usuario", 100)
_GUICtrlListView_SetColumnWidth($ListServicios, 2, 250)
_GUICtrlListView_AddColumn($ListServicios, "Ruta", 200)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
#cs ===============================================================================
BOTTON QUERY
#ce ===============================================================================
CASE $BUTTON10
$sMachine = GUICtrlRead($Nombre)
SplashTextOn("CONECTANDO TERMINAL...", "ESPERE ...", 200, 50)
;CREDENCIALES ADMINISTRATIVAS
Dim $sAdminUser, $sPassword
$sAdminUser = GUICtrlRead($Input1)
$sPassword = GUICtrlRead($Input2)
;;get a WMI Locator
Dim $oLocator
$oLocator = ObjCreate("WbemScripting.SWbemLocator")
;connect to the remote machine
Dim $oService, $oLocator
$oService = $oLocator.ConnectServer($sMachine, "root\cimv2", _
$sAdminUser, $sPassword)
;get a list of installed products
Dim $sMsg, $sName
$cProducts = $oService.ExecQuery("SELECT * FROM Win32_Product")
For $oProduct in $cProducts
GUICtrlSetData($Software, $oProduct.Name)
;~ $sMsg = MsgBox(4, "Product: " & $oProduct, "Would you like to uninstall: " & $oProduct.Name & "?")
;~ If $sMsg = 6 Then
;~ $sName = $oProduct.Name
;~ ExitLoop
;~ EndIf
Next
;get a list of Running Process
Dim $sMsg, $sNameServcios
$cServicios = $oService.ExecQuery("SELECT * " & _
"FROM Win32_Process")
For $oServicios in $cServicios
_GUICtrlListView_AddItem($ListServicios, $oServicios.Name, 0)
;~ _GUICtrlListView_AddSubItem($ListServicios, 0, $oServicios.ExecutablePath, 1)
Next
;get a list of StartUp Process
Dim $sMsg, $sNameStart
$cStart = $oService.ExecQuery("SELECT *FROM Win32_StartupCommand")
For $oStart in $cStart
GUICtrlSetData($ListStart, $oStart.Command)
Next
SplashOff()
#cs ===============================================================================
BOTTON MATAR SERVICIO
#ce ===============================================================================
CASE $BUTTON2
$sNameServcios = GUICtrlRead($ListServicios)
;Get the named package
$cServicios = $oService.ExecQuery("SELECT * " & _
"FROM Win32_Process WHERE Name = '" & _
$sNameServcios & "'")
For $oServicios in $cServicios
;uninstall it
$oServicios.Terminate()
MsgBox(0, "Tarea Terminada.", "Finalizo " & $sNameServcios)
Next
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd