« Scripts PowerShell » : différence entre les versions
Apparence
Aucun résumé des modifications |
Aucun résumé des modifications |
||
| (11 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
{{navigation}} | |||
[[Fichier:PowerShell.png|300px|thumb|right|Bibliothèque PowerShell]] | |||
= ⚡ Scripts PowerShell = | = ⚡ Scripts PowerShell = | ||
Cette page regroupe des scripts PowerShell permettant l'administration, le diagnostic, la maintenance et la sécurisation des systèmes Windows. | Cette page regroupe des scripts PowerShell permettant l'administration, le diagnostic, la maintenance et la sécurisation des systèmes Windows. | ||
Ces scripts sont organisés par catégorie afin de faciliter leur utilisation lors des interventions. | Ces scripts sont organisés par catégorie afin de faciliter leur utilisation lors des interventions. | ||
---- | |||
{| class="wikitable" style="width:50%; background:#F3F8FF;" | {| class="wikitable" style="width:50%; background:#F3F8FF;" | ||
|- | |- | ||
| Ligne 20 : | Ligne 20 : | ||
* [[#Scripts avancés|🚀 Scripts avancés]] | * [[#Scripts avancés|🚀 Scripts avancés]] | ||
|} | |} | ||
{| class="wikitable" style="width:100%; background:#F3F8FF;" | {| class="wikitable" style="width:100%; background:#F3F8FF;" | ||
| Ligne 148 : | Ligne 147 : | ||
Out-File "C:\Rapport-Systeme.txt" | Out-File "C:\Rapport-Systeme.txt" | ||
</pre> | </pre> | ||
== Maintenance Windows == | |||
<pre> | |||
Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue | |||
Write-Host "Nettoyage terminé" | |||
</pre> | |||
<pre> | |||
Get-Volume | | |||
Select DriveLetter, | |||
@{Name="Libre(Go)";Expression={:Round($_.SizeRemaining/1GB,2)}} | |||
</pre> | |||
<pre> | |||
Get-HotFix | | |||
Sort InstalledOn -Descending | |||
</pre> | |||
== Diagnostic système == | |||
<pre> | |||
Get-ComputerInfo | |||
</pre> | |||
<pre> | |||
Get-PhysicalDisk | | |||
Select FriendlyName, | |||
MediaType, | |||
HealthStatus | |||
</pre> | |||
<pre> | |||
Get-Process | | |||
Sort CPU -Descending | | |||
Select -First 10 | |||
</pre> | |||
<pre> | |||
Get-Process | | |||
Sort WorkingSet -Descending | | |||
Select -First 10 | |||
</pre> | |||
== Réseau == | |||
<pre> | |||
Get-NetIPAddress | | |||
Where-Object {$_.AddressFamily -eq "IPv4"} | |||
</pre> | |||
<pre> | |||
Get-NetIPConfiguration | |||
</pre> | |||
<pre> | |||
Test-Connection 8.8.8.8 -Count 4 | |||
</pre> | |||
<pre> | |||
Test-Connection google.fr -Count 4 | |||
</pre> | |||
<pre> | |||
Get-NetTCPConnection | | |||
Where-Object {$_.State -eq "Listen"} | |||
</pre> | |||
== Sécurité == | |||
<pre> | |||
Get-MpComputerStatus | |||
</pre> | |||
<pre> | |||
Start-MpScan -ScanType QuickScan | |||
</pre> | |||
<pre> | |||
Get-LocalUser | |||
</pre> | |||
<pre> | |||
Get-LocalGroupMember Administrateurs | |||
</pre> | |||
== Inventaire matériel == | |||
<pre> | |||
Get-CimInstance Win32_Processor | |||
</pre> | |||
<pre> | |||
Get-CimInstance Win32_PhysicalMemory | |||
</pre> | |||
<pre> | |||
Get-CimInstance Win32_BaseBoard | |||
</pre> | |||
<pre> | |||
Get-CimInstance Win32_BIOS | |||
</pre> | |||
<pre> | |||
Get-CimInstance Win32_VideoController | |||
</pre> | |||
== Administration == | |||
<pre> | |||
Get-Service | | |||
Where-Object {$_.Status -eq "Stopped"} | |||
</pre> | |||
<pre> | |||
Get-Service | | |||
Where-Object {$_.Status -eq "Running"} | |||
</pre> | |||
<pre> | |||
Get-CimInstance Win32_StartupCommand | | |||
Select Name, Command | |||
</pre> | |||
<pre> | |||
(Get-CimInstance Win32_ComputerSystem).UserName | |||
</pre> | |||
== Rapport automatique Pat Informatik == | |||
<pre> | |||
$Rapport = "C:\Rapport-PC.txt" | |||
Get-ComputerInfo | Out-File $Rapport | |||
Add-Content $Rapport "`n=== DISQUES ===" | |||
Get-Volume | Out-File $Rapport -Append | |||
Add-Content $Rapport "`n=== RESEAU ===" | |||
Get-NetIPAddress | | |||
Out-File $Rapport -Append | |||
Write-Host "Rapport généré : $Rapport" | |||
</pre> | |||
== Scripts avancés == | |||
<pre> | |||
Write-Host "=== WINDOWS ===" | |||
Get-ComputerInfo | | |||
Select WindowsProductName | |||
Write-Host "=== RAM ===" | |||
(Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory | |||
Write-Host "=== DISQUES ===" | |||
Get-Volume | |||
Write-Host "=== DEFENDER ===" | |||
(Get-MpComputerStatus).AntivirusEnabled | |||
</pre> | |||
<pre> | |||
Restart-Computer -ComputerName NOM-PC | |||
</pre> | |||
* [[PowerShell]] | |||
* [[Windows]] | |||
* [[Windows Server]] | |||
* [[Active Directory]] | |||
* [[Hyper-V]] | |||
* [[Réseau]] | |||
* [[Maintenance]] | |||
---- | |||
'''Pat Informatik''' | |||
PowerShell • Automation • Windows • Scripts • Maintenance • Administration | |||
[[#top|⬆ Retour en haut]] | |||
Dernière version du 10 octobre 2026 à 12:54
| 🏠 Accueil | 📚 Index | 🐧 Linux | 🌐 Réseau | 🔒 Cybersécurité | 🖥️ Virtualisation | ✅ Checklists d'intervention | 📚 Tutoriels | 🤝 Services |
|---|
⚡ Scripts PowerShell
Cette page regroupe des scripts PowerShell permettant l'administration, le diagnostic, la maintenance et la sécurisation des systèmes Windows. Ces scripts sont organisés par catégorie afin de faciliter leur utilisation lors des interventions.
| 📑 Navigation rapide |
|---|
| 📂 Catégories disponibles |
|---|
|
🔧 Scripts de dépannage Windows
Ces scripts permettent d'effectuer rapidement des diagnostics lors d'une intervention informatique.
Vérifier l'espace disque
Get-Volume |
Select DriveLetter,
FileSystemLabel,
@{Name="Libre(Go)";Expression={:Round($_.SizeRemaining/1GB,2)}},
@{Name="Total(Go)";Expression={:Round($_.Size/1GB,2)}}
Permet d'identifier rapidement un disque saturé.
Informations réseau
Get-NetIPAddress |
Where-Object {$_.AddressFamily -eq "IPv4"}
Afficher la configuration complète :
Get-NetIPConfiguration
Tester la connexion Internet
Test-Connection 8.8.8.8 -Count 4
Tester un site :
Test-Connection google.fr -Count 4
Vérifier les programmes au démarrage
Get-CimInstance Win32_StartupCommand | Select Name,Location,Command
Très utile pour diagnostiquer un PC lent.
Afficher les services arrêtés
Get-Service |
Where-Object {$_.Status -eq "Stopped"}
Vérifier la RAM disponible
Get-CimInstance Win32_OperatingSystem | Select TotalVisibleMemorySize, FreePhysicalMemory
Informations thermiques
Get-WmiObject MSAcpi_ThermalZoneTemperature ` -Namespace root/wmi | Select CurrentTemperature
Processus utilisant le CPU
Get-Process | Sort CPU -Descending | Select -First 10
Processus utilisant la RAM
Get-Process | Sort WorkingSet -Descending | Select -First 10
État SMART des disques
Get-PhysicalDisk | Select FriendlyName, MediaType, HealthStatus, OperationalStatus
Mises à jour Windows
Get-HotFix | Sort InstalledOn -Descending
État de Microsoft Defender
Get-MpComputerStatus
Inventaire des logiciels
Get-Package | Sort Name
Rapport matériel
Get-ComputerInfo | Out-File "C:\Rapport-Systeme.txt"
Maintenance Windows
Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue Write-Host "Nettoyage terminé"
Get-Volume |
Select DriveLetter,
@{Name="Libre(Go)";Expression={:Round($_.SizeRemaining/1GB,2)}}
Get-HotFix | Sort InstalledOn -Descending
Diagnostic système
Get-ComputerInfo
Get-PhysicalDisk | Select FriendlyName, MediaType, HealthStatus
Get-Process | Sort CPU -Descending | Select -First 10
Get-Process | Sort WorkingSet -Descending | Select -First 10
Réseau
Get-NetIPAddress |
Where-Object {$_.AddressFamily -eq "IPv4"}
Get-NetIPConfiguration
Test-Connection 8.8.8.8 -Count 4
Test-Connection google.fr -Count 4
Get-NetTCPConnection |
Where-Object {$_.State -eq "Listen"}
Sécurité
Get-MpComputerStatus
Start-MpScan -ScanType QuickScan
Get-LocalUser
Get-LocalGroupMember Administrateurs
Inventaire matériel
Get-CimInstance Win32_Processor
Get-CimInstance Win32_PhysicalMemory
Get-CimInstance Win32_BaseBoard
Get-CimInstance Win32_BIOS
Get-CimInstance Win32_VideoController
Administration
Get-Service |
Where-Object {$_.Status -eq "Stopped"}
Get-Service |
Where-Object {$_.Status -eq "Running"}
Get-CimInstance Win32_StartupCommand | Select Name, Command
(Get-CimInstance Win32_ComputerSystem).UserName
Rapport automatique Pat Informatik
$Rapport = "C:\Rapport-PC.txt" Get-ComputerInfo | Out-File $Rapport Add-Content $Rapport "`n=== DISQUES ===" Get-Volume | Out-File $Rapport -Append Add-Content $Rapport "`n=== RESEAU ===" Get-NetIPAddress | Out-File $Rapport -Append Write-Host "Rapport généré : $Rapport"
Scripts avancés
Write-Host "=== WINDOWS ===" Get-ComputerInfo | Select WindowsProductName Write-Host "=== RAM ===" (Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory Write-Host "=== DISQUES ===" Get-Volume Write-Host "=== DEFENDER ===" (Get-MpComputerStatus).AntivirusEnabled
Restart-Computer -ComputerName NOM-PC
Pat Informatik
PowerShell • Automation • Windows • Scripts • Maintenance • Administration ⬆ Retour en haut