Skip to content

Advanced

Auteur : Gautier RAYEROUX | Date : 2026-04-15 00:00:00

Terminal window
Import-Module ActiveDirectory
Import-Module Az
Terminal window
Get-Module -ListAvailable
Terminal window
Get-Command -Module ActiveDirectory
Section titled “Installer un module depuis la PowerShell Gallery”
Terminal window
Install-Module -Name PSReadLine -Scope CurrentUser

Terminal window
Get-Command *process*
Terminal window
Get-Help Get-Process
Get-Help Get-Process -Examples
Terminal window
Get-Service | Select-Object Name, Status
Terminal window
Get-Process | Where-Object { $_.CPU -gt 10 }
Terminal window
Get-Process | Sort-Object CPU -Descending

Le pipeline passe des objets, pas du texte :

Terminal window
Get-Service | Where-Object { $_.Status -eq "Running" } | Select-Object Name
Terminal window
Get-Process | Measure-Object
Terminal window
Get-Process | Export-Csv "process.csv" -NoTypeInformation

Terminal window
Get-ChildItem "C:\Logs"
Terminal window
Get-Content "notes.txt"
Terminal window
"Hello PowerShell" | Out-File "test.txt
Terminal window
Add-Content -Path "test.txt" -Value "Nouvelle ligne"
Terminal window
Copy-Item "source.txt" "backup\source.txt"
Move-Item "source.txt" "archive\"
Remove-Item "old.txt"
Terminal window
New-Item -ItemType Directory -Path "C:\NouveauDossier"

Terminal window
$data = Get-Content "config.json" | ConvertFrom-Json
$data.Server.Name
Terminal window
$data.Version = "2.0"
$data | ConvertTo-Json | Set-Content "config.json"

Terminal window
Invoke-RestMethod -Uri "https://api.example.com/users"
Terminal window
Invoke-RestMethod -Uri "https://api.example.com/login" -Method Post -Body @{
user = "admin"
pass = "1234"
}

Terminal window
Get-Process
Stop-Process -Name "notepad"
Terminal window
Get-Service
Restart-Service -Name "Spooler"