我试图禁用 UAC,重新启动机器并安装程序。我发现一篇文章 如何创建工作流,但它不适用于我。当我运行一次时,计算机重新启动,UAC 仍处于启用状态,但没有任何反应。
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
知道缺少什么吗?
谢谢您的帮助。