I am using Write-EventLog
to log some file not found errors, where the error text includes the path. And it works great other than the automatic link creation seems to be stuck in the 90's. So any path that has a space is broken when you look at it in Event Viewer. Is there a way to force the link creation to work with modern paths? Or even force a particular event to not auto-create links? Or do I need to just not include paths?
FWIW I have to deal with PS2.0 as well as later.
EDIT: here is a little code stub that I just verified exhibits this behavior in Windows 7/PS2.0
$eventParameters = @{
logName = 'Application'
source = 'Test'
entryType = 'Error'
eventID = 1
message = "This is broken \\C:\Folder Name"
}
New-EventLog –logName:'Application' –source:'Test'
Write-EventLog @eventParameters
And these are broken too
message = 'This is broken "\\C:\Folder Name"'
message = 'This is broken \\Server\Folder Name'
But this "works", in that no link is created, so the space can't break it.
message = 'This is not broken C:\Folder Name'
So is the issue just that Event Viewer can't cope with UNC paths?