Table: servicenow_sys_user - Query ServiceNow Users using SQL
ServiceNow is a cloud-based platform designed to help businesses manage digital workflows for enterprise operations. It provides a centralized system to manage, coordinate, and develop effective workflows for business processes. ServiceNow includes a wide range of products and services, including IT service management, IT operations management, and IT business management.
Table Usage Guide
The servicenow_sys_user
table provides insights into user profiles within ServiceNow. As an IT manager or system administrator, explore user-specific details through this table, including roles, groups, and associated metadata. Utilize it to manage and monitor user activities, such as user roles and group memberships, and to verify user properties.
Examples
List users who haven't logged in for more than 90 days
Discover the segments that include users who haven't been active for more than 90 days. This can be useful in identifying inactive accounts for potential clean-up or outreach efforts.
select user_name, last_login_timefrom servicenow.servicenow_sys_userwhere last_login_time < now() - interval '90 DAYS';
select user_name, last_login_timefrom servicenow_servicenow_sys_userwhere last_login_time < datetime('now', '-90 day');
Users with Multifactor Authentication Disabled
Explore which users have not enabled multifactor authentication. This can be useful in identifying potential security risks within your system.
select count(*) as users_with_mfa_enabledfrom servicenow.servicenow_sys_userwhere enable_multifactor_authn = false;
select count(*) as users_with_mfa_enabledfrom servicenow_servicenow_sys_userwhere enable_multifactor_authn = 0;
Distribution of Users by Department
Discover the distribution of users across various departments. This query aids in understanding the user allocation in each department, providing valuable insights for resource planning and management.
select department, count(*) as num_usersfrom servicenow.servicenow_sys_usergroup by department;
select department, count(*) as num_usersfrom servicenow_sys_usergroup by department;
Users with Failed Login Attempts
Discover the segments that have experienced unsuccessful login attempts to gain insights into the average number of failed attempts per user. This information can aid in identifying potential security issues or areas for user experience improvement.
select count(*) as users_with_failed_attempts, avg(failed_attempts) as avg_failed_attemptsfrom servicenow.servicenow_sys_userwhere failed_attempts > 0;
select count(*) as users_with_failed_attempts, avg(failed_attempts) as avg_failed_attemptsfrom servicenow_sys_userwhere failed_attempts > 0;
Users with Profile Photo
Discover the number of users who have uploaded a profile photo on ServiceNow. This can be useful in identifying user engagement levels or in designing user-centric features.
select count(*) as users_with_photofrom servicenow.servicenow_sys_userwhere photo is not null;
select count(*) as users_with_photofrom servicenow_sys_userwhere photo is not null;
Distribution of Users by Country
Explore which countries have the most users to understand the global distribution of your user base. This can help in tailoring your services to cater to these regions more effectively.
select country, count(*) as num_usersfrom servicenow.servicenow_sys_usergroup by country;
select country, count(*) as num_usersfrom servicenow_sys_usergroup by country;
Users with No Manager Assigned
Discover the segments that have users without a manager assigned. This can be useful in identifying potential gaps in your team structure or areas that may require additional management oversight.
select count(*) as users_with_managerfrom servicenow.servicenow_sys_userwhere manager is null;
select count(*) as users_with_managerfrom servicenow_sys_userwhere manager is null;
Average Time Since Last Login
Understand the average duration since the last login for all active users. This can be useful for gauging user activity and identifying potential periods of inactivity.
select avg( extract( epoch from (now() - last_login_time) ) ) as avg_time_since_last_login_in_millisecondsfrom servicenow.servicenow_sys_userwhere active = true;
select avg( strftime('%s', 'now') - strftime('%s', last_login_time) ) as avg_time_since_last_login_in_millisecondsfrom servicenow.servicenow_sys_userwhere active = 1;
Distribution of Users by Preferred Language
Explore the distribution of users based on their preferred language. This helps in understanding user preferences and tailoring language-specific services for better user experience.
select preferred_language, count(*) as num_usersfrom servicenow.servicenow_sys_usergroup by preferred_language;
select preferred_language, count(*) as num_usersfrom servicenow_sys_usergroup by preferred_language;
Schema for servicenow_sys_user
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
accumulated_roles | text | Roles accumulated by the user. | |
active | boolean | Indicates if the user is active. | |
avatar | text | Avatar image for the user. | |
building | jsonb | Building where the user is located. | |
calendar_integration | bigint | Integration settings for the user's calendar. | |
city | text | City where the user is located. | |
company | jsonb | Company associated with the user. | |
correlation_id | text | Correlation ID for user records. | |
cost_center | jsonb | Cost center associated with the user. | |
country | text | Country where the user is located. | |
date_format | text | Date format preference for the user. | |
default_perspective | jsonb | Default perspective for the user. | |
department | text | Department associated with the user. | |
edu_status | text | Educational status of the user. | |
text | Email address of the user. | ||
employee_number | text | Employee number of the user. | |
enable_multifactor_authn | boolean | Indicates if multi-factor authentication is enabled for the user. | |
failed_attempts | bigint | Number of failed login attempts for the user. | |
first_name | text | First name of the user. | |
gender | text | Gender of the user. | |
hashed_user_id | text | Hashed user ID for user records. | |
home_phone | text | Home phone number of the user. | |
hr_integration_source | jsonb | Source of HR integration for the user. | |
instance_url | text | The ServiceNow instance URL. | |
internal_integration_user | boolean | Indicates if the user is an internal integration user. | |
introduction | text | Introduction or bio of the user. | |
last_login | text | Last login date for the user. | |
last_login_device | text | Device used for the user's last login. | |
last_login_time | timestamp with time zone | Time of the user's last login. | |
last_name | text | Last name of the user. | |
last_password | text | Last password used by the user. | |
ldap_server | jsonb | LDAP server associated with the user. | |
location | jsonb | Location where the user is located. | |
locked_out | boolean | Indicates if the user is locked out. | |
manager | jsonb | Manager of the user. | |
middle_name | text | Middle name of the user. | |
mobile_phone | text | Mobile phone number of the user. | |
name | text | Full name of the user. | |
notification | bigint | Notification settings for the user. | |
password_needs_reset | boolean | Indicates if the user's password needs to be reset. | |
phone | text | Phone number of the user. | |
photo | text | Profile photo of the user. | |
preferred_language | text | Preferred language for the user. | |
roles | text | Roles assigned to the user. | |
schedule | jsonb | Schedule associated with the user. | |
source | text | Source of the user record. | |
sp_connection_name | text | Steampipe connection name. | |
sp_ctx | jsonb | Steampipe context in JSON form. | |
state | text | State or province where the user is located. | |
street | text | Street address of the user. | |
sys_class_name | text | System class name of the record. | |
sys_created_by | text | User who created the record. | |
sys_created_on | timestamp with time zone | Date and time when the record was created. | |
sys_domain | jsonb | Domain associated with the record. | |
sys_domain_path | text | Domain path associated with the record. | |
sys_id | text | Unique system identifier for the record. | |
sys_mod_count | bigint | Number of times the record was modified. | |
sys_updated_by | text | User who last updated the record. | |
sys_updated_on | timestamp with time zone | Date and time when the record was last updated. | |
time_format | text | Time format preference for the user. | |
time_zone | text | Time zone preference for the user. | |
title | text | Title or job role of the user. | |
transaction_log | text | Transaction log associated with the user. | |
user_name | text | User name of the user. | |
user_password | text | User password of the user. | |
vip | boolean | Indicates if the user is a VIP. | |
web_service_access_only | boolean | Indicates if the user has access only through web services. | |
zip | text | ZIP or postal code of the user. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- servicenow
You can pass the configuration to the command with the --config
argument:
steampipe_export_servicenow --config '<your_config>' servicenow_sys_user