我需要从。2008r2 DC通过GPO将.ps1与powershell.exe关联,而不是记事本。 我在计算机configuration\首选项\控制面板设置\文件夹选项下看到一个问题提到CSE,并将其设置在那里。 但我不确定该做什么,也找不到任何有用的地方。
你很近 在“文件夹选项”下,右键单击该区域的主要部分,然后转到“新build” – >“文件types”
Action: Create File extension: .ps1 Check Configure Class Settings Under Action -> New Action: Open Application: *Path to Powershell*
然后确定/保存。
参考: TechNet:configuration文件types项目
编辑:找不到类,我甚至使用PowerShell来提取该下拉列表并search…没有。
有一种方法可以通过组策略中的registry进行设置。 这个类是Microsoft.PowerShellScript.1,它的完整path是:
HKEY_CLASSES_ROOT\Microsoft.PowerShellScript.1\Shell\Open\Command
将(默认)值更改为:
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" "-file" "%1"
这在GPOE中可以find:
\Computer Configuration\Preferences\Windows Settings\Registry
摘要:创build一个新的registry项:
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"
然后等待机器上的GP刷新。