We have a client with PowerShell 1.0. I know in PowerShell 2.0, I have the Write-EventLog commandlet. However, this doesn’t appear in PowerShell 1.0. I want my script to log events to the event log, mainly for debugging purposes.
How can I do this with PowerShell 1.0:? And, no I can’t upgrade this computer to PowerShell 2.0. This is a customer production machine, and they don’t want to touch the software on it.
You can use the .NET EventLog class to do this. It is pretty simple to use e.g.: