En effet il est quelque fois nécessaire de connaitre et de supprimer les clés de télédistribution LANDESK des postes clients.
► Afficher le texte
Code : Tout sélectionner
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.12.1
Author: Whipper
Script Function:
Landesk Viewer.
#ce ----------------------------------------------------------------------------
; Include options
#include <ButtonConstants.au3>
#include <GuiConstantsEx.au3>
#include <GUIConstants.au3>
#include <Date.au3>
#include <WindowsConstants.au3>
#RequireAdmin
; Options
AutoItSetOption("TrayAutoPause", 0)
AutoItSetOption("TrayIconDebug", 1)
;Variables
$DomainUserName = "#####"
$DomainName = "####"
$UserPassword = "####"
;Ping
Dim $a = 0
$target = InputBox("Pinger", "Enter UC target: ", "", "", 100, 120, -1, -1)
If $target = "" Then
Exit
EndIf
$pong = Ping($target, 250)
If @error = 0 Then
MsgBox(4096, "Status", "Response from " & $target & " in " & $pong & " ms", 1)
ElseIf @error = 1 Then
MsgBox(16, "Status" & $target & " is offline", 1)
ElseIf @error = 2 Then
MsgBox(32, "Status" & $target & " is unreachable", 1)
ElseIf @error = 3 Then
MsgBox(48, "Status" & $target & " is a bad destination", 1)
Else
MsgBox(0, "Status", "Unknown error encountered", 1)
EndIf
$a = $pong + $a
;Start services
RunAs($DomainUserName, $DomainName, $UserPassword, 0, @ComSpec & " /c " & "SC \\" & $target & " START REMOTEREGISTRY", @ScriptDir, @SW_HIDE)
Sleep(3000)
$vers = RegRead("\\" & $target & "\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "Master_Version")
$type = RegRead("\\" & $target & "\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "Poste_Version")
While 1
; GUI
GUICreate("-=[ Landesk Viewer ]= - ", 500, 670)
GUISetState(@SW_SHOW)
;picture
GUICtrlCreateLabel(_DateTimeFormat(_NowCalc(), 2), 425, 20)
GUICtrlCreateLabel("Nom de machine: " & $target, 10, 10)
GUICtrlCreateLabel("Version du Master: " & $vers, 200, 10)
GUICtrlCreateLabel("Version du Poste: " & $type, 10, 30)
GUICtrlCreateGroup("Logiciels installés", 10, 60, 485, 540)
;Count lines numbers on BDR
For $n = 1 To 25
$Key = RegEnumKey("\\" & $target & "\HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\LDWM\AppHealing\Agent\AMClient\APM\PolicyCache", $n)
If $Key > "Aucune donnée n'est disponible." Then ExitLoop
$Count = $n
If @error <> 0 Then ExitLoop
Next
;Display result of lines numbers
Dim $varx[$Count + 1]
For $i = 1 To $Count
$var = RegEnumKey("\\" & $target & "\HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\LDWM\AppHealing\Agent\AMClient\APM\PolicyCache", $i)
$name = RegRead("\\" & $target & "\HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\LDWM\AppHealing\Agent\AMClient\APM\PolicyCache\" & $var, "Name")
$result = RegRead("\\" & $target & "\HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\LDWM\AppHealing\Agent\AMClient\APM\PolicyCache\" & $var, "Status")
$varx[$i] = GUICtrlCreateCheckbox($var & $name & $result, 20, 85 + (20 * ($i - 1)), 470, 20)
If @error <> 0 Then ExitLoop
Next
;Bouton
$Button_1 = GUICtrlCreateButton("Delete", 200, 620, 100)
; Delete the key(s) checked
While 1
$msg = GUIGetMsg()
Select
Case $msg = $Button_1
For $i = 1 To $Count
If GUICtrlRead($varx[$i]) = $GUI_CHECKED Then
$var = RegEnumKey("\\" & $target & "\HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\LDWM\AppHealing\Agent\AMClient\APM\PolicyCache", $i)
RegDelete("\\" & $target & "\HKEY_LOCAL_MACHINE\SOFTWARE\Intel\LANDesk\LDWM\AppHealing\Agent\AMClient\APM\PolicyCache\" & $var)
EndIf
Next
If Not @error Then ExitLoop
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
WEnd
(Avec par exemple un $WS_VSCROLL pour le résultat)
Toutes contributions a l'amélioration sont les bienvenues...
