Author Posts

September 20, 2017 at 11:52 am

I made a GUI that launches a Network Policy when the user logs in, this is done though GPO Logon Script. After the user "Accepts" the policy we have it minimize to the tray and when clicked on, it gives them info about their computer that we may ask them for so we want this script/gui to always be running.
The problem is this seems to leave the GPO "open" or running and will not update other policies at the next update interval.
Is there anyway I can have the GPO launch this script then let go of the GPO per say?

Thanks,
Scott

September 20, 2017 at 1:52 pm

Thanks for the reply. This is the way I have it setup and it does launch just fine and minimizes to the tray. The problem is that while its running (which we want to be all the time) the GPO never completes and never runs subsequent GPO checks.

September 20, 2017 at 2:14 pm

ok another possible way 🙂 use gpo to copy a batch file and your ps1 script to the users startup folder. the .bat file will then launch your ps1 script on startup

September 20, 2017 at 2:47 pm

Yeah, that would be my last resort as I didnt want to have to maintain 2 scripts for one reason 🙂
I also thought I could make a "launcher" script that would run from GPO and the launcher script would call the actual script. Not sure if that work or not and also has the same downfall as the above but may be my only choice. Was hoping someone else may have an another idea.

Thanks for your help!
Scott

September 20, 2017 at 2:50 pm

you could try converting your ps1 to an exe then you would only have one script to maintain

https://gallery.technet.microsoft.com/scriptcenter/PS2EXE-Convert-PowerShell-9e4e07f1

September 20, 2017 at 4:11 pm

Yeah, thats a good idea. I wrote it in Powershell Studio and can create the exe from there but saved it as a PS1 to make it easier in the GPO. Now I wonder if I would have the same problem if it was an exe. Thanks, I will have to try that out.

September 20, 2017 at 4:25 pm

Let me know how you get on. I think it should work as when launching a ps script it is waiting for a return (unless you run it as-job). Launching an exe it should not be waiting for a return same as launching a .bat file(