2023-03-31 15:56:07 +00:00
|
|
|
#Write to Log Function
|
2022-03-14 13:55:02 +00:00
|
|
|
|
2022-03-26 08:22:49 +00:00
|
|
|
function Write-Log ($LogMsg, $LogColor = "White") {
|
2022-10-26 22:49:10 +00:00
|
|
|
|
2022-03-14 13:55:02 +00:00
|
|
|
#Get log
|
|
|
|
$Log = "$(Get-Date -UFormat "%T") - $LogMsg"
|
2022-04-13 16:50:06 +00:00
|
|
|
|
2022-03-14 13:55:02 +00:00
|
|
|
#Echo log
|
|
|
|
$Log | Write-host -ForegroundColor $LogColor
|
2022-04-13 16:50:06 +00:00
|
|
|
|
2022-03-14 13:55:02 +00:00
|
|
|
#Write log to file
|
2022-03-26 08:22:49 +00:00
|
|
|
$Log | Out-File -FilePath $LogFile -Append
|
2022-04-13 16:50:06 +00:00
|
|
|
|
2022-10-26 22:49:10 +00:00
|
|
|
}
|