This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
informatique:windows:powershell [2023/09/14 08:45] – yahiko | informatique:windows:powershell [2025/01/23 14:58] (current) – yahiko | ||
---|---|---|---|
Line 8: | Line 8: | ||
===== Lancer un script Powershell à partir d'un Batch ===== | ===== Lancer un script Powershell à partir d'un Batch ===== | ||
- | <codedoc | + | <code code: |
Powershell.exe -executionpolicy remotesigned -File NOMDUSCRIPT.ps1 | Powershell.exe -executionpolicy remotesigned -File NOMDUSCRIPT.ps1 | ||
</ | </ | ||
Line 106: | Line 106: | ||
</ | </ | ||
+ | ===== Exporter les utilisateurs d'un AD ===== | ||
+ | <code powershell> | ||
+ | Get-ADUser -Filter * -Proerties * -SearchBase " | ||
+ | </ | ||
+ | |||
+ | ===== Changer la casse d'une variable ===== | ||
+ | |||
+ | <code powershell> | ||
+ | # En majuscule | ||
+ | CHAINE.ToUpper() | ||
+ | |||
+ | # En minuscule | ||
+ | CHAINE.ToLower() | ||
+ | </ | ||
+ | |||
+ | ===== Remplacer un caractère ou un espace ===== | ||
+ | |||
+ | C'est pas beau. | ||
+ | |||
+ | <code powershell> | ||
+ | # Un espace | ||
+ | $string = $string -replace " ","" | ||
+ | |||
+ | # Un apostrophe | ||
+ | $string = $string -replace "'","" | ||
+ | </ | ||
+ | |||
+ | ===== Lister les membres d'un groupe AD ===== | ||
+ | <code powershell> | ||
+ | Get-ADGroupMember -Identity " | ||
+ | </ | ||