GetEventlog code question Tagged: coding This topic contains 3 replies, has 3 voices, and was last updated by Olaf Soyk 9 months, 2 weeks ago. Author Posts December 10, 2016 at 6:17 pm #59956 Michael DowdsParticipant I'm using PS 5.0 for this code: Get-Eventlog security -ComputerName and putting my computer's name after -ComputerName, and getting this error: Get-EventLog : Missing an argument for parameter 'ComputerName'. Specify a parameter of type 'System.String' and try again. At line:1 char:23 + Get-Eventlog security -ComputerName + ~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-EventLog], ParameterBindingException + FullyQualifiedErrorId : MissingArgument,Microsoft.PowerShell.Commands.GetEventLogCommand The code is from PS in a Month of Lunches, 2e, page 31. I'm not understanding why the code isn't working as written in the book, nor am I understanding what the error is, as I should be opening the security log for my computer. Thanks for you help. December 10, 2016 at 7:42 pm #59959 Olaf SoykParticipant If you like run this cmdlet for your local computer you don't need the parameter -ComputerName. What's your computername? December 10, 2016 at 8:30 pm #59961 Ebru CucenParticipant What is your computername is a good question as it may have escape characters. Can you try this? Get-EventLog Security -Computer $env:COMPUTERNAME December 10, 2016 at 8:38 pm #59962 Olaf SoykParticipant Ahhh ... I gues I got it. If you like to use the parameter -ComputerName you have to put your computername after the parameter name. Like this: Get-Eventlog security -ComputerName "MyComputerName" Author Posts You must be logged in to reply to this topic.