![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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) |
| | Newbie: ps1 execute question - philosophical I'm struggling to understand the philosophy behind not allowing a powershell script to be executed directly from a .ps1 icon. Powershell scripts can only be run from within the shell. Okay, so it adds a bit of security protection, but one can easily execute a .ps1 script from within a .vbs or a .bat by invoking powershell with the -Command parameter (powershell -Command test.ps1), so what's the point? Why the bias against being able to run a .ps1 from an icon when it is so easily overcome? I don't get that design choice. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Newbie: ps1 execute question - philosophical Den Fox wrote: Quote: > I'm struggling to understand the philosophy behind not allowing a > powershell script to be executed directly from a .ps1 icon. Powershell > scripts can only be run from within the shell. Okay, so it adds a bit > of security protection, but one can easily execute a .ps1 script from > within a .vbs or a .bat by invoking powershell with the -Command > parameter (powershell -Command test.ps1), so what's the point? > > Why the bias against being able to run a .ps1 from an icon when it is > so easily overcome? I don't get that design choice. > security experts, but it is just one extra piece of the overall security of PowerShell itself. In particular, where PowerShell might be installed (without a user knowing what it is), this extra feature might block infections or other malicious stuff. No matter how much you might tell new users to not click on attachments, they will anyways, but that doesn't mean they'll know to change their execution policy or know how to use powershell.exe to run their script. Yes, VBScript can work around all of this, but that's VBScript's fault! ;-) By now, most know to block .vbs at the mailserver level anyways. So as far as I'm concerned, this is to protect users who might not have any use for PowerShell, but have it on their PC regardless whether they installed it or someone else did. Marco -- Microsoft MVP - Windows PowerShell http://www.microsoft.com/mvp PowerGadgets MVP http://www.powergadgets.com/mvp Blog: http://marcoshaw.blogspot.com |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Newbie: ps1 execute question - philosophical On Oct 12, 1:29 pm, "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote: Quote: > Den Fox wrote: Quote: > > I'm struggling to understand the philosophy behind not allowing a > > powershell script to be executed directly from a .ps1 icon. Powershell > > scripts can only be run from within the shell. Okay, so it adds a bit > > of security protection, but one can easily execute a .ps1 script from > > within a .vbs or a .bat by invoking powershell with the -Command > > parameter (powershell -Command test.ps1), so what's the point? Quote: > > Why the bias against being able to run a .ps1 from an icon when it is > > so easily overcome? I don't get that design choice. > Well, this particular feature isn't the something that might impress > security experts, but it is just one extra piece of the overall security > of PowerShell itself. In particular, where PowerShell might be > installed (without a user knowing what it is), this extra feature might > block infections or other malicious stuff. > > No matter how much you might tell new users to not click on attachments, > they will anyways, but that doesn't mean they'll know to change their > execution policy or know how to use powershell.exe to run their script. > > Yes, VBScript can work around all of this, but that's VBScript's fault! > ;-) By now, most know to block .vbs at the mailserver level anyways. > > So as far as I'm concerned, this is to protect users who might not have > any use for PowerShell, but have it on their PC regardless whether they > installed it or someone else did. > > Marco > > -- > Microsoft MVP - Windows PowerShellhttp://www.microsoft.com/mvp > > PowerGadgets MVPhttp://www.powergadgets.com/mvp > > Blog:http://marcoshaw.blogspot.com do you "cheat" with a .vbs? I'm accustomed to running my .vbs scripts in Windows and in batch mode using scheduler. I guess this is a mental shift that I'm going to need to get used to. I can't see abandoning all my existing scripts just because I can now do it in PowerShell, but I will migrate towards PowerShell both rewriting some old scripts to learn and trying PowerShell for new activities. -Den |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Newbie: ps1 execute question - philosophical Hello Den, Quote: > Do you run most of your PowerShell scripts from within the console, or > do you "cheat" with a .vbs? > > I'm accustomed to running my .vbs scripts in Windows and in batch mode > using scheduler. I guess this is a mental shift that I'm going to need > to get used to. > > I can't see abandoning all my existing scripts just because I can now > do it in PowerShell, but I will migrate towards PowerShell both > rewriting some old scripts to learn and trying PowerShell for new > activities. > > -Den You can run them from the scheduler without "cheating" with vbscript: %windir%\system32\WindowsPowerShell\v1.0\powershell.exe <full path to script.ps1> You can run them interactivly the same way from a command prompt, if you really don't want to use the powershell prompt - but that REALLY buys you nothing! Karl |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Newbie: ps1 execute question - philosophical On Oct 12, 2:47 pm, Karl Mitschke <kmitsc...@xxxxxx> wrote: Quote: > Hello Den, > Quote: > > Do you run most of your PowerShell scripts from within the console, or > > do you "cheat" with a .vbs? Quote: > > I'm accustomed to running my .vbs scripts in Windows and in batch mode > > using scheduler. I guess this is a mental shift that I'm going to need > > to get used to. Quote: > > I can't see abandoning all my existing scripts just because I can now > > do it in PowerShell, but I will migrate towards PowerShell both > > rewriting some old scripts to learn and trying PowerShell for new > > activities. Quote: > > -Den > Den; > > You can run them from the scheduler without "cheating" with vbscript: > > %windir%\system32\WindowsPowerShell\v1.0\powershell.exe <full path to script.ps1> > > You can run them interactivly the same way from a command prompt, if you > really don't want to use the powershell prompt - but that REALLY buys you > nothing! > > Karl it works. Thx -Den |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Newbie: ps1 execute question - philosophical yes simply , the only thing that is it doesn't do a FILE ASSOCIATION of ps1 with powershell.exe . So you can still do anything you want to, you can even make the file association yourself (which of course i don't recommend you do ) |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Newbie question! | Virtual PC | |||
| a newbie with a question | Virtual PC | |||
| Re: Newbie Question | Live Mail | |||
| Newbie question | PowerShell | |||
| Newbie Question #3 | General Discussion | |||