About the -InactiveAccounts Command

The -InactiveAccounts command is used to list and delete the accounts that have not been used in a specified number of days.

Use the following command to list inactive accounts:

dlocommandu -inactiveaccounts -list -days <#days>

This command returns a list of inactive accounts.

The list includes the following information, which is used to delete specific accounts:

  • computer name

  • computer ID

  • domain\user name

  • userID

Use the following command to delete specific inactive accounts:

dlocommandu -inactiveaccounts -delete -U <domain\user name> -M <computer name> -days <#days>

dlocommandu -inactiveaccounts -delete -UI <userID> -MI <computer ID> -days <#days>

Where -U and -M are used to delete the user and computer by name and -UI and -MI are used to delete the user and computer by ID.

Use the following command to delete ALL accounts inactive for a specified number of days:

dlocommandu -inactiveaccounts -delete -a <#days>

About the -InactiveAccounts Command