Skip to content

Content says Get-EventLog supports value 'localhost' for -ComputerName parameter; this is actually not the case #4018

@softwareguycoder

Description

@softwareguycoder

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.

Metadata

Metadata

Assignees

Labels

area-managementArea - Microsoft.PowerShell.Management module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions