Skip to content

Example 4 for Get-WinEvent is incorrect #2122

Closed
@sdwheeler

Description

@sdwheeler

Example 4
$S = "Server01", "Server02", "Server03"
ForEach-Object ($Server in $S) {$Server; Get-WinEvent -ListLog "Windows PowerShell" -Computername $Server}

This doesn't work / any more.

To get that to work:

$S = "Server01", "Server02", "Server03"
ForEach ($Server in $S) {$Server; Get-WinEvent -ListLog "Windows PowerShell" -Computername $Server}

Or

$S = "Server01", "Server02", "Server03"
$S | ForEach-Object {$; Get-WinEvent -ListLog "Windows PowerShell" -Computername $}

Issue Details

Version(s) of document impacted

  • Impacts 6 document
  • Impacts 5.1 document
  • Impacts 5.0 document
  • Impacts 4.0 document
  • Impacts 3.0 document

Reason(s) for not selecting all version of documents

  • The documented feature was introduced in selected version of PowerShell
  • This issue only shows up in selected version of the document

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions