When i use this:
"$LogTime $CurrentDate Invalid Archive Grouping selected. You selected '$ArchiveGrouping'" | Out-File $LogFile -Append -Force
To write to a file i generated with this code:
$Logdate = Get-Date
$Logname = $Logdate.ToString("yyyyMMdd") + ".txt"
Add-Content -Path C:\ArchiveStorage\$Logname "Log" -force
$LogFile = "C:\ArchiveStorage\$Logname"
The Text in the file looks weird it looks like this:
if i change the code to just write to an existing file like:
$LogFile = "C:\ArchiveStorage\Log.txt"
The text file is as it should be:
why does it make spaces and all that random crap ?