Welcome to the community. Please read this link below about how to make a good post:

For the error on line 47, this line:

$intTimeInterval = [int32]($ahora - $PasswordLastChanged).days

should be like this:

$intTimeInterval = [int32]($ahora.days - $PasswordLastChanged.days)

The error on line 55 is caused by trying to call the AddDays() method on a timestamp from ActiveDirectory. AddDays is for DateTime objects, but Active Directory does not return DateTime objects in its attributes.

Instead of this:

$ExpiringDate = $PasswordLastChanged.addDays($intMaxPwdAge)

you can do something like this:

$ExpiringDate = (Get-Date -Format $PasswordLastChanged).addDays($intMaxPwdAge)
2 Spice ups