Change all passwords in a system
This code snippet changes all passwords in a system to a specified string. The two literal strings at the beginning of the snippet can be adjusted to edit the system or password string. The class method "test" runs the code:
Class eduardlebedyuk.changePasswords Extends %RegisteredObject
{
ClassMethod test()
{
set ns = $namespace
zn "%SYS"
set NewPass = "NewPassString"
set rs=##Class(%ResultSet).%New("Security.Users:List")
set st = rs.Execute()
while rs.Next() { set st=$SYSTEM.Security.ChangePassword(rs.Get("Name"),NewPass)}
zn ns
}
}
(Originally posted on Intersystems CODE by @Eduard Lebedyuk, 10/8/2014)
Here's a link to the code on GitHub