Look up Error in Application adn services in Event viewer

Hi All,
I created a script tp look up error 10003 in in event viewer log name ‘Microsoft-Windows-Dhcp-Client/admin’ but when run the script i get back no information, below is the script.
I would appreciate any help

$computers = GC c:\temp\computer.txt

Foreach(computer in $computers) (

{Get-WinEvent -computername $computers -FilterHashtable @{Logname = “Microsoft-Windows-Dhcp-Client/admin”; ID=“10003”}}


I don’t know if you introduced the syntax errors while pasting the code here but if not you must have had error messages …

Your loop variable is not a variable. It misses the dollar sign. Inside your loop you’re not using your loop variable you’re using the array with the computer names from your input file. And you’re using parenthesis for your loop script block instead of curly braces.

Try it his way:

$computerList = 
    Get-Content -Path 'c:\temp\computer.txt'
foreach ($ComputerName in $computerList) { 
    $FilterHashtable = 
        Logname = 'Microsoft-Windows-Dhcp-Client/admin'
        ID      = 10003
    Get-WinEvent -ComputerName $ComputerName -FilterHashtable $FilterHashtable

Hi Olaf,
yes was an error, I forgot to add the dollar sign, I will that the script an let you know.