The sample scripts are not supported under any SolarWinds support program or service. The sample scripts are provided AS IS without warranty of any kind, and SolarWinds expressly disclaims all implied warranties including, warranties of merchantability or of fitness for a particular purpose. In no event shall SolarWinds or any other party be liable for damages arising out of the use of or inability to use the sample scripts.

Disable Inactive Users

Last Modified Date

9/11/2020 4:42 PM


Note : This script was provided by Johnny Walker at Spinen as part of the North American Automation Hackathon in November 2019. This is not supported or tested by Solarwinds MSP

Disabled users that have a lastLoggedIn date older than specified, allowing you to exclude users based on group membership, or username.
Usage details/notes/special requirements: Must be run on a domain controller, excluded usernames and groups are "pipe seperated values" (i.e. "admin|administrator" excludes both admin and administrator.)


Automation Policy


Windows User Management

Target OS

Windows Server 2012 / 2012R2;Windows Server 2016;Windows Server 2019

Compatible with N-Central


N-Central minimum version


Compatible with RMM



For details on how to use this, please go to the MSP Institute and look at automation courses. 
To get to the MSP Institute, go to the success center ( and once logged in, go to training or MSP Institute. from there, go to the course library and search for automation courses



This policy does not produce any necessary output


201912 disable inactive users

Related Content