Google Reviews
If you find this content or our services useful, please leave us a review.

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 {}
}
Simple PowerShell Logging Function
Comments have now been disabled. If you have a question to ask about this post please ask the community!