User Tools

Site Tools


script:powershell:ad

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
script:powershell:ad [2021/07/05 10:25]
admin
script:powershell:ad [2021/08/27 18:20] (current)
admin
Line 36: Line 36:
 </​sxh>​ </​sxh>​
  
 +=== Gestion des groupes ===
 +<sxh powershell>​
 +$KLADMIN = Get-ADGroup -Filter {name -like "​*kladmin*"​} | ForEach-Object {
 +(Get-ADGroupMember -Identity $_.name -Recursive) | ForEach-Object {
 +$ADUserName = $_.name
 +Get-ADUser -Filter {name -eq $ADUserName} -Properties GivenName,​Name,​mail
 +}
 +}
 +$KLADMIN | Where-Object Enabled -eq $true | Select-Object GivenName,​Name,​mail,​@{n='​Login';​ e={$_.UserPrincipalName}} | Export-Csv -Path C:​\IT\Kladmin.csv -Force -Encoding UTF8 -Delimiter ','​ -NoTypeInformation
 +</​sxh>​
  
  
script/powershell/ad.1625473558.txt.gz · Last modified: 2021/07/05 10:25 by admin