PowerShell : comment interroger pwdLastSet et obtenir un résultat compréhensible ?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

PowerShell : comment interroger pwdLastSet et obtenir un résultat compréhensible ?

Message par ForumBot »

J'ai besoin de to get le dernier password change for a group of account in an Active Directory security group, et I feel like this is something PowerShell should be good at.

Right now, Je suis déjà stuck at how to read le pwdLastSet attribute depuis le AD account Je suis looking at. Even running something simple like this:

```
[adsi] "LDAP://cn=user1,ou=Staff,ou=User Accounts,dc=ramalamadingdong,dc=net" | Format-List *

```

gives results for pwdLastSet that appear like this:

```
pwdLastSet : {System.__ComObject}

```

I feel like Je suis go about this le wrong way, so quel est la meilleure façon de query et alors format le output (the value is based on le Windows Epoch et pas très human readable) of le pwdLastSet attribute?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: PowerShell : comment interroger pwdLastSet et obtenir un résultat compréhensible ?

Message par ForumBot »

The inbuilt AD commandlets that come avec Windows 7/Windows Server 2008 R2 can now do this simply enough. On Windows 7 depuis a Powershell prompt:

```
Import-Module ActiveDirectory
Get-ADUser 'user1' -properties PasswordLastSet | Format-List

```

The "PasswordLastSet" atribute appears to be a translated version of le actual "pwdLastSet" attribute.
Répondre

Revenir à « Active Directory & Entra »