Where to place $ErrorActionPreference = "Stop" This topic contains 2 replies, has 2 voices, and was last updated by kishor 4 months ago. Author Posts June 16, 2017 at 3:07 pm #73064 kishorParticipant Hi, In my script I have used try and catch, what is the difference when I place $ErrorActionPreference = "Stop" inside the Try braces or if I place it in the start of the script before try braces. Thanks, Kishor June 16, 2017 at 3:18 pm #73066 Olaf SoykParticipant The difference is the time you set the preference. In the start it will be valid for all command that come after it. BTW: You don't have to use $ErrorActionPreference. It's enough when you put the parameter -ErrorAction Stop to the cmdlet in the try block. June 19, 2017 at 11:16 am #73171 kishorParticipant Thankyou Olaf! Author Posts You must be logged in to reply to this topic.