Powershell command works but script fails

I have a .ps1 file that I generated to add a registry key to extend the timeout length for Internet Explorer.

The command line work when run in PS, but when I convert it to a script it fails with the following error;

"New-ItemProperty : The property already exists.
At C:\Users\Dmaranya\IE_Timeout_Adjust.ps1:3 char:1
+ New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet ...
    + CategoryInfo          : ResourceExists: (HKEY_LOCAL_MACH...ternet Settings:String) [New-ItemProperty], IOExcepti
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.NewItemPropertyCommand

Anyone know why the command line works but the script doesn't?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Does the property already exist?  Are you using the -force parameter?

Care to share the script?
Mdamon808Author Commented:
Oops, it appears that I neglected to upload the file with my question. My bad, here it is.
Webinar: What were the top threats in Q2 2018?

Every quarter, the WatchGuard Threat Lab releases an Internet Security Report that describes and analyzes the top threat trends impacting companies around the world. Are you ready to learn more about the top threats of Q2 2018? Register for our Sept. 26th webinar to learn more!

Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
Try using -force  as in:

New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ReceiveTimeout -Value 3000 -Type Dword -Force | Out-Null

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mdamon808Author Commented:
Yup that's done it. Thanks a bunch. As a side note why did I have to add the | out-null part of the line?
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
Out-Null means discard the output
-Force should have worked in your case.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.