This file contains hidden or 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
| import sys | |
| if len(sys.argv) < 4: | |
| warning = """ | |
| Please provide 3 parameters in the format "instancename username password" | |
| e.g. dev1234 itiluser itiluserpassword | |
| """ | |
| print(warning) | |
| sys.exit() | |
| sninstance = "https://" + sys.argv[1] + ".service-now.com" |
This file contains hidden or 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
| /* | |
| MID SERVER WILL NEED TO TRUST YOUR CERTIFICATE OR YOU CAN UPDATE MID CERTIFICATE POLICY FOR Intranet | |
| https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0864769 | |
| */ | |
| var username = 'admin'; | |
| var pwd = 'pass'; | |
| var nessusHost = 'secops.domain.home'; | |
| var scanName = 'My Scan for Lab'; | |
| var midserver = 'winmid01'; |
This file contains hidden or 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 checkIfRecordExists(payloadItem) { | |
| var certGr = new GlideRecord('cmdb_ci_certificate'); | |
| certGr.addQuery('fingerprint', payloadItem.values['fingerprint']); | |
| certGr.query(); | |
| return certGr.next() ? certGr : ""; | |
| } | |
| var rtrn = {}; | |
| //parsing the json string to a json object |
This file contains hidden or 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
| var target = new GlideRecord('sys_email'); | |
| target.initialize(); | |
| target.type = 'received'; | |
| target.subject = "Test Email Subject"; | |
| target.recipients = "itdept@domain.com"; | |
| target.origemail = "bob.smith@domain.com"; | |
| target.body = "sample email body for description"; | |
| target.body_text = "sample email body for description"; | |
| target.headers = "From:Bob Smith <bob.smith@domain.com> \ | |
| To:itdept@domain.com \ |
This file contains hidden or 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
| <# | |
| .DESCRIPTION | |
| To silently install the ServiceNow MID Server on a Windows system. | |
| Place the file on the target MID Server host machine, update the variables at the top | |
| and run it in PowerShell. | |
| #> | |
| $MSI_FILE_NAME = "C:\temp\winmid.msi" | |
| $INSTALL_LOCATION = "C:\winmid" | |
| $INSTANCE_URL = "https://dev1234.service-now.com/" |
This file contains hidden or 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
| <mail_script> | |
| var ritm = new GlideRecord('sc_req_item'); | |
| ritm.addQuery("sys_id", current.request_item); | |
| ritm.query('cat_item.name', 'Standard Laptop'); | |
| ritm.query(); | |
| if (ritm.next()) { | |
| photoshop = ritm.variables.photoshop; | |
| email.setSubject("New Laptop requested and photoshop is set to " + photoshop + " " + current.number); | |
| } | |
| </mail_script> |
This file contains hidden or 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
| //custom function to retrieve all variables from a RITM and print in email | |
| //https://community.servicenow.com/community?id=community_question&sys_id=c8eff1461b4b6050ed6c9979b04bcb59 | |
| (function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template, | |
| /* Optional EmailOutbound */ | |
| email, /* Optional GlideRecord */ email_action, | |
| /* Optional GlideRecord */ | |
| event) { | |
| // Add your code here | |
| template.print("Summary of Related Requested item:<br />"); |
This file contains hidden or 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
| //custom function to retrieve all variables from a RITM and print in email | |
| //https://community.servicenow.com/community?id=community_question&sys_id=c8eff1461b4b6050ed6c9979b04bcb59 | |
| (function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template, | |
| /* Optional EmailOutbound */ | |
| email, /* Optional GlideRecord */ email_action, | |
| /* Optional GlideRecord */ | |
| event) { | |
| // Add your code here | |
| template.print("Summary of Requested items:<br />"); |
This file contains hidden or 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
| #!/bin/bash | |
| #reference - stolen from https://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html | |
| #This script should run on any Linux host and has no hard coded parameters | |
| #set percentage to trigger alert | |
| threshold=80 | |
| emailaddress=youremail@yourdomain.com | |
| #important****the first line will exclude filesystems with specified strings****** | |
| df -PH | grep -vE '^Filesystem|tmpfs|cdrom|nashome' | awk '{ print $5 " " $1 " " $6 }' | while read output; | |
| do | |
| echo $output |
This file contains hidden or 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
| SET serveroutput ON | |
| BEGIN | |
| FOR cur_syn IN (SELECT synonym_name | |
| FROM all_synonyms | |
| WHERE table_owner = upper('schema_user')) | |
| LOOP | |
| BEGIN | |
| EXECUTE IMMEDIATE ('drop public synonym ' || cur_syn.synonym_name ||' '); | |
| EXCEPTION | |
| WHEN OTHERS |