Knowing the expiry of service account

  • is any query to know the sql service account expiry date?

  • 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.

  • 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


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply