.ps1 attachment preview with text previewer

C

Craig J. Lindstrom

How can I get .ps1 files to preview with the built-in text preview handler.
I have unblocked the .ps1 attachments so I can see them (in the registry)
and I have associated the .ps1 extension with the built-in text previewer
but I still get the message "This file cannot be previewed. Try opening the
file in the program in which it was created". I am an instructor and I have
students send their homework in via e-mail. Often times I like to quickly
view the scripts without saving the attachment. This is not a security
risk because you can't execute a powershell script directly anyway. Any
ideas how to solve this one?
 
D

David H. Lipman

From: "Craig J. Lindstrom" <[email protected]>

| How can I get .ps1 files to preview with the built-in text preview handler.
| I have unblocked the .ps1 attachments so I can see them (in the registry)
| and I have associated the .ps1 extension with the built-in text previewer
| but I still get the message "This file cannot be previewed. Try opening the
| file in the program in which it was created". I am an instructor and I have
| students send their homework in via e-mail. Often times I like to quickly
| view the scripts without saving the attachment. This is not a security
| risk because you can't execute a powershell script directly anyway. Any
| ideas how to solve this one?


It is a PostScript file, not a graphic, and non-native to Outlook.

You will have to save it and view it with PostScript file viewer.
 
D

Diane Poremsky [MVP]

*.ps1 extension is used for powershell scripts. It can be viewed in notepad
and should preview if associated with the text previewer.


--
Diane Poremsky [MVP - Outlook]





EMO - a weekly newsletter about Outlook and Exchange:
(e-mail address removed)

You can access this newsgroup by visiting
http://www.microsoft.com/office/community/en-us/default.mspx or point your
newsreader to msnews.microsoft.com.
 
D

Diane Poremsky [MVP]

Except the OP says its powershell not post script -
Often times I like to quickly view the scripts without saving the
attachment. This is not a security risk because you can't execute a
powershell script directly anyway.
--
Diane Poremsky [MVP - Outlook]





EMO - a weekly newsletter about Outlook and Exchange:
(e-mail address removed)

You can access this newsgroup by visiting
http://www.microsoft.com/office/community/en-us/default.mspx or point your
newsreader to msnews.microsoft.com.
 
D

David H. Lipman

From: "Diane Poremsky [MVP]" <[email protected]>

| Except the OP says its powershell not post script -


| Often times I like to quickly view the scripts without saving the
| attachment. This is not a security risk because you can't execute a
| powershell script directly anyway.

Oooops, right I missed that :-(
 
P

Patrick Reed

If you used the Level1Remove Registry entry to unblock this extension, I
don't think it will work. I believe you also have to remove it from the
Level 2 category, otherwise you will still need to save it to disk before
viewing.

What I had to do on my machine to get this to work (quick note - I'm going
with the Registry here, basically manually setting values that would
otherwise be set using a Group Policy):

Close Outlook and verify in Task Manager Outlook.exe is no longer running.

Navigate to
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Security
If you don't have this key path under HKCU\Software, you can add each key
manually (rt-click | New | Key).

In the Security key, create a new DWORD value named AdminSecurityMode
Set the value to 3

In the Security key, create a new String value named
FileExtensionsRemoveLevel1
Set the value to PS1

In the Security key, create a new String value named
FileExtensionsRemoveLevel2
Set the value to PS1

At this point, I still couldn't get my test.ps1 file to open with the TXT
Previewer. So, I went here:
http://blogs.msdn.com/toub/archive/2006/12/14/preview-handler-association-editor.aspx
....and downloaded his Preview Handler Association Editor.

Extract the EXE and run it, select Microsoft Windows TXT Preview Handler
from the drop-down list, uncheck the box to only show classes associated
with this handler, and then check the box next to .ps1 in the list.

Once I opened Outlook I was able start previewing my test.ps1 file.
 
C

Craig J. Lindstrom

Thanks,

That did it. That dang level 2!

Craig

Patrick Reed said:
If you used the Level1Remove Registry entry to unblock this extension, I
don't think it will work. I believe you also have to remove it from the
Level 2 category, otherwise you will still need to save it to disk before
viewing.

What I had to do on my machine to get this to work (quick note - I'm going
with the Registry here, basically manually setting values that would
otherwise be set using a Group Policy):

Close Outlook and verify in Task Manager Outlook.exe is no longer running.

Navigate to
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Outlook\Security
If you don't have this key path under HKCU\Software, you can add each key
manually (rt-click | New | Key).

In the Security key, create a new DWORD value named AdminSecurityMode
Set the value to 3

In the Security key, create a new String value named
FileExtensionsRemoveLevel1
Set the value to PS1

In the Security key, create a new String value named
FileExtensionsRemoveLevel2
Set the value to PS1

At this point, I still couldn't get my test.ps1 file to open with the TXT
Previewer. So, I went here:
http://blogs.msdn.com/toub/archive/2006/12/14/preview-handler-association-editor.aspx
...and downloaded his Preview Handler Association Editor.

Extract the EXE and run it, select Microsoft Windows TXT Preview Handler
from the drop-down list, uncheck the box to only show classes associated
with this handler, and then check the box next to .ps1 in the list.

Once I opened Outlook I was able start previewing my test.ps1 file.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top