Update StackMonkey_v1.ps1

This commit is contained in:
2025-07-07 21:05:35 -04:00
parent 793f0e86f3
commit 1a7f77bbb9

View File

@@ -293,7 +293,8 @@
[Parameter(Mandatory)][string]$Message, [Parameter(Mandatory)][string]$Message,
[ValidateSet("Info","Warning","Error","Success","General")][string]$Level = "Info", [ValidateSet("Info","Warning","Error","Success","General")][string]$Level = "Info",
[string]$TaskCategory = "GeneralTask", [string]$TaskCategory = "GeneralTask",
[switch]$LogToEvent, [string]$EventSource="SVSMSP_Module", [string]$EventLog="Application", [switch]$LogToEvent, [string]$EventSource="SVSMSP_Module", [string]$EventLog = "SVS Scripting",
,
[int]$CustomEventID, [string]$LogFile, [switch]$PassThru [int]$CustomEventID, [string]$LogFile, [switch]$PassThru
) )
# IDs & colors # IDs & colors
@@ -340,18 +341,33 @@
[ValidateSet("Info","Warning","Error","Success","General")] [ValidateSet("Info","Warning","Error","Success","General")]
[string]$Level = "Info", [string]$Level = "Info",
[string]$TaskCategory = "GeneralTask", [string]$TaskCategory = "GeneralTask",
[switch]$LogToEvent [switch]$LogToEvent,
[string]$EventSource = "Script Automation Monkey",
[string]$EventLog = "SVS Scripting"
) )
if ( Get-Command -Name Write-Log -ErrorAction SilentlyContinue ) { if (Get-Command -Name Write-Log -ErrorAction SilentlyContinue) {
# SVSMSP module's Write-Log is available # SVSMSP module's Write-Log is available
Write-Log -Message $Message -Level $Level -TaskCategory $TaskCategory -LogToEvent:$LogToEvent Write-Log `
-Message $Message `
-Level $Level `
-TaskCategory $TaskCategory `
-LogToEvent:$LogToEvent `
-EventSource $EventSource `
-EventLog $EventLog
} }
else { else {
# fall back to your helper # Fall back to your helper
Write-LogHelper -Message $Message -Level $Level -TaskCategory $TaskCategory -LogToEvent:$LogToEvent Write-LogHelper `
} -Message $Message `
-Level $Level `
-TaskCategory $TaskCategory `
-LogToEvent:$LogToEvent `
-EventSource $EventSource `
-EventLog $EventLog
} }
}
#region Config & Task Definitions #region Config & Task Definitions