3

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?

Docschnitzel
  • 61
  • 1
  • 9

3 Answers3

3

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...

Docschnitzel
  • 61
  • 1
  • 9
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: http://www.computerperformance.co.uk/powershell/powershell3-logon-script.htm 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 06: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 07:01
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.

Donma
  • 11
  • 1