File font garbled;
hi using run space run process against multiple machines , logging info temp files, , end of script concenating temp files final log files. notice when script runs temp files have neatly formatted info after concenating final log file text garbled? encoding? way overcome this. noticed new line not preserved , tabs/spaces etc in final file.
http://social.technet.microsoft.com/forums/windowsserver/en-us/c0554226-071f-44a7-9f24-4600290d372e/runspace-threading-long-running-process?forum=winserverpowershell
i using function write tempfile.
{
param (
[string] $msg,
[string] $log,
[switch] $noconsole = $false,
[switch] $notimestamp = $false,
[switch] $help
)
if (!$msg) {
return @{"exitcode" = $false; "exitmsg" = "-msg parameter mandatory."}
}
if ($notimestamp -eq $true) {
$outstring = "$msg"
} else {
$outstring = (get-date).tostring() + " - " + $msg
}
if (!$log) {
write-host $outstring
} else {
if ($noconsole -eq $false) {
write-host $outstring
}
$outstring | out-file -append $log -encoding "utf8"
}
}
thanks
if temp files good, need see code you're using combine them.
Windows Server > Windows PowerShell
Comments
Post a Comment