Skip to content

Conversation

@at8807602
Copy link
Contributor

@at8807602 at8807602 commented Oct 1, 2025

This schedule job script will help to auto disable the service accounts which has not been logged in or used for last 30 days. This can be helpful for those who are looking to disable the accounts based on some certain time period.

This schedule job script will help to auto disable the service accounts which has not been logged in or used for last 40 days.
This file gives the information about the above file for auto disabling the service accounts
@ravichandra1998g ravichandra1998g self-assigned this Oct 1, 2025
Copy link
Contributor

@ravichandra1998g ravichandra1998g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Abhishek,

Transaction logs table is one of the largest tables in the instance which stores all the user/background transactions.

querying it for the last 40 days would have performance implications on the system.

Can you optimize the script for the performance?

Copy link
Contributor

@ravichandra1998g ravichandra1998g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script seems to print an array of user names,
Please modify it as per the description. (auto disabling)

This is for disabling the Service account due to inactivity
This schedule job script will help to auto disable the service accounts which has not been logged in or used for last 30 days. This can be helpful for those who are looking to disable the accounts based on some certain time period.
@at8807602
Copy link
Contributor Author

at8807602 commented Oct 1, 2025

Hello @ravichandra1998g ,

Thanks for the validation. As requested, I have made some certain changes by optimizing the performance impact. Not this looks good from my end in terms of system performance. Please review it and let me know, if any changes are required.

@ravichandra1998g
Copy link
Contributor

This applies to all the users as there is no filter to include only service accounts.. please add the filter.

This code helps to disable the service account due to inactivity for last 30 days.
@at8807602
Copy link
Contributor Author

Hello @ravichandra1998g ,

Again, thanks for the validation. I have applied the filter for only service account. Please validate it and let me know, if anything needs to be changed.

Copy link
Contributor

@ravichandra1998g ravichandra1998g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good now

@ravichandra1998g ravichandra1998g merged commit be1fd1a into ServiceNowDevProgram:main Oct 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants