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