Groups > Microsoft > Windows PowerShell > Re: Executing PS1 files by double clicking on them




Executing PS1 files by double clicking on them

Executing PS1 files by double clicking on them
Tue, 15 Apr 2008 09:03:05 -070
I need some advice. Occasionally, some of my scripts are run by the 
technician manually and are not automatically invoked. In the case of 
powershell files, i am using either a VBS file or a BAT file to invoke the 
PS1 file because PS1s are designed to open with notepad by default. Can 
anyone offer me some advice as to a way that would allow the tech to just 
Post Reply
RE: Executing PS1 files by double clicking on them
Tue, 15 Apr 2008 09:38:01 -070
By default ps1 files are not executable by double clicking.  This is designed 
to prevent some of the issues seen with VBScript code that can be run by 
malware.

If you want to make the scripts accessible to running manually without 
access to the PowerShell prompt why not look at using PowerGUI

-- 
Richard Siddaway
All scripts are supplied "as is" and with no warranty 
PowerShell MVP
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"greatbarrier86" wrote:

> I need some advice. Occasionally, some of my scripts are run by the 
> technician manually and are not automatically invoked. In the case of 
> powershell files, i am using either a VBS file or a BAT file to invoke the

> PS1 file because PS1s are designed to open with notepad by default. Can 
> anyone offer me some advice as to a way that would allow the tech to just

Post Reply
Re: Executing PS1 files by double clicking on them
Tue, 15 Apr 2008 20:36:21 -070
You can make a shortcut to WindowsPowershell - the executable, and
name that shortcut what you want.  After the shortcut is made, you can
then append to the end of the 'Target' field -nologo -command &'\\path
\to\your\script.ps1' and when someone double clicks the link, and
presuming you have the execution policy set to run your script, a
shell will be created and your script will run it.  May not be the
most elegant, but it works.

Post Reply
about | contact