📋 Export licences installées
Inventaire logiciels et licences installés sur le parc
powershellScript
Export licences & logiciels installés
Inventaire complet des logiciels installés (registre Windows) sur un ou plusieurs serveurs.
Script
# export-licences.ps1 — Inventaire logiciels installés
param(
[string[]]$Servers = @($env:COMPUTERNAME),
[string]$ExportCsv = "C:\rapports\logiciels-$(Get-Date -Format 'yyyyMMdd').csv",
[string]$ExportHtml = "C:\rapports\logiciels-$(Get-Date -Format 'yyyyMMdd').html",
[string]$Filter = "" # Filtrer par nom (ex: "Microsoft", "Adobe")
)
function Get-InstalledSoftware {
param([string]$ComputerName = "localhost")
$RegPaths = @(
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*",
"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*"
)
$Results = foreach ($Path in $RegPaths) {
try {
$Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey(
[Microsoft.Win32.RegistryHive]::LocalMachine, $ComputerName)
$Key = $Reg.OpenSubKey($Path)
if (-not $Key) { continue }
foreach ($SubKey in $Key.GetSubKeyNames()) {
$App = $Key.OpenSubKey($SubKey)
$Name = $App.GetValue("DisplayName")
if (-not $Name) { continue }
if ($Filter -and $Name -notmatch $Filter) { continue }
[PSCustomObject]@{
Serveur = $ComputerName
Nom = $Name
Version = $App.GetValue("DisplayVersion")
Editeur = $App.GetValue("Publisher")
Installation = try {
[datetime]::ParseExact($App.GetValue("InstallDate"),"yyyyMMdd",$null).ToString("dd/MM/yyyy")
} catch { $App.GetValue("InstallDate") }
"Taille (Mo)" = if ($App.GetValue("EstimatedSize")) {
[math]::Round($App.GetValue("EstimatedSize") / 1024, 1)
} else { "" }
Architecture = if ($Path -match "Wow6432") { "32-bit" } else { "64-bit" }
CléReg = $SubKey
}
}
} catch { }
}
$Results | Sort-Object Nom -Unique
}
── Collecte ──────────────────────────────────────────────────
Write-Host "📦 Inventaire logiciels — $(Get-Date -Format 'dd/MM/yyyy HH:mm')" -ForegroundColor Cyan
$AllSoftware = foreach ($Server in $Servers) {
Write-Host " $Server..." -NoNewline
$Apps = Get-InstalledSoftware -ComputerName $Server
Write-Host " ✓ $($Apps.Count) logiciel(s)" -ForegroundColor Green
$Apps
}
Write-Host "`n📊 Total : $($AllSoftware.Count) installations sur $($Servers.Count) serveur(s)"
Top éditeurs
Write-Host "`nTop éditeurs :"
$AllSoftware | Group-Object Editeur | Sort-Object Count -Descending |
Select-Object -First 10 | Format-Table Count, Name -AutoSize
── Export ────────────────────────────────────────────────────
if ($ExportCsv) {
$AllSoftware | Export-Csv -Path $ExportCsv -NoTypeInformation -Encoding UTF8
Write-Host "`n📄 CSV exporté : $ExportCsv" -ForegroundColor Green
}
if ($ExportHtml) {
$Rows = $AllSoftware | ForEach-Object {
"<tr><td>$($_.Serveur)</td><td>$($_.Nom)</td><td>$($_.Version)</td>
<td>$($_.Editeur)</td><td>$($_.Installation)</td><td>$($_.'Taille (Mo)')</td></tr>"
}
@"
<!DOCTYPE html><html lang="fr"><head><meta charset="UTF-8">
<title>Inventaire logiciels</title>
<style>body{font-family:Arial;margin:20px}table{border-collapse:collapse;width:100%}
th,td{border:1px solid #ddd;padding:6px;font-size:13px}th{background:#2c3e50;color:white}
tr:nth-child(even){background:#f5f5f5}</style></head><body>
<h1>📦 Inventaire Logiciels — $(Get-Date -Format 'dd/MM/yyyy')</h1>
<p>$($AllSoftware.Count) logiciels sur $($Servers.Count) serveur(s)</p>
<table><tr><th>Serveur</th><th>Nom</th><th>Version</th><th>Éditeur</th><th>Installé le</th><th>Taille (Mo)</th></tr>
$($Rows -join "`n")</table></body></html>
"@ | Out-File -FilePath $ExportHtml -Encoding UTF8
Write-Host "🌐 HTML exporté : $ExportHtml" -ForegroundColor Green
}
Utilisation
# Serveur local
.\export-licences.ps1
Plusieurs serveurs, filtre Microsoft uniquement
.\export-licences.ps1 -Servers "SRV01","SRV02" -Filter "Microsoft"
Depuis une liste de serveurs
$Servers = Get-Content "C:\conf\serveurs.txt"
.\export-licences.ps1 -Servers $Servers -ExportHtml "C:\rapports\logiciels.html"
🔧 Ouvrir tools.rdr-it.com — application complète →
Plus de 40 outils AdminSys gratuits · SSL · DNS · Docker · Nginx · SSH · Mermaid · et plus