Advertisement
savsanta

Convert Windows AD Time to Regular Dates Bash

Feb 14th, 2024 (edited)
1,128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.24 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. adPwdLastSetNT=$(dscl "/Active Directory/DOMAINNAME/" -read /Users/USERNAME pwdLastSet | awk '{print $NF}')
  4.  
  5. adPwdLastSetHuman=$(date -j -f "%s" "$((($adPwdLastSetNT/10000000)-11644473600))" "+%x %X")
  6.  
  7. echo $adPwdLastSetHuman
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement