2

I have a powershell script that creates an Outlook signature. It is applied via user-assigned GPO. All users are in the same OU, the group policy object is linked to that 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

It works flawlessly on Windows 10 devices, but windows 7 devices won't run it (even though it works when I run the script manually on the device).

I ran GPresult /R, and the policy did show up there...

Is there a difference in how windows 7 and 10 run their logon scripts?

2

Might be because of an executionpolicy being set differently in Windows 7. Try to do the following as a test: Create you GPO, containing both a .bat file, with the following line in it:

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

End your PS script with "set-executionpolicy default -force"

  • Get-executionpolicy returns RemoteSigned for both Windows 7 and Windows 10 systems. I'll try and see what the batch file does :) – Docschnitzel Apr 24 '17 at 12:15
  • I'm afraid that didn't solve the issue :( – Docschnitzel Apr 24 '17 at 16:41
  • 1
    Are the machines on the same network and accessing the script from a central location (netlogon folder preferrably)? As a reference I will recommend you to read this article/how-to: computerperformance.co.uk/powershell/… In a nutshell it rounds the same procedure as I mentioned, just with other parameters but also discusses the placement of the scriptfiles. – Mikael Dyreborg Hansen Apr 25 '17 at 6:49
  • Hi, the machines are on the exact same network. The script is located in a central location. I'll check out your link and provide feedback asap. – Docschnitzel Apr 25 '17 at 7:01
2

I figured it out!

The script has a space in its name. I removed the space and... it works!

I don't know if I should feel stupid for not figuring it out sooner...

  • 1
    Not really, no. Thanks for updating with you findings :) – Mikael Dyreborg Hansen Jun 9 '17 at 10:55
  • yeah, I didn't see it earlier because it was working fine in Win10. Oh well :D – Docschnitzel Jun 10 '17 at 17:22
1

We experienced a similar issue with the name. We were in the process of upgrading the environment (application version and moving from server 2008 to 2012) and knew our scripts for GPO worked. Apparently the ps1 file CANNOT contain spaces.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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