Run Registry for Automation and UAC

Welcome Forums General PowerShell Q&A Run Registry for Automation and UAC

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 years, 2 months ago.

  • Author
    Posts
  • #55898

    Participant
    Points: 33
    Rank: Member

    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

    Keymaster
    Points: 1,785
    Helping HandTeam Member
    Rank: Community Hero

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

    • #56017

      Participant
      Points: 33
      Rank: Member

      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

The topic ‘Run Registry for Automation and UAC’ is closed to new replies.