Expiry Dates on standalone win2003 server

Discussion in 'Scripting' started by Ludgate Hill, Jul 23, 2007.

  1. Ludgate Hill

    Ludgate Hill Guest

    How can I get a listing of expiry dates from a standalone server not running
    Ludgate Hill, Jul 23, 2007
    1. Advertisements

  2. You must mean local accounts on the machine, not domain accounts. You must
    use the WinNT provider with local accounts. The AccountExpirationDate
    property method of the user object returns the account expiration date. If
    you bind to the computer object you can filter on child objects of class
    "user" and enumerate. For example:
    ' Specify NetBIOS name of computer.
    strComputer = "MyServer"

    ' Bind to computer object.
    Set objComputer = GetObject("WinNT://" & strComputer)

    ' Filter on user objects.
    objComputer.Filter = Array("user")

    ' Enumerate local user objects.
    For Each objUser In objComputer
    ' Display user name and expiration.
    Wscript.Echo objUser.Name & ", expires " & objUser.AccountExpirationDate
    Richard Mueller [MVP], Jul 23, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.