SyntaxFix
Write A Post
Hire A Developer
Questions
Put this at the top of your file:
$Logfile = "D:\Apps\Logs\$(gc env:computername).log" Function LogWrite { Param ([string]$logstring) Add-content $Logfile -value $logstring }
Then replace your Write-host calls with LogWrite.
Write-host
LogWrite