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.