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.
Asked
Active
Viewed 4,172 times
1 Answers
4
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.
Theo
- 989
- 5
- 11
-
It's asking for an associated class. What should I put there? – Holocryptic Apr 08 '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 08 '11 at 22:05
-
Sure. Give me a rundown in an edit on your answer. – Holocryptic Apr 08 '11 at 22:12
-
Brilliant. I'll test this and mark appropriately. – Holocryptic Apr 08 '11 at 22:36