3

I am trying to have Group Policy run a Logon script for a User OU. The script runs, but the part where it creates a Shell Object to run, it does not load during logon. If I double-click the script, it works as expected - the issue is during the logon.

Below is the contents of the script (sanitized):

Dim Response,URL,WshShell,
URL = "https://forms.office.com/Pages/ResponsePage.aspx?id=REDACTED"
Response = MsgBox("Have you completed your Daily Health Check survey today?", vbYesNo + vbQuestion + 4096,"Company Name Here")s
if Response = vbNo Then
    Set WshShell = CreateObject("WScript.shell")
    WshShell.run "CMD /C start """" /MAX /B ""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" " & URL, 0, False
End if
Canadian Luke
  • 885
  • 15
  • 44
  • Furthermore, you might also test running the logon script via **Computer Configuration | Admin Templates | System | Logon | Run these programs at user logon**, as opposed to **User Configuration | Windows Settings | Scripts (Logon/Logoff)** to see if that makes any difference just for some quick ideas you might be able to easily test. I know the machine config could be an issue if you are OU user targeting but maybe worth a test to see if that makes any difference... Quick thoughts. – Pimp Juice IT Dec 04 '20 at 00:02
  • Belay that! Adding it to the User Config does work... I had to add "cscript.exe" to the front of it though – Canadian Luke Dec 04 '20 at 00:16

1 Answers1

1

As Pimp Juice IT pointed out, I can also do this in User Configuration | Admin Templates | System | Logon | Run these programs at user logon.

To get past the "Do you want to run this script" error, I had to insert cscript.exe in front of the .VBS path. Refreshed the policy, and it started working.

Canadian Luke
  • 885
  • 15
  • 44