I try to add eventlog for .net framework using powershell.
When I run the following command in PowerShell to create a new event log
New-EventLog -source "src1" -LogName "myTest"
in the registry I See the following hierarchy
myTest --> myTest and src1
See below image
I do not want the second mytest entry . The hierarchy should be
myTest --> src1
I tried to remove this unwanted source using
Remove-EventLog -Source 'myTest'
I get the following error:
Remove-EventLog : The event log source 'myTest' cannot be deleted, because it's equal to the log name. At line:1 char:1
- Remove-EventLog -Source 'myTest'
-
+ CategoryInfo : NotSpecified: (:) [Remove-EventLog], InvalidOperationException + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.RemoveEventLogCommand
Any idea how can i fix this?