gioxx revised this gist 2 years ago. Go to revision
2 files changed, 13 insertions
UtentiAD_in_scadenza.ps1(file created)
| @@ -0,0 +1,9 @@ | |||
| 1 | + | Import-Module ActiveDirectory | |
| 2 | + | ||
| 3 | + | # Definisci la scadenza account (in questo caso filtro gli account che scadranno entro il 31/12 dell'anno in corso) | |
| 4 | + | $oggi = Get-Date | |
| 5 | + | $fineAnno = Get-Date -Year $oggi.Year -Month 12 -Day 31 | |
| 6 | + | ||
| 7 | + | $utenti = Get-ADUser -Filter {Enabled -eq $true} -Property SamAccountName, DisplayName, AccountExpirationDate | | |
| 8 | + | Where-Object { $_.AccountExpirationDate -and $_.AccountExpirationDate -le $fineAnno } | |
| 9 | + | $utenti | Select-Object SamAccountName, DisplayName, AccountExpirationDate | Format-Table -AutoSize | |
UtentiAD_tabella_scadenze.ps1(file created)
| @@ -0,0 +1,4 @@ | |||
| 1 | + | Import-Module ActiveDirectory | |
| 2 | + | ||
| 3 | + | $utenti = Get-ADUser -Filter {Enabled -eq $true} -Property SamAccountName, DisplayName, AccountExpirationDate | |
| 4 | + | $utenti | Select-Object SamAccountName, DisplayName, @{Name="AccountExpirationDate"; Expression={if ($_.AccountExpirationDate) { $_.AccountExpirationDate } else { "Nessuna Scadenza" }}} | Format-Table -AutoSize | |
Newer
Older