I have the below code and currently it loads all the information on screen. I want it to log to a log file on D:\\Apps\\Logs.
The log file needs to have the name of
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