- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 07-05-2020 08:37 PM
Please hit Like or Bookmark this article if it helps.
Use Case 1: Log out all users who are currently logged into ServiceNow before an outage. Usually we communicate to all the users about the outage days before the actual Outage start date. But just to make sure no one is currently logged into the instance during the outage, we can run the below background script few minutes before the actual outage start time.
var userGr = new GlideRecord('sys_user');
userGr.addEncodedQuery('active=true^locked_out=false^user_name!='+gs.getUserName());
userGr.query();
while(userGr.next()){
var userName = userGr.getValue('user_name');
GlideSessions.lockOutSessionsInAllNodes(userName);
}
Output:
locked_out user abel.tutor
locked_out user julio.curry
locked_out user sergio.chang
locked_out user ramon.amaral
locked_out user Howard.Lewis
......
.....
....
...
..
.
Use Case 2: Annoy a friendly co-worker by logging them out
var userName = 'your coworkers user name';
GlideSessions.lockOutSessionsInAllNodes(userName);
Thank you,
Aman Gurram
ServiceNow Systems Integration Specialist
Helpful links:
Force Logout Users in all Nodes
How to Logout all the user that are currently logged In from the Instance
- 6,385 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi,
Is there a way to achieve this without being redirected to logout page.
I am trying to inactivate user session in ServiceNow based on an event in external application, but ServiceNow page gets redirected to logout page.
Thanks,
Sivaranjani S
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hello, is there a way to do this by logging out a loggedin user once they are added to a group?
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi,
Can you try with these possiblities.
1) location.href='logout.do';
2) openFrameAPI.openCustomURL('logout.do');