Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getPasswordExpiryDateforUser($user){
- $result = get-aduser $user -Server "other.domain.server:636" –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" | Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}
- return $result
- }
- getPasswordExpiryDateforUser("myUserName")
- 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.
- At C:testscheckUserPasswordExpiryDate.ps1:2 char:15
- + ... $result = get-aduser $user -Server "other.domain.server: ...
- + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- + CategoryInfo : ResourceUnavailable: (myUserName:ADUser) [Get-ADUser], ADServerDownException
- + FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.GetADUse
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement