Powershelllogin脚本(GPO)不运行赢7

我有一个PowerShell脚本创build一个Outlook签名。 它通过用户分配的GPO应用。 所有用户都在同一个OU中,组策略对象链接到该OU。

GPO:

User Configuration (Enabled)hide Policieshide Windows Settingshide Scriptshide Logonhide For this GPO, Script order: Windows PowerShell scripts will run firstName Parameters SignatureUnifiedFull v2.ps1 

它在Windows 10设备上完美地工作,但Windows 7设备将无法运行它(即使它在我手动在设备上运行脚本时工作)。

我跑了GPresult / R,政策显示在那里…

Windows 7和10如何运行login脚本有区别吗?

可能是因为Windows 7中的执行策略设置不同。尝试执行以下操作:创build包含两个.bat文件的GPO,其中包含以下行:

 powershell -noexit -c set-executionpolicy remotesigned -force c:\pshell.ps1 

用“set-executionpolicy default -force”结束你的PS脚本

我想到了!

该脚本的名字中有一个空格。 我删除了空间,…它的工作原理!

我不知道我是不是应该早点搞定