Update StackMonkey_v1.ps1
This commit is contained in:
@@ -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,19 +341,34 @@
|
|||||||
[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
|
||||||
|
|
||||||
# Define every task once here:
|
# Define every task once here:
|
||||||
|
|||||||
Reference in New Issue
Block a user