Windows Vista Forums

get-qaduser nt | select passwordlastset
  1. #1


    IT STAFF Guest

    get-qaduser nt | select passwordlastset

    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?



    ============================



      My System SpecsSystem Spec

  2. #2


    Justin Rich Guest

    Re: get-qaduser nt | select passwordlastset

    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?
    >
    > ============================
    >

      My System SpecsSystem Spec

get-qaduser nt | select passwordlastset problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
get-qaduser -includedproperities IT Staff PowerShell 1 12 Jan 2010
GET-QADUSer Help Buck Turgidson PowerShell 0 22 Sep 2009
Select Files - Disable or Enable Full Row Select Brink Tutorials 6 19 Jul 2008
get-qaduser Swamy Channaveera PowerShell 5 26 Mar 2008
get-qaduser Swamy Channaveera PowerShell 8 19 Mar 2008