Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to associate .ps1 with powershell.exe instead of Notepad via GPO from a 2008r2 DC. I've seen one question mention CSE under Computer Configuration\Preferences\Control Panel Settings\Folder Options and setting it there. But I'm not sure exactly what to do and I can't find anything helpful anywhere.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

You're close. Under Folder Options, Right Click in the main part of the area and go to New -> File Type

Action: Create
File extension: .ps1
Check Configure Class Settings
Under Action -> New
Action: Open
Application: *Path to Powershell*

Then OK/Save out.

Reference: TechNet: Configure a File Type Item

EDIT: Can't find the class, and I even used PowerShell to extract that dropdown list and search it...nothing.

There is a way to set it via Registry in Group Policy. The class is Microsoft.PowerShellScript.1 and full path to it is:

HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\Open\Command

Change the (Default) value to:

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-file" "%1"

This is found in the GPOE:

\Computer Configuration\Preferences\Windows Settings\Registry

SUMMARY: Create a new Registry Item:

Settings:
  Action: Update
  Hive: HKEY_CLASSES_ROOT
  Key Path: Microsoft.PowerShellScript.1\Shell\Open\Command
  Value name: Check Default
  Value type: REG_SZ
  Value data: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-file" "%1"

Then wait for GP flush on machines.

share|improve this answer
    
It's asking for an associated class. What should I put there? –  Holocryptic Apr 8 '11 at 20:55
    
Touche. I can't find the class in the list. You can always just directly modify the registry using Group Policy. Interested? –  Theo Apr 8 '11 at 22:05
    
Sure. Give me a rundown in an edit on your answer. –  Holocryptic Apr 8 '11 at 22:12
    
Brilliant. I'll test this and mark appropriately. –  Holocryptic Apr 8 '11 at 22:36
    
This worked. Thanks a bunch! –  Holocryptic Apr 11 '11 at 14:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.