What kind of file do you right-click on and select Run?
Is that a .ps1 file?
When you start a script with powershell.exe, like you would do in Windows Task Scheduler, you add the -NonInteractive parameter.
But you have to make sure that your script is not causing any interactive prompts.
Your 2nd Set-PowerCLIConfiguration does not contain the -Confirm:$false parameter, so there will be a prompt.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference