This is a simple PowerShell logging function to write a specified message to a log file in the user %temp% folder.
function Write-Log {
[CmdletBinding()]
param(
[string]$message
)
try {
Add-Content -Value "$((Get-Date).tostring('dd/MM/yyyy HH:mm:ss')) - $message" -Path "$Env:Temp\Filename.log"
} catch {}
}
