User Password Expiration Date

Forums Desktop Info User Password Expiration Date

Viewing 13 reply threads
  • Author
    Posts
    • #4984
      zeljkozeljko
      Participant

      I need to show the password expiration date. Can this be achieved with Desktopinfo?

    • #4985
      GlennGlenn
      Keymaster

      something like this:

    • #4986
      zeljkozeljko
      Participant

      Your solution works fantastic. Great piece of software, by the way. One problem with your solution is with users who have the expiration date set to “Never”, desktopinfo displays <NULL>. Also, it would be nice if i could display the number of days left till expiration.

      • #4997
        GlennGlenn
        Keymaster

        This will return a result only if there is a password expiry date. If the date is null, ie password does not expire, then the “hide-no-result” option will cause the item to not display.

    • #4987
      zeljkozeljko
      Participant

      Another problem has arisen. On my comp all works fine, but on the terminal I’m running as a server, no WMI query gets executed. Do I have to configure something to have WMI queries run?

      • #4998
        GlennGlenn
        Keymaster

        probably a permission issue. try running DTI as admin.

    • #4988
      rtrussrtruss
      Participant

      I like that as well. Getting consensus now on whether to add it or not.

      Attachments:
    • #4990
      zeljkozeljko
      Participant

      It works when switching to version 3. But what is strange, on my comp it lists only my expiry date but on the server, it lists the expiration dates for all users. the same query in powershell:
      Get-WmiObject -query "SELECT * FROM Win32_NetworkLoginProfile where UserType='Normal Account' and Privileges>0'
      returns 1 result on my comp and all user expiration dates on the server.

      • #4999
        GlennGlenn
        Keymaster
    • #5000
      zeljkozeljko
      Participant

      Thanks for the quick response. The filtering works fine. But unfortunately the date is not correct (or I am misinterpreting the result – I expect to get the expiration date for AD). For the expiration date, I get 22.02.2022 but the correct expiration date is 11.04.2022. The server is part of a domain. Also the query is pretty slow (1 minute – approximately 3500 users).
      I get the correct date when running in the commandline:

      net user <USERNAME> / DOMAIN

      The result gives me multiple lines for output. One is “Password expires” with the correct date and the query is instantenous. Could it somehow be possible to use this command prompt query to get the result?

    • #5001
      GlennGlenn
      Keymaster

      I can’t account for the date, possibly different between the local machine and the domain server. You can use the CMD item but it returns a big chunk of unfilterable text. You can also research that query using powershell but that’s above my pay grade.

    • #5002
      rtrussrtruss
      Participant

      I found that you can run this net user ‘username’ /domain | find “Password expires” It IS case sensitive sadly but I was able to get the expiration date that way. Now if only I could figure out how to do this with my Azure AD users using modern workplace Azure ad joined devices.

      • This reply was modified 6 months, 3 weeks ago by rtrussrtruss.
      Attachments:
    • #5005
      rtrussrtruss
      Participant

      So I have a mixed environment and only want to show password expiry to my hybrid computers as the azure only units simply will not work.
      Here is what I have tried thus far to no avail 🙁

      DOMAIN=hide-no-result:1
      If=value1:%DOMAIN%, value2:domain.name comp:eq
      WMI=namespace:root\cimv2,query:Win32_NetworkLoginProfile where UserType=”Normal Account” and Privileges>0,color:%Green%,text:Password Expires on:,display:%PasswordExpires_month%[2.0d]/%PasswordExpires_day%[2.0d]/%PasswordExpires_year%

      Am I missing something as the above code will not allow the expire date to display.

      Thanks in advance all.

    • #5007
      GlennGlenn
      Keymaster

      what does it display?

    • #5010
      zeljkozeljko
      Participant

      Solved it eventually like this:

      CMD=file:cmd.exe,parameters:/c net USER %username% /DOMAIN | find "Password expires" ,text:,wide:1,color:#FF6347

      The only pitfall is that I don’t know how to replace the “Password expires” text in the resulting output.

    • #5083
      Albert HernandezAlbert Hernandez
      Participant

      Here is how I do the same thing 🙂
      PWSH Code, in a script “get-UserPasswordExpiration.ps1” stored in the same directory as desktopinfo64.exe

      Outputs the time in
      3/16/2022 12:55:55 PM
      Dekstopinfo.ini
      CMD=file:powershell.exe,parameters:-executionpolicy bypass -noprofile -file get-UserPasswordExpiration.ps1 ,text:Password Expires,hide-no-result:1

      • This reply was modified 5 months, 4 weeks ago by Albert HernandezAlbert Hernandez. Reason: edit text
    • #5111
      rtrussrtruss
      Participant

      sorry for the delay with a reply. someone asked for what it looks like.
      whe\n I use this code: WMI=interval:600,namespace:root\cimv2,query:Win32_NetworkLoginProfile where UserType=”Normal Account” and Privileges>0,color:%Green%,text:Password Expires on:,display:%PasswordExpires_month%[2.0d]/%PasswordExpires_day%[2.0d]/%PasswordExpires_year%,hide-no-result:1

      i get the attached output.
      If there was a option for active user or console user that may help.

      I will try the script idea posted by albert as well. I am trying to avoid using additional scripts with it for simplicity purposes but if that is what it takes, i will go with it. Thanks to all.

Viewing 13 reply threads
  • You must be logged in to reply to this topic.
Glenn's Page