Skip to content

Instantly share code, notes, and snippets.

@pmbuko
Last active August 29, 2015 14:24
Show Gist options
  • Save pmbuko/132bfd7b45c806d84bab to your computer and use it in GitHub Desktop.
Save pmbuko/132bfd7b45c806d84bab to your computer and use it in GitHub Desktop.

Revisions

  1. pmbuko revised this gist Jul 7, 2015. 1 changed file with 8 additions and 5 deletions.
    13 changes: 8 additions & 5 deletions get_ad_pass_expiration.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,9 @@
    #!/bin/bash
    expireDateWin=$(dscl localhost read /Search/Users/$USER \
    msDS-UserPasswordExpiryTimeComputed 2>/dev/null |\
    awk '/dsAttrTypeNative/{print $NF}')
    expireDateUnix=$(echo "($expireDateWin/10000000)-11644473600" | bc)
    date -r $expireDateUnix
    USER=$(/usr/bin/python -c \
    'from SystemConfiguration import SCDynamicStoreCopyConsoleUser;\
    print SCDynamicStoreCopyConsoleUser(None, None, None)[0]')
    xWin=$(/usr/bin/dscl localhost read /Search/Users/$USER \
    msDS-UserPasswordExpiryTimeComputed 2>/dev/null |\
    /usr/bin/awk '/dsAttrTypeNative/{print $NF}')
    xUnix=$(echo "($xWin/10000000)-11644473600" | bc)
    /bin/date -r $xUnix
  2. pmbuko revised this gist Jul 2, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion get_ad_pass_expiration.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    #!/bin/bash
    expireDateWin=$(dscl localhost read /Search/Users/$USER msDS-UserPasswordExpiryTimeComputed 2>/dev/null |\
    expireDateWin=$(dscl localhost read /Search/Users/$USER \
    msDS-UserPasswordExpiryTimeComputed 2>/dev/null |\
    awk '/dsAttrTypeNative/{print $NF}')
    expireDateUnix=$(echo "($expireDateWin/10000000)-11644473600" | bc)
    date -r $expireDateUnix
  3. pmbuko created this gist Jul 2, 2015.
    5 changes: 5 additions & 0 deletions get_ad_pass_expiration.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    #!/bin/bash
    expireDateWin=$(dscl localhost read /Search/Users/$USER msDS-UserPasswordExpiryTimeComputed 2>/dev/null |\
    awk '/dsAttrTypeNative/{print $NF}')
    expireDateUnix=$(echo "($expireDateWin/10000000)-11644473600" | bc)
    date -r $expireDateUnix