Mdamon808
asked on
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_Timeo ut_Adjust. ps1:3 char:1
+ New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ Windows\Cu rrentVersi on\Interne t ...
+ CategoryInfo : ResourceExists: (HKEY_LOCAL_MACH...ternet Settings:String) [New-ItemProperty], IOExcepti
on
+ FullyQualifiedErrorId : System.IO.IOException,Micr osoft.Powe rShell.Com mands.NewI temPropert yCommand
Anyone know why the command line works but the script doesn't?
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_Timeo
+ New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\
+ CategoryInfo : ResourceExists: (HKEY_LOCAL_MACH...ternet Settings:String) [New-ItemProperty], IOExcepti
on
+ FullyQualifiedErrorId : System.IO.IOException,Micr
Anyone know why the command line works but the script doesn't?
Does the property already exist? Are you using the -force parameter?
Care to share the script?
Care to share the script?
ASKER
Oops, it appears that I neglected to upload the file with my question. My bad, here it is.
IE-Timeout-Adjust.txt
IE-Timeout-Adjust.txt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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?
Out-Null means discard the output
-Force should have worked in your case.
-Force should have worked in your case.
http://blogs.technet.com/b