Last active
January 23, 2022 00:14
-
-
Save thisnameissoclever/2a71745e751a882e04e4235a49b1bf41 to your computer and use it in GitHub Desktop.
ServiceNow - Deploy sub-prod configuration automatically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deployDevConfig() { | |
_deactivateAllNonAdmins(); | |
_disableEmails(); | |
_setHeaderName(); | |
_deactivateLDAPServers(); | |
} | |
function _deactivateAllNonAdmins() { | |
var gr = new GlideRecord('sys_user'); | |
gr.addEncodedQuery('roles!=admin'); | |
gr.query(); | |
gr.setValue('locked_out', 'true'); | |
gr.updateMultiple(); | |
return true; | |
} | |
function _disableEmails() { | |
//Disable inbound emails | |
gs.setProperty("glide.email.read.active", false); | |
//Disable outbound emails | |
gs.setProperty("glide.email.smtp.active", false); | |
//set test address to forward all emails to (if sending it re-enabled) | |
gs.setProperty("glide.email.test.user", '[email protected]'); | |
return true; | |
} | |
function _setHeaderName() { | |
gs.setProperty("glide.product.description", "SUB-PROD Instance"); | |
return true; | |
} | |
function _deactivateLDAPServers() { | |
var grLDAP = new GlideRecord("ldap_server_config"); | |
grLDAP.query(); | |
grLDAP.setValue('active', 'false'); | |
grLDAP.updateMultiple(); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment