The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.
When you echo out $test, it comes out just fine but when it is used in the below command i get an error (both are below). How can I get a multi-line variable (aka Here-String) to write to the event log?
$test = @" Test ~~~~ TEst. "@
Write-EventLog –LogName "Application" –Source "test" –EntryType "Error" –EventID 1 –Message $test
At C:\Scripts\test.ps1:9 char:112
+ ... â€“EventID 1 â€“Message $test
The string is missing the terminator: ".
+ CategoryInfo : ParserError: (:) , ParseException
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfS
|Changing name of Powershell variables||2||18|
|Corrupt / Encrypted Word Documents||6||32|
|[Internet] Batch mode for shortening long URLs||3||13|
|PowerShell script that controls the number of LDAP queries||7||8|