• Group Policy scripts don’t run

    Home » Forums » AskWoody support » Windows » Windows 11 » Questions about Windows 11 » Group Policy scripts don’t run

    Author
    Topic
    #2635319

    I have  simple command prompt batch files in the Startup and Shutdown sections of Windows configuration of the GPO. They used to run just fine but now they won’t. RSOP report shows them as not having been run yet. The batch files run perfectly well from a command prompt window. The only change I know of from before to now is I booted into a temp install of Win 11 last week and it mucked up my regular Win 11 login. I had to do a startup repair for my regular Win to start normally. I even ran sfc /scannow and fixed some files but didn’t solve the script problem.

    I’ve tried everything I can find and understand on all sorts of support sites and nothing works. Help!

    • This topic was modified 1 year, 3 months ago by Mac E.
    Viewing 11 reply threads
    Author
    Replies
    • #2635349

      Are the scripts accessible during startup? If a drive has not yet been mapped or folder permissions are not correct they won’t be run.

      cheers, Paul

      • #2635801

        Yes. They are in the group policy folder in System32. The shutdown scripts don’t run either. They for sure would be available, right, since the system is up and running?

    • #2635876

      Event Log errors?
      Run Group Policy test (gpresult /r)? Not sure if it’s available on individual PCs.

      cheers, Paul

    • #2635945

      Here are the outputs from gpresult /r and gpresult /v. I don’t see anything that says error. I also looked in the Events Viewer to see if I could find something about scripts at start up time this morning, but I don’t find anything. But then, I really don’t know where in the Event Log I should look!

    • #2636096

      Have you tried “GPupdate /force” to make the machine run the scripts? Then check the event log for the most recent events.

      cheers, Paul

    • #2636166

      Will try. Was not aware of that option and don’t recall reading about it in all the comments I’ve seen. What does that option do, exactly? Does it run the scripts just as if the PC was starting up or shutting down?

       

    • #2636171

      Forces a refresh of the policy. Windows remembers the last policy it applied and won’t refresh unless it sees an increment in the policy number. Causes all sorts of “won’t apply GP” issues.

      cheers, Paul

    • #2636296

      Well, that didn’t help.

      A weird thing just happened. Don’t know if it’s related or not. I turned on a couple of removable hard drives. The first one didn’t pop up any messages after I did a scan for new hardware but it showed up in My PC. The second one showed disk activity that would not quit after I did a scan for new hardware. The scan for new popup would not close. I had to use Task Manager to close MMC. I tried shutting down but shutdown stalled with continuous disk activity and wouldn’t complete so I did a power off shutdown. When I restarted the startup scripts ran, so I did another shutdown & startup. The scripts did not run.

      I’m beginning to think my Windows installation is corrupt even though sfc /scannow shows no errors. I’ve been having to try sometimes 2 & 3 times to get a Admin level Command Prompt window to open up.

    • #2636308

      Questions….

      The second drive that kept running: If there is data on the drive, is you A/V scanning it? That could make dismounting it difficult. Along those same lines, is one of the scripts running a “job” (backup, copy, etc) that would access the drive?

      Could you remove the scripts, then put them back one by one rebooting in between, to see if one of them is the culprit?

    • #2636370

      I finally found the culprit. Fast startup had gotten enabled somewhere along the line. As soon as I disabled it all is OK. What finally caught my attention was a comment in the power settings that fast startup did not affect restart, only shutdown. That’s why I was seeing the scripts run with a restart reboot but not with a power off reboot.

       

      1 user thanked author for this post.
    • #2636486

      BTDT!

      Sometimes when you do a repair install, Windows re-enables fast start – even if you had it disabled before.

      And, even though it doesn’t really speed things up very much if you ‘re using an SSD (especially an NVME SSD), it seems Microsoft has decided everyone should be using it; whether they want to or not.

      • #2657625

        fast startup is really unnecessary for modern SSD drives and should be turned off

    • #2655192

      Well folks, here is another puzzlement associated with the above script issue. It seems like every time my PC gets hit with an external power shutdown the startup script quits working. What I discovered is when that happens there is an errorcode key entered into the startup section of the registry. “Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Startup\0\0\Errorcode”

      When I delete that key the script runs again.I see now it is there again with a value of 0. The next time the script doesn’t run I’ll have to check the value, but I think it may be 1.

      Any idea what might be causing that error code to come up and thus blocking the script from running?

      • #2657648

        Any idea what might be causing that error code to come up and thus blocking the script from running?

        It seems like every time my PC gets hit with an external power shutdown the startup script quits working

        I think you answered your own question…

        If you’re getting frequent power outages, consider getting a UPS.

         

         

         

         

    • #2655289

      You could just delete that key every day via a scheduled task.

      cheers, Paul

    Viewing 11 reply threads
    Reply To: Reply #2636486 in Group Policy scripts don’t run

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel