- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
As a system administrator have you ever needed to know your current SessionID? Sure, you can find it using a number of different ways, but what about a quick way?
As admin user go to System Definition -> Scripts Background and run:
gs.print(new GlideSession().get().getSessionID());
or:
gs.print(gs.getSession().getSessionID());
The output would be something like below:
[0:00:00.000] Script completed in scope global: script
*** Script: 9718BE3F3763830095E39C4683990EC1
And, if you also needed to know the application node where you're logged in (of course you can find that from stats.do) you could do:
var gr = new GlideRecord('syslog_transaction');
gr.addEncodedQuery('sys_created_onONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()');
gr.addQuery('session', new GlideSession().get().getSessionID());
gr.orderByDesc('sys_created_on');
gr.setLimit(1);
gr.query();
if (gr.next())
gs.print('SessionID: ' + gr.session.toString() + ' on application node: ' + gr.system_id.toString().split(':')[1]);
The output would be something like below:
[0:00:00.024] Script completed in scope global: script
*** Script: SessionID: 41CB932F37E7430095E39C4683990EEF on node: empspanaite006
- 7,273 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.