Purpose
List AD users with the most important properties and then work with them in Excel.StepsRun te script:
# Importar el módulo de Active Directory
Import-Module ActiveDirectory
# Obtener todos los usuarios y seleccionar los campos deseados
Get-ADUser -Filter * -Property SamAccountName, DisplayName, CN, Enabled, LockedOut, AccountExpirationDate, EmailAddress, WhenCreated, LastLogonDate, PasswordLastSet, LogonWorkstations, PasswordNeverExpires, PasswordNotRequired, DistinguishedName, Description
Select-Object SamAccountName,
DisplayName,
CN,
Enabled,
LockedOut,
EmailAddress,
WhenCreated,
LastLogonDate,
PasswordLastSet,
@{Name="La cuenta expira";Expression={$_.
@{Name="la contraseña nunca expira";Expression={$_.
@{Name="no requiere contraseña";Expression={$_.
DistinguishedNam
Description |
Export-Csv -Path "C:\tmp\Usuarios30012025.csv" -NoTypeInformation -Encoding UTF8 -Delimiter "#"
We will be left with an output like this
By GoN | Published: Jan 2025 | Last Updated:
No hay comentarios:
Publicar un comentario