- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2024 10:34 PM
How to remove Remove bulk user passwords using encoded query in background script.
Encoded query is: user_password!=^active=true
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 01:27 PM
Hi, without additional filtering you would risk locking out all users including yourself.
Can you clarify the business drivers behind this requirement, as it is potentially a risk to BAU operations.
Script would be something like this, but I do not recommend running it in any environment.
var userQuery = new GlideRecord('sys_user');
userQuery.addEncodedQuery('active=true^user_password!=NULL')
userQuery.query();
while(userQuery.next()) {
userQuery.user_password = '';
userQuery.setWorkflow(false);
userQuery.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 01:27 PM
Hi, without additional filtering you would risk locking out all users including yourself.
Can you clarify the business drivers behind this requirement, as it is potentially a risk to BAU operations.
Script would be something like this, but I do not recommend running it in any environment.
var userQuery = new GlideRecord('sys_user');
userQuery.addEncodedQuery('active=true^user_password!=NULL')
userQuery.query();
while(userQuery.next()) {
userQuery.user_password = '';
userQuery.setWorkflow(false);
userQuery.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 07:05 AM
Thank you, i will be adding additional filter. This will work out to me