赢得11用PowerShell切换UAC

发布于 2025-02-09 09:23:49 字数 569 浏览 1 评论 0原文

I had disabled UAC with the command Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 0

and reenabled UAC with Set- ItemProperty -Path Registry :: HKEY_LOCAL_MACHINE \ SOFTWORD \ MICROSOFT \ WINDOWS \ CurrentVersion \ Policies \ Policies \ System -Name ConsentPromptPromptBehaviorAdmin -Value -Value 1

我的问题现在是UAC窗口看起来与切换UAC之前的外观不同。现在,它显示了用于输入管理员密码的字段。

知道如何将UAC设置为“正常”出现窗口?我无法提供UAC的屏幕截图,它总是显示一个空图像。

谢谢您的帮助!

I had disabled UAC with the command Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 0

and reenabled UAC with Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 1.

My Problem is now that the UAC Windows looks different than it did before toggling UAC. It now shows a field for entering the administrator password.

Any idea how I can set UAC to the "normal" appearing window? I cannot provide a screenshot of the UAC it always shows an empty image.

Thank you for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我最亲爱的 2025-02-16 09:23:49

一种方式:

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 5 /f

另一种方式:

Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 5

基本相同。这可以使用原始UAC窗口启用UAC,这意味着没有提示密码的提示。如果您想要该密码提示,将值从5更改为1。

谢谢@nico nekoru的链接

One way:

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 5 /f

another way:

Set-ItemProperty -Path REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System -Name ConsentPromptBehaviorAdmin -Value 5

Basically the same. This enables UAC with the original UAC window, which means without a prompt for the password. If you want that password prompt change the value from 5 to 1.

Thanks @Nico Nekoru for the links

心凉怎暖 2025-02-16 09:23:49
function Set-UAC ([Parameter(Position = 0)][ValidateSet("AlwaysNotify", "NotifyChanges", "NotifyChangesNoDim","NeverNotify")][string]$Level = "NeverNotify") {
    $uacValues = @{
        "AlwaysNotify" = @{
            "PromptOnSecureDesktop"      = 1
            "EnableLUA"                  = 1
            "ConsentPromptBehaviorAdmin" = 2
        }
        "NotifyChanges" = @{
            "PromptOnSecureDesktop"      = 1
            "EnableLUA"                  = 1
            "ConsentPromptBehaviorAdmin" = 5
        }
        "NotifyChangesNoDim" = @{
            "PromptOnSecureDesktop"      = 0
            "EnableLUA"                  = 1
            "ConsentPromptBehaviorAdmin" = 5
        }
        "NeverNotify" = @{
            "PromptOnSecureDesktop"      = 0
            "EnableLUA"                  = 1
            "ConsentPromptBehaviorAdmin" = 0
        }
    }
    $values = $uacValues["$Level"]
    $regPath = "REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System"
    foreach ($keyName in $values.Keys) {
        $keyExists = ((Test-Path $regPath) -and ($null -ne (Get-Item -LiteralPath $regPath).GetValue($keyName, $null)))
        $value = $values[$keyName]
        if ($keyExists) {
            Set-ItemProperty -Path $regPath  -Name $keyName -Value $value
        }
        else {
            New-ItemProperty -Path $regPath  -Name $keyName -Value $value -PropertyType "DWord"
        }
    }
}
function Set-UAC ([Parameter(Position = 0)][ValidateSet("AlwaysNotify", "NotifyChanges", "NotifyChangesNoDim","NeverNotify")][string]$Level = "NeverNotify") {
    $uacValues = @{
        "AlwaysNotify" = @{
            "PromptOnSecureDesktop"      = 1
            "EnableLUA"                  = 1
            "ConsentPromptBehaviorAdmin" = 2
        }
        "NotifyChanges" = @{
            "PromptOnSecureDesktop"      = 1
            "EnableLUA"                  = 1
            "ConsentPromptBehaviorAdmin" = 5
        }
        "NotifyChangesNoDim" = @{
            "PromptOnSecureDesktop"      = 0
            "EnableLUA"                  = 1
            "ConsentPromptBehaviorAdmin" = 5
        }
        "NeverNotify" = @{
            "PromptOnSecureDesktop"      = 0
            "EnableLUA"                  = 1
            "ConsentPromptBehaviorAdmin" = 0
        }
    }
    $values = $uacValues["$Level"]
    $regPath = "REGISTRY::HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System"
    foreach ($keyName in $values.Keys) {
        $keyExists = ((Test-Path $regPath) -and ($null -ne (Get-Item -LiteralPath $regPath).GetValue($keyName, $null)))
        $value = $values[$keyName]
        if ($keyExists) {
            Set-ItemProperty -Path $regPath  -Name $keyName -Value $value
        }
        else {
            New-ItemProperty -Path $regPath  -Name $keyName -Value $value -PropertyType "DWord"
        }
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文