Skip to content

Instantly share code, notes, and snippets.

View arothstein's full-sized avatar

Aaron Rothstein arothstein

  • Wunita
  • Minneapolis, MN
View GitHub Profile
@arothstein
arothstein / gist:71dfa2215c90730a82e19ce066b015a3
Created November 1, 2024 17:19
ServiceNow: condition function for scheduled jobs to execute quarterly
// Only generate ticket at beginning of quarter.
function IsStartOfQuarter() {
let result = false;
const now = new GlideDateTime();
const month = now.getMonth();
if (month == 1 || month == 4 || month == 7 || month == 10) {
result = true;
}
return result;
@arothstein
arothstein / gist:28293d4dc14f654f7e6c360d43acca17
Last active September 25, 2024 05:10
Enabling/Disabling non-default windows log, query using FilterHashTable
Get-WinEvent -LogName Microsoft-Windows-DNS-Client/Operational -MaxEvents 100 # | where { $_.ID -gt 1010 }
# Enable a non-default Windows log
$logName = "Microsoft-Windows-DNS-Client/Operational"
Get-WinEvent -ListLog $logName | Format-List Is*
$log = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $logName
$log.IsEnabled = $true
$log.MaximumSizeInBytes = 104857600 # 100 MB
$log.SaveChanges()
Get-WinEvent -ListLog $logName | Format-List Is*