Jump to content

Recommended Posts

Posted

Hi there

I'm after creating a script that will prompt for a username and then tell me when the password for that account is due to expire.

I was planning on using something along these lines unless there is a better way

I was working with Get-ADUser -Identity "$username" –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed"

 

but that doesn't seem to work for me.

 

Any help would be great

Thanks

Nick

 

 

#[system.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null

#$UserName = [Microsoft.VisualBasic.Interaction]::InputBox("Enter User Name", "-UserName", "$UserName")

Get-ADUser -Identity "User" –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" |

Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

Posted

This works for me, what errors do you get when it runs?

 

$user = Read-Host "Enter username to find Expiry date for:"

Get-ADUser -Identity $user –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...