Run Registry for Automation and UAC

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Kreston Yates Kreston Yates 1 month, 2 weeks ago.

  • Author
    Posts
  • #55898
    Profile photo of Kreston Yates
    Kreston Yates
    Participant

    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.

  • #55915
    Profile photo of Don Jones
    Don Jones
    Keymaster

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

    • #56017
      Profile photo of Kreston Yates
      Kreston Yates
      Participant

      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

You must be logged in to reply to this topic.