Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. function getPasswordExpiryDateforUser($user){
  2. $result = get-aduser $user -Server "other.domain.server:636" –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}
  3. return $result
  4. }
  5.  
  6. getPasswordExpiryDateforUser("myUserName")
  7.  
  8. get-aduser : Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not have the Active Directory Web Services running.
  9. At C:testscheckUserPasswordExpiryDate.ps1:2 char:15
  10. + ... $result = get-aduser $user -Server "other.domain.server: ...
  11. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  12. + CategoryInfo : ResourceUnavailable: (myUserName:ADUser) [Get-ADUser], ADServerDownException
  13. + FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.GetADUse
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement