0

I tried to disable UAC, restart the machine and install the program. I found an article how can create workflow, but it not works for me. When I run it once, the computer restarts, UAC is still enabled, and nothing happen.

workflow Resume_Workflow
{
    Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 0 
    Restart-Computer -Wait
    Start-Process msiexec.exe -Verb runAs -PassThru -Wait -ArgumentList '/I C:\tmp\_deployment\tightvnc-2.8.11-gpl-setup-64bit.msi /quiet /norestart'
}
# Create the scheduled job properties
$options = New-ScheduledJobOption -RunElevated 
$AtStartup = New-JobTrigger -AtStartup

    # Register the scheduled job
    Register-ScheduledJob -Name Resume_Workflow_Job -Trigger $AtStartup -ScriptBlock ({[System.Management.Automation.Remoting.PSSessionConfigurationData]::IsServerManager = $true; Import-Module PSWorkflow; Resume-Job -Name new_resume_workflow_job -Wait}) -ScheduledJobOption $options
    # Execute the workflow as a new job
    Resume_Workflow -AsJob -JobName new_resume_workflow_job

Any idea what's missing?

Thanks for the help.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
damHU
  • 51
  • 2
  • 2
  • 11
  • When setting the `ConsentPromptBehaviorAdmin` to 0 (default = 5) you are disabling UAC for Admins only. For this, the computer does NOT need to be restarted. – Theo Dec 05 '18 at 13:58
  • I deleted all the lines which connecting to the workflow. If I run the script from the tmp folder, UAC not able to switch off, but with ISE - elevated prompt - everything Ok. Somehow I need to complete Set-ItemProperty to run with elevated prompt. Thanks a lot! – damHU Dec 05 '18 at 14:25

0 Answers0