I wrote a small script in anonymous window in dev console to reset password for all users in the org apart from two. But it keeps throwing a error like -
System.InvalidParameterValueException: INSUFFICIENT_ACCESS: insufficient access rights on cross-reference id
List<User> userList = new List<User>();
userList = [SELECT Id from User WHERE IsActive = true and ID not in ('00561000000cdef','00561000001abcd')];
for(User u : userList)
{
System.setPassword(u.Id, 'hello2017');
}