Log Function

Using the log function for script output logging

Function WriteLog {
    param (
        [String]$Message,
        [String]$LogFilePath = "C:\Location\Install.log"
    )
    $DateTime = Get-Date -Format "dd.MM.yyyy HH:mm:ss"
    $LogEntry = "$DateTime | $Message"
    Write-Host $LogEntry
    Add-Content -Path $LogFilePath -Value $LogEntry
}

WriteLog -Message "Installation started."