Script/Way to lockout all active users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 01:25 AM
Hi All,
We want to lockout/deactivate/disable all active users at a time in a SNOW instance.
Kindly suggest possible ways to mass update all active SNOW users to Locked out =TRUE/Active = FALSE.
Thanks and Regards,
Pradnya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 01:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 01:30 AM
The background script would be:
var gr = new GlideRecord("sys_user");
gr.addQuery("active", "true");
gr.query();
while (gr.next()) {
gr.locked_out=true;
gr.update();
}
But if you want to just prevent users from logging in to Serivcenow, there is another way too. You can edit the glide.login.home and put a custom error page there.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 02:43 AM
Hi Anurag,
Thanks for your reply.
But can you pleaes provide detailed steps to execute this as I am quite new to use Servicenow.
Thanks & Regards,
Pradnya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 03:00 AM
1. Pre-Requisites: You need security_admin role
2. Once you have security role,activate Elevated privileges (by unlocking the lock near Impersonation icon) or in new UI16 you can do by clicking on the name menu
3. Once Elevated privileges are active, go to 'Scripts - Background' and run this script.
4. Also, go through the link mentioned by mguy.
Mark as Helpful or Correct as it suits you.