I assume whats happening is that some of the account have not changed so
there is no value (null) and thats causing the problem so you can just wrap
it in an if statement and look for null...
something like this (im not awesome at this so bear with me)
get-qaduser ntid | foreach { if ($_.PasswordLastSet -ne $null){$password =
$_.PasswordLastSet.TolongDateString()}}
think that should do it
"IT STAFF" <jkklim@newsgroup> wrote in message
news:eQY1BoK8KHA.1424@newsgroup
> get-qaduser ntid | foreach {
>
> $password = $_.PasswordLastSet.TolongDateString()
>
> }
>
> You cannot call a method on a null-valued expression.
> At C:\idm.ps1:16 char:49
> + $password = $_.PasswordLastSet.TolongDateString <<<< ()
> + CategoryInfo : InvalidOperation: (TolongDateString:String)
> [], RuntimeException
> + FullyQualifiedErrorId : InvokeMethodOnNull
>
> ============================
> It gives an error although i can see the actual date. How do i remove the
> error?
>
> ============================
>