I am using the following commandlet to get the list of last password set and then using a variable to get the value and add -365 to it, however this variable is not getting populated.
I can see the commandlet work and output values but the variable I am using $PWdLastSet.passwordlastset is not getting any value, am I doing something wrong ?
$PWdLastSet = get-aduser -filter * -properties passwordlastset, passwordneverexpires -SearchBase "OU=Service Accounts,OU=SG1,OU=AT,DC=wt,DC=ad,DC=cit,DC=cc" |ft Name, passwordlastset, Passwordneverexpires
$expiredDate = $PWdLastSet.passwordlastset.addDays(-365)
I can see the commandlet work and output values but the variable I am using $PWdLastSet.passwordlastset is not getting any value, am I doing something wrong ?
$PWdLastSet = get-aduser -filter * -properties passwordlastset, passwordneverexpires -SearchBase "OU=Service Accounts,OU=SG1,OU=AT,DC=wt,DC=ad,DC=cit,DC=cc" |ft Name, passwordlastset, Passwordneverexpires
$expiredDate = $PWdLastSet.passwordlastset.addDays(-365)
IA