-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Hi,
I am trying to use the cmdlet Get-EventLog. The docs (at: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-eventlog?view=powershell-5.1) say that the -ComputerName parameter accepts as input the value localhost to mean the local computer. I know that I can also not supply the parameter, or put ., but this is not possible as this is part of a larger script I am working on for my customer and they want the option to pass the computer name they want events pulled from, so I am thinking I am going to have to read their choice in from a param to my script and then pass -ComputerName $param1 to the Get-EventLog cmdlet.
But my issue is, your docs have an errata. They specifically say localhost is a valid value for Get-EventLog; however, as can be seen by the PowerShell output below, this is not the case:
PS > $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 17763 316
PS > Get-EventLog -LogName Security -ComputerName localhost
Get-EventLog : The network path was not found.
At line:1 char:1
+ Get-EventLog -LogName Security -ComputerName localhost
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-EventLog], IOException
+ FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.GetEventLogCommand
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: bf280305-63b5-a41b-fe39-4c50484029c6
- Version Independent ID: 8fd10e62-dee2-56fd-e3c1-07c07f8854a3
- Content: Get-EventLog (Microsoft.PowerShell.Management)
- Content Source: reference/5.1/Microsoft.PowerShell.Management/Get-EventLog.md
- Product: powershell
- GitHub Login: @daxian-dbw
- Microsoft Alias: dongbow