import depuis ancien GitHub
This commit is contained in:
1
install-agent-with-psexec/AgentEPM/EPM2024Agent.txt
Normal file
1
install-agent-with-psexec/AgentEPM/EPM2024Agent.txt
Normal file
@@ -0,0 +1 @@
|
||||
EPM2024Agent
|
||||
BIN
install-agent-with-psexec/AgentEPM/EPMAgentInstaller.exe
Normal file
BIN
install-agent-with-psexec/AgentEPM/EPMAgentInstaller.exe
Normal file
Binary file not shown.
1
install-agent-with-psexec/AgentEPM/EPM_Manifest
Normal file
1
install-agent-with-psexec/AgentEPM/EPM_Manifest
Normal file
File diff suppressed because one or more lines are too long
BIN
install-agent-with-psexec/AgentEPM/UninstallWinClient.exe
Normal file
BIN
install-agent-with-psexec/AgentEPM/UninstallWinClient.exe
Normal file
Binary file not shown.
30
install-agent-with-psexec/AgentEPM/d3873a1c.0
Normal file
30
install-agent-with-psexec/AgentEPM/d3873a1c.0
Normal file
@@ -0,0 +1,30 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDtjCCAp6gAwIBAgIECrva4TANBgkqhkiG9w0BAQsFADB0MQswCQYDVQQGEwJO
|
||||
QTENMAsGA1UECAwEMzE0MTEZMBcGA1UEBwwQTERNUyBDb3JlIFNlcnZlcjEMMAoG
|
||||
A1UECgwDZGV2MRAwDgYDVQQLDAdFUE0yMDI0MRswGQYDVQQDDBJMQU5EZXNrXzE3
|
||||
MjM2ODE2NjUwHhcNNzAwMTAxMDAwMDAwWhcNMzYwODExMjIzNTQ3WjB0MQswCQYD
|
||||
VQQGEwJOQTENMAsGA1UECAwEMzE0MTEZMBcGA1UEBwwQTERNUyBDb3JlIFNlcnZl
|
||||
cjEMMAoGA1UECgwDZGV2MRAwDgYDVQQLDAdFUE0yMDI0MRswGQYDVQQDDBJMQU5E
|
||||
ZXNrXzE3MjM2ODE2NjUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC0
|
||||
NYv704SOies4UcRxXbzv3HUQazIUK1nrovG31COTyw/6J3O8K3NWl4NwuQ2Y9TrT
|
||||
HHjNif5kLxbVKRKdZb5Ekw9Hc4aKQcwIFOuiiQNSi+fZmj3WIRNdEtYpkeaGqVuQ
|
||||
DoNm9gshjKpsiFVcp2lBaCTxe3TYUBfXhtGh5BwTsIETq4ZTUqzC/cEWzKwgUvK5
|
||||
vhbY6xW+duuovn/KYIgfOlJVeV6S5/qJ49hmRTsTQzfSBbCRCN95NE3o7V6hj8eU
|
||||
SKgtmznKtPg2M3WI4aU3F2aPSxC7962PfyqCCce72I3pQYOq1iyI+3AFXeAfMuuC
|
||||
cSSovXq13qXgvySYYJQlAgMBAAGjUDBOMB0GA1UdEQQWMBSCEkVQTTIwMjQubW9u
|
||||
bGFiLmxhbjAOBgNVHQ8BAf8EBAMCAvwwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsG
|
||||
AQUFBwMCMA0GCSqGSIb3DQEBCwUAA4IBAQCRXZxXwFT7KIhBW2aHrCmHace4ao8t
|
||||
KmhbomOM062V9fzrpryqMdDc5LJhJISacsJDPlruyNn2AmHxth/JRi2BtyTq/HYh
|
||||
5+b4WuWCGgmU6ffhzj4Kuicp5SaRuw0DfeKYO71+yj0QfqIk8bmRMDGhlUiFZXQ1
|
||||
nfFroZ1TofNZHdsI7v6yUEGBbSVIBGA8VDndS0g3Xakt75LKrEJV2i33SNuXEebB
|
||||
PGWFwk5V4MwTujVCDL7wOkkYKj+iCMP7/+0r5S/nk7TdCfTRRINYQGKmIwTtGV/c
|
||||
AB286EAoxn81rz7UBCjaeat8XYNAn43n8seW2seKq5QNcYydA8FUBxXe
|
||||
-----END CERTIFICATE-----
|
||||
[LDMS]
|
||||
Key=LANDesk_1723681665
|
||||
Organization=dev
|
||||
Computer=EPM2024
|
||||
Hash=d3873a1c
|
||||
Created=2024-08-14 22:35:48
|
||||
Timestamp=1723674948
|
||||
HashFunction=SHA256
|
||||
BIN
install-agent-with-psexec/PsExec64.exe
Normal file
BIN
install-agent-with-psexec/PsExec64.exe
Normal file
Binary file not shown.
121
install-agent-with-psexec/installgui.ps1
Normal file
121
install-agent-with-psexec/installgui.ps1
Normal file
@@ -0,0 +1,121 @@
|
||||
# Variables globales
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
|
||||
# Récupérer le chemin du script PowerShell
|
||||
$ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$DefaultFolderPath = Join-Path $ScriptPath "AgentEPM"
|
||||
$PsExecPath = Join-Path $ScriptPath "PsExec64.exe"
|
||||
|
||||
# Fonction pour créer l'interface graphique
|
||||
function Show-InstallGUI {
|
||||
[xml]$xaml = @"
|
||||
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Deploiement de fichier" Height="450" Width="600" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Label Content="Liste des ordinateurs (un par ligne):" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" FontSize="14"/>
|
||||
<TextBox Name="ComputerList" HorizontalAlignment="Left" Height="200" Margin="10,40,0,0" VerticalAlignment="Top" Width="560" AcceptsReturn="True" TextWrapping="Wrap"/>
|
||||
|
||||
<Label Content="Chemin local du dossier a copier :" HorizontalAlignment="Left" Margin="10,250,0,0" VerticalAlignment="Top" FontSize="14"/>
|
||||
<TextBox Name="FolderPath" HorizontalAlignment="Left" Height="30" Margin="10,280,0,0" VerticalAlignment="Top" Width="560" Text="$DefaultFolderPath"/>
|
||||
|
||||
<!-- Nouvelle case à cocher -->
|
||||
<CheckBox Name="ForceUninstall" Content="Force Uninstall avant installation" HorizontalAlignment="Left" Margin="10,320,0,0" VerticalAlignment="Top" FontSize="14"/>
|
||||
|
||||
<Button Content="Install" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,10" Width="100" Height="30" Name="InstallButton"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
"@
|
||||
|
||||
# Charger le XAML et créer la fenêtre
|
||||
$reader = New-Object System.Xml.XmlNodeReader $xaml
|
||||
$window = [Windows.Markup.XamlReader]::Load($reader)
|
||||
|
||||
# Associer les éléments de l'interface aux variables
|
||||
$ComputerList = $window.FindName("ComputerList")
|
||||
$FolderPath = $window.FindName("FolderPath")
|
||||
$ForceUninstall = $window.FindName("ForceUninstall") # Case à cocher
|
||||
$InstallButton = $window.FindName("InstallButton")
|
||||
|
||||
# Fonction exécutée lors du clic sur "Install"
|
||||
$InstallButton.Add_Click({
|
||||
$computers = $ComputerList.Text -split "`r`n" | Where-Object { $_ -ne "" }
|
||||
$folder = $FolderPath.Text
|
||||
$forceUninstallEnabled = $ForceUninstall.IsChecked # Lire l'état de la case à cocher
|
||||
|
||||
# Vérifier si le dossier par défaut existe
|
||||
if (-not (Test-Path $folder)) {
|
||||
[System.Windows.MessageBox]::Show("Le chemin du dossier specifie est invalide ou introuvable : $folder", "Erreur", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||
return
|
||||
}
|
||||
|
||||
# Vérifier si PsExec.exe existe
|
||||
if (-not (Test-Path $PsExecPath)) {
|
||||
[System.Windows.MessageBox]::Show("PsExec.exe est introuvable dans le repertoire du script : $ScriptPath", "Erreur", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||
return
|
||||
}
|
||||
|
||||
# Traitement des ordinateurs
|
||||
foreach ($computer in $computers) {
|
||||
Write-Host "----- $computer"
|
||||
try {
|
||||
# Vérifier l'accès à l'ordinateur
|
||||
if (!(Test-Connection -ComputerName $computer -Count 1 -Quiet)) {
|
||||
Write-Host "---------- ERROR $computer n'est pas accessible."
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Vérifier si l'agent est déjà installé
|
||||
$remoteFilePath = "\\$computer\c$\Program Files (x86)\Ivanti\EPM Agent\EPMAgentInstaller.exe"
|
||||
if (-not (Test-Path $remoteFilePath) -or $forceUninstallEnabled) {
|
||||
# Construire les chemins
|
||||
$destination = "\\$computer\c$\windows\temp"
|
||||
$exePath = "c:\windows\temp\EPMAgentInstaller.exe"
|
||||
|
||||
# Copier le dossier
|
||||
if (Test-Path $destination) {
|
||||
Write-Host "---------- Copy to $destination"
|
||||
Copy-Item -Path $folder\* -Destination $destination -Recurse -Force
|
||||
} else {
|
||||
Write-Host "---------- ERROR Impossible d'acceder au chemin $destination"
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
# Si "Force Uninstall" est activé
|
||||
if ($forceUninstallEnabled) {
|
||||
Write-Host "---------- Arret des services Ivanti pour $computer"
|
||||
$killServicesCommand = "taskkill /F /FI ""SERVICES eq Ivanti*"""
|
||||
Start-Process -FilePath $PsExecPath -ArgumentList "\\$computer -accepteula -w c:\windows\temp cmd /c $killServicesCommand" -NoNewWindow -Wait
|
||||
|
||||
Write-Host "---------- Execution de EPMAgentInstaller.exe /forceuninstall pour $computer"
|
||||
$epmForceUninstallCommand = """C:\Program Files (x86)\Ivanti\EPM Agent\EPMAgentInstaller.exe"" /forceuninstall"
|
||||
Start-Process -FilePath $PsExecPath -ArgumentList "\\$computer -accepteula -w c:\windows\temp cmd /c $epmForceUninstallCommand" -NoNewWindow -Wait
|
||||
|
||||
Write-Host "---------- Execution du Force Uninstall via UninstallWinClient.exe pour $computer"
|
||||
$uninstallCommand = "c:\windows\temp\UninstallWinClient.exe /NOREBOOT"
|
||||
Start-Process -FilePath $PsExecPath -ArgumentList "\\$computer -accepteula -w c:\windows\temp cmd /c $uninstallCommand" -NoNewWindow -Wait
|
||||
}
|
||||
|
||||
# Lancer l'exécutable via PsExec
|
||||
Write-Host "---------- Execution de $exePath via PsExec"
|
||||
Start-Process -FilePath $PsExecPath -ArgumentList "\\$computer -accepteula -w c:\windows\temp $exePath" -NoNewWindow -Wait
|
||||
} else {
|
||||
Write-Host "---------- ERROR L'agent est deja installe"
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "---------- ERROR lors du traitement de l'ordinateur $computer : $_"
|
||||
}
|
||||
}
|
||||
[System.Windows.MessageBox]::Show("Traitement termine.", "Information", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Information)
|
||||
})
|
||||
|
||||
# Afficher la fenêtre
|
||||
$window.ShowDialog() | Out-Null
|
||||
}
|
||||
|
||||
# Afficher l'interface graphique
|
||||
Show-InstallGUI
|
||||
43
install-agent-with-psexec/readme.md
Normal file
43
install-agent-with-psexec/readme.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# 🖥️ installgui.ps1 – Ivanti EPM Agent Deployment via GUI
|
||||
|
||||
This PowerShell script provides a graphical interface (GUI) to remotely deploy the **Ivanti EPM Agent** to multiple computers using `PsExec`. It includes optional forced uninstallation of any existing agent installation before reinstalling.
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Features
|
||||
|
||||
- Simple WPF-based graphical interface
|
||||
- Input: List of target computers (one per line)
|
||||
- Copies a local folder to each remote machine
|
||||
- Option to **force uninstall** the existing agent
|
||||
- Executes installation via `PsExec`
|
||||
- Validates:
|
||||
- Folder path existence
|
||||
- PsExec availability
|
||||
- Network connectivity to each computer
|
||||
|
||||
---
|
||||
|
||||
## 🧰 Requirements
|
||||
|
||||
- Windows with PowerShell
|
||||
- `PsExec64.exe` must be placed in the same directory as the script
|
||||
- A local folder (`AgentEPM`) containing:
|
||||
- `EPMAgentInstaller.exe`
|
||||
- `UninstallWinClient.exe` (for forced uninstalls)
|
||||
|
||||
---
|
||||
|
||||
## 🛠️ How to Use
|
||||
|
||||
1. Run PowerShell as Administrator.
|
||||
2. Execute the script:
|
||||
|
||||
```powershell
|
||||
.\installgui.ps1
|
||||
```
|
||||
3. In the GUI:
|
||||
- Enter one computer name or IP per line
|
||||
- Confirm or change the path to the local folder to copy
|
||||
- Optional) Check the "Force Uninstall" box
|
||||
- Click Install
|
||||
Reference in New Issue
Block a user