August 21, 2015 at 7:05 am
is any query to know the sql service account expiry date?
August 21, 2015 at 7:20 am
From a command prompt, net user [username] gives it in details. You could get this from xp_cmdshell, but you'd be parsing things. Get-ADUser in Powershell can help as well.
August 21, 2015 at 7:21 am
service accounts don't expire, right? i know "regular user accounts", can have a domain expire date and a separate password expire date.
with Powershell, i've queries active directory to get all users and when their accounts or passwords expire, i'd bet we could do the same for local accounts, but not sure how.
the AD command is like this example; (we populate the optional extensionattributes, in case you were wondering; typically they are blank)
Import-Module ActiveDirectory
Get-ADUser -Filter * -Properties * | select -property sAMAccountName,ou,
GivenName,SurName,DisplayName,email,emailaddress,
StreetAddress,City,State,PostalCode,
HomePhone,MobilePhone,OfficePhone,Fax,
Company,Organization,Department,Title,Description,Office,
extensionAttribute1,extensionAttribute2,extensionAttribute3,extensionAttribute4,extensionAttribute5,
@{Name='AccountExpires';Expression={[DATETIME]::fromFileTime($_.accountExpires)}},Enabled,PasswordLastSet,
@{n="PasswordExpirationDate";e={$_.PasswordLastSet.AddDays($maxPasswordAge)}},PasswordNeverExpires,PasswordExpired,
LastLogonDate,whenCreated
Lowell
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply