Run Registry for Automation and UAC

During the course of a rather long automation script, I have to reboot a server multiple times. I set the Run registry value to re-start my script after the reboot and it will resume at the location in the script i stopped at, when i rebooted. (This all works like a champ without UAC, or course). I’m trying to function as intended with UAC on but, I am running into issues. From what I understand when you add a value to the HKLM\Software\Microsoft\Windows\CurrentVersion\Run registry, then on the subsequent reboot, what you specified to run will execute under the System account, which should have the necessary rights. My problem is my PS script begins to execute, but when it gets to sections that require elevated rights, it bangs out.
I was wondering if anyone has insight on how to execute a PS script from the Run registry without adjusting UAC? (or any other methods that would get me around turning UAC off?)

Appreciate any input.

This is a bit what DSC is actually intended to do. Is that an option?

Hey Don,

Unfortunately, the nature of this scenario doesn’t really allow for DSC to be a viable solution. These deployments are pretty complex, multi-machine deployments with unique configurations for each iteration that are inter-dependent, and dependent on whats initially selected by the tech for a new domain prod build. Sounds like I might need to turn off UAC completely and then just re-enable it after its all done.

Thanks,

Kreston