Function Add-LogEntry { Param ( [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()]$Message, [Parameter(Mandatory = $false)] [ValidateSet('Notify', 'Warning', 'Error')]$As, [Parameter(Mandatory = $false)] [Switch]$NewLine ) $Timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" Switch ($As) { "Notify" { $FGC = "Cyan" } "Warning" { $FGC = "Yellow" } "Error" { $FGC = "Red" } Default { $FGC = "White" } } If ($Newline) { Write-Host "`n[$Timestamp] $Message" -ForegroundColor $FGC } Else { Write-Host "[$Timestamp] $Message" -ForegroundColor $FGC } }