Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Syntax Error

$
0
0

This code works.  It will return Evenlog info about the remote machine.  

 

Clear-Host

$Machine = "RemoteMachine"

Get-Eventlog -List -ComputerName $Machine

 

This code fails and gives this error. 

Clear-Host

$Machine = "RemoteMachine"

Get-Eventlog -List -ComputerName $Machine -Newest 2000 | where {$_.entryType -Match "Error"}

 

Get-EventLog : Parameter set cannot be resolved using the specified named parameters.

At C:\Temp\List only ERRORS in the EventLog.ps1:16 char:13

+ Get-Eventlog <<<<  -List -ComputerName $Machine -Newest 2000 | where {$_.entryType -Match "Error"}

    + CategoryInfo          : InvalidArgument: (:) [Get-EventLog], ParameterBindingException

    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.GetEventLogCommand

 

 

 

I've moved things around on the Get-EventLog line too and it still fails.  What am I doing wrong?


Viewing all articles
Browse latest Browse all 6937

Latest Images

Trending Articles



Latest Images