Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Newbie: ps1 execute question - philosophical

Reply
 
Old 10-12-2007   #1 (permalink)
Den Fox


 
 

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 SpecsSystem Spec
Old 10-12-2007   #2 (permalink)
Marco Shaw [MVP]


 
 

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.
>
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 PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 10-12-2007   #3 (permalink)
Den Fox


 
 

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 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

My System SpecsSystem Spec
Old 10-12-2007   #4 (permalink)
Karl Mitschke


 
 

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
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 SpecsSystem Spec
Old 10-12-2007   #5 (permalink)
Den Fox


 
 

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
Yep, that makes sense that they would run just fine from scheduler and
it works.

Thx
-Den

My System SpecsSystem Spec
Old 10-12-2007   #6 (permalink)
klumsy


 
 

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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46