![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | execution policy - local|remote Hello, I have a script (just get-date) which runs perfectly well in my C: folder when I double-click on it. I move it in my H: folder which is the mapping of a folder on a server of our net (I suppose it is considered as remote). In H: when I double-click on it, it doesn't work and despite the read-host at the end of it, the windows close immediately and there is no time to read the red error message. My execution-policy is Unrestricted so all scripts should be runned when I double-click on them, isn't it? Why is it not working. Cheers |
My System Specs![]() |
| | #2 (permalink) |
| | RE: execution policy - local|remote With Unrestricted an unsigned script downloaded from the Internet (and another drive is treated as the Internet in my experience) prompts for permission before it can be run. It may be that you are seeing. If you switch to the H: drive and run the script from a prompt what happens? What have you done to enable the file to run when doubled clicked - default behaviour is for that not to work as faras I understand -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty "Fil" wrote: > Hello, > > I have a script (just get-date) which runs perfectly well in my C: folder > when I double-click on it. > > I move it in my H: folder which is the mapping of a folder on a server of > our net (I suppose it is considered as remote). > In H: when I double-click on it, it doesn't work and despite the read-host > at the end of it, the windows close immediately and there is no time to read > the red error message. > > My execution-policy is Unrestricted so all scripts should be runned when I > double-click on them, isn't it? > > Why is it not working. > > Cheers |
My System Specs![]() |
| | #3 (permalink) |
| | Re: execution policy - local|remote Unless you or someone else has tweaked the registry post install then the .ps1 file should open in a text editor when double clicked. At least that's the behavior I see on Windows XP or Windows Server 2003 after a default install. Andrew Watt MVP On Thu, 23 Nov 2006 12:55:01 -0800, Fil <Fil@discussions.microsoft.com> wrote: >Hello, > >I have a script (just get-date) which runs perfectly well in my C: folder >when I double-click on it. > >I move it in my H: folder which is the mapping of a folder on a server of >our net (I suppose it is considered as remote). >In H: when I double-click on it, it doesn't work and despite the read-host >at the end of it, the windows close immediately and there is no time to read >the red error message. > >My execution-policy is Unrestricted so all scripts should be runned when I >double-click on them, isn't it? > >Why is it not working. > >Cheers |
My System Specs![]() |
| | #4 (permalink) |
| | Re: execution policy - local|remote > Unless you or someone else has tweaked the registry post install then > the .ps1 file should open in a text editor when double clicked. At Andrew is exactly correct. We ship with this file association and it should NEVER be changed to execute the script. This is very dangerous. -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: execution policy - local|remote I changed the file association via the file Association Tab of the Tool\Folder Options Menu of the windows explorer. How can it be dangerous if I am the only one using my computer and if I don't run other people scripts that I receive by email ? If I run scripts that I find in the forum it is the same if I run them by dble-clicking them or by pasting them in the command line. I am sure you have reasons to tell me it's dangerous since you're MSFT. I am just wondering what they are? Thank you. |
My System Specs![]() |
| | #6 (permalink) |
| | Re: execution policy - local|remote Its to avoid the situation you have with VBScript where you can double click on a script and it runs. Think for many malware attacks have come through VBScripts. -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty "Fil" wrote: > I changed the file association via the file Association Tab of the > Tool\Folder Options Menu of the windows explorer. > > How can it be dangerous if I am the only one using my computer and if I > don't run other people scripts that I receive by email ? > > If I run scripts that I find in the forum it is the same if I run them by > dble-clicking them or by pasting them in the command line. > > I am sure you have reasons to tell me it's dangerous since you're MSFT. I am > just wondering what they are? > > Thank you. |
My System Specs![]() |
| | #7 (permalink) |
| | Re: execution policy - local|remote But still one can decide to have script dble-clickable it he feels safe enough. Anyway it is still interesting to understand why ? Do you have an idea ? Cheers. "RichS" wrote: > Its to avoid the situation you have with VBScript where you can double click > on a script and it runs. Think for many malware attacks have come through > VBScripts. > -- > Richard Siddaway > > Please note that all scripts are supplied "as is" and with no warranty > > > "Fil" wrote: > > > I changed the file association via the file Association Tab of the > > Tool\Folder Options Menu of the windows explorer. > > > > How can it be dangerous if I am the only one using my computer and if I > > don't run other people scripts that I receive by email ? > > > > If I run scripts that I find in the forum it is the same if I run them by > > dble-clicking them or by pasting them in the command line. > > > > I am sure you have reasons to tell me it's dangerous since you're MSFT. I am > > just wondering what they are? > > > > Thank you. |
My System Specs![]() |
| | #8 (permalink) |
| | Re: execution policy - local|remote On Fri, 24 Nov 2006 00:00:01 -0800, Fil <Fil@discussions.microsoft.com> wrote: >I changed the file association via the file Association Tab of the >Tool\Folder Options Menu of the windows explorer. I would be interested to know exactly what you did. I played with that some time ago and always hit a barrier to executing by double clicking. >How can it be dangerous if I am the only one using my computer and if I >don't run other people scripts that I receive by email ? Suppose you copy and paste some PowerShell code and save it in a script (a .ps1 file), planning to evaluate it later. Then, after a while, you double click on the file containing the untested code and ... worst case scenario ... you have just inflicted serious damage on your system. Security is achieved by a combination of features. Preventing you double clicking to execute a .ps1 file protects against scenarios such as I described. If you never do that then there is no risk. But as soon as you do that occasionally ... ![]() Andrew Watt MVP |
My System Specs![]() |
| | #9 (permalink) |
| | Re: execution policy - local|remote > I am sure you have reasons to tell me it's dangerous since you're MSFT. I > am > just wondering what they are? This was the mechanism that caused one the greatest pains the industry has ever experienced (I LOVE YOU). Some people can smoke cigarettes and live to be 104 but for most people, its a really bad idea. If you think you are one of those people that can do it and live to be 104 and it turns out that you are not - you're in a bad spot. This is exactly the same. -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. |
My System Specs![]() |
| | #10 (permalink) |
| | Re: execution policy - local|remote "Andrew Watt [MVP]" wrote: > On Fri, 24 Nov 2006 00:00:01 -0800, Fil > <Fil@discussions.microsoft.com> wrote: > > >I changed the file association via the file Association Tab of the > >Tool\Folder Options Menu of the windows explorer. > > I would be interested to know exactly what you did. I played with that > some time ago and always hit a barrier to executing by double > clicking. I just created the file association by saying open with ... always with powershell. Then you create a txt file in your C: drive where there's just written: get-date Rename the extension in ps1. Set your execution policy to remoteSigned or unrestricted and it should work by dble-click. But if I copy paste the file on a network drive then it doesn't work anymore. Cheers. > > >How can it be dangerous if I am the only one using my computer and if I > >don't run other people scripts that I receive by email ? > > Suppose you copy and paste some PowerShell code and save it in a > script (a .ps1 file), planning to evaluate it later. > > Then, after a while, you double click on the file containing the > untested code and ... worst case scenario ... you have just inflicted > serious damage on your system. > > Security is achieved by a combination of features. Preventing you > double clicking to execute a .ps1 file protects against scenarios such > as I described. If you never do that then there is no risk. But as > soon as you do that occasionally ... ![]() > > Andrew Watt MVP > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Clearing user-scoped execution policy | PowerShell | |||
| execution policy problem executing remotely with hpc job scheduler | PowerShell | |||
| Execution Policy issues | PowerShell | |||
| RemoteSigned execution policy... | PowerShell | |||
| execution policy - how does it work? | PowerShell | |||